| ... | ... |
@@ -2,9 +2,22 @@ package docker |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 | 4 |
"net" |
| 5 |
+ "os" |
|
| 5 | 6 |
"testing" |
| 6 | 7 |
) |
| 7 | 8 |
|
| 9 |
+func TestIptables(t *testing.T) {
|
|
| 10 |
+ if err := iptables("-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("-L"); err == nil {
|
|
| 17 |
+ t.Fatal("Not finding iptables in the PATH should cause an error")
|
|
| 18 |
+ } |
|
| 19 |
+} |
|
| 20 |
+ |
|
| 8 | 21 |
func TestNetworkRange(t *testing.T) {
|
| 9 | 22 |
// Simple class C test |
| 10 | 23 |
_, network, _ := net.ParseCIDR("192.168.0.1/24")
|