integration tests: send ip netns add errors to stderr, too

This commit is contained in:
Michael Stapelberg 2018-07-14 15:29:34 +02:00
parent 9131e7a99c
commit 9e0f83a7cf
4 changed files with 16 additions and 8 deletions

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()