From 823674816e59e1e8c3f768a97585c69e1d86ead8 Mon Sep 17 00:00:00 2001 From: Solomon Hykes Date: Fri, 15 Nov 2013 01:15:39 +0000 Subject: [PATCH] Move iptables test to integration tests --- integration/iptables_test.go | 22 ++++++++++++++++++++++ iptables/iptables_test.go | 18 ------------------ 2 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 integration/iptables_test.go delete mode 100644 iptables/iptables_test.go diff --git a/integration/iptables_test.go b/integration/iptables_test.go new file mode 100644 index 0000000000..060d0fe074 --- /dev/null +++ b/integration/iptables_test.go @@ -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") + } +} diff --git a/iptables/iptables_test.go b/iptables/iptables_test.go deleted file mode 100644 index 886a63c03f..0000000000 --- a/iptables/iptables_test.go +++ /dev/null @@ -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") - } -}