iptables_test.go 512 B

12345678910111213141516171819202122
  1. package docker
  2. import (
  3. "github.com/dotcloud/docker/pkg/iptables"
  4. "os"
  5. "testing"
  6. )
  7. // FIXME: this test should be a unit test.
  8. // For example by mocking os/exec to make sure iptables is not actually called.
  9. func TestIptables(t *testing.T) {
  10. if _, err := iptables.Raw("-L"); err != nil {
  11. t.Fatal(err)
  12. }
  13. path := os.Getenv("PATH")
  14. os.Setenv("PATH", "")
  15. defer os.Setenv("PATH", path)
  16. if _, err := iptables.Raw("-L"); err == nil {
  17. t.Fatal("Not finding iptables in the PATH should cause an error")
  18. }
  19. }