From 9e0f83a7cf09406e8d7cf80315eebb2fe58a494f Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 14 Jul 2018 15:29:34 +0200 Subject: [PATCH] integration tests: send ip netns add errors to stderr, too --- integration/dhcpv4/dhcpv4_test.go | 6 ++++-- integration/dhcpv6/dhcpv6_test.go | 6 ++++-- integration/netconfig/netconfig_test.go | 6 ++++-- integration/radvd/radvd_test.go | 6 ++++-- 4 files changed, 16 insertions(+), 8 deletions(-) diff --git a/integration/dhcpv4/dhcpv4_test.go b/integration/dhcpv4/dhcpv4_test.go index fd1ce0d..dace22d 100644 --- a/integration/dhcpv4/dhcpv4_test.go +++ b/integration/dhcpv4/dhcpv4_test.go @@ -32,8 +32,10 @@ import ( func TestDHCPv4(t *testing.T) { const ns = "ns0" // name of the network namespace to use for this test - if err := exec.Command("ip", "netns", "add", ns).Run(); err != nil { - t.Fatalf("ip netns add %s: %v", ns, err) + add := exec.Command("ip", "netns", "add", ns) + add.Stderr = os.Stderr + if err := add.Run(); err != nil { + t.Fatalf("%v: %v", add.Args, err) } defer exec.Command("ip", "netns", "delete", ns).Run() diff --git a/integration/dhcpv6/dhcpv6_test.go b/integration/dhcpv6/dhcpv6_test.go index 940f05c..0c97b16 100644 --- a/integration/dhcpv6/dhcpv6_test.go +++ b/integration/dhcpv6/dhcpv6_test.go @@ -32,8 +32,10 @@ var v6AddrRe = regexp.MustCompile(`2001:db8::[^ ]+`) func TestDHCPv6(t *testing.T) { const ns = "ns1" // name of the network namespace to use for this test - if err := exec.Command("ip", "netns", "add", ns).Run(); err != nil { - t.Fatalf("ip netns add %s: %v", ns, err) + add := exec.Command("ip", "netns", "add", ns) + add.Stderr = os.Stderr + if err := add.Run(); err != nil { + t.Fatalf("%v: %v", add.Args, err) } defer exec.Command("ip", "netns", "delete", ns).Run() diff --git a/integration/netconfig/netconfig_test.go b/integration/netconfig/netconfig_test.go index d7ae4b1..973886d 100644 --- a/integration/netconfig/netconfig_test.go +++ b/integration/netconfig/netconfig_test.go @@ -153,8 +153,10 @@ func TestNetconfig(t *testing.T) { } const ns = "ns3" // name of the network namespace to use for this test - if err := exec.Command("ip", "netns", "add", ns).Run(); err != nil { - t.Fatalf("ip netns add %s: %v", ns, err) + add := exec.Command("ip", "netns", "add", ns) + add.Stderr = os.Stderr + if err := add.Run(); err != nil { + t.Fatalf("%v: %v", add.Args, err) } defer exec.Command("ip", "netns", "delete", ns).Run() diff --git a/integration/radvd/radvd_test.go b/integration/radvd/radvd_test.go index beae733..f027fdf 100644 --- a/integration/radvd/radvd_test.go +++ b/integration/radvd/radvd_test.go @@ -29,8 +29,10 @@ import ( func TestRouterAdvertisement(t *testing.T) { const ns = "ns2" // name of the network namespace to use for this test - if err := exec.Command("ip", "netns", "add", ns).Run(); err != nil { - t.Fatalf("ip netns add %s: %v", ns, err) + add := exec.Command("ip", "netns", "add", ns) + add.Stderr = os.Stderr + if err := add.Run(); err != nil { + t.Fatalf("%v: %v", add.Args, err) } defer exec.Command("ip", "netns", "delete", ns).Run()