mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Move iptables test to integration tests
This commit is contained in:
parent
8d3e35cd8d
commit
823674816e
2 changed files with 22 additions and 18 deletions
22
integration/iptables_test.go
Normal file
22
integration/iptables_test.go
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
package docker
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/dotcloud/docker/iptables"
|
||||||
|
"os"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
// FIXME: this test should be a unit test.
|
||||||
|
// For example by mocking os/exec to make sure iptables is not actually called.
|
||||||
|
|
||||||
|
func TestIptables(t *testing.T) {
|
||||||
|
if _, err := iptables.Raw("-L"); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
path := os.Getenv("PATH")
|
||||||
|
os.Setenv("PATH", "")
|
||||||
|
defer os.Setenv("PATH", path)
|
||||||
|
if _, err := iptables.Raw("-L"); err == nil {
|
||||||
|
t.Fatal("Not finding iptables in the PATH should cause an error")
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,18 +0,0 @@
|
||||||
package iptables
|
|
||||||
|
|
||||||
import (
|
|
||||||
"os"
|
|
||||||
"testing"
|
|
||||||
)
|
|
||||||
|
|
||||||
func TestIptables(t *testing.T) {
|
|
||||||
if _, err := Raw("-L"); err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
path := os.Getenv("PATH")
|
|
||||||
os.Setenv("PATH", "")
|
|
||||||
defer os.Setenv("PATH", path)
|
|
||||||
if _, err := Raw("-L"); err == nil {
|
|
||||||
t.Fatal("Not finding iptables in the PATH should cause an error")
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Add table
Reference in a new issue