From 4522fb58f77bf2b8d841b1e26305ec5e13b354b4 Mon Sep 17 00:00:00 2001 From: unclejack Date: Sat, 18 Feb 2017 21:11:41 +0200 Subject: [PATCH 1/3] test/systemtests: gofmt fixes Signed-off-by: Cristian Staretu --- test/systemtests/basic_test.go | 14 +++++++------- test/systemtests/util_test.go | 8 ++++---- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/test/systemtests/basic_test.go b/test/systemtests/basic_test.go index edc9b5920..aae7eb7be 100755 --- a/test/systemtests/basic_test.go +++ b/test/systemtests/basic_test.go @@ -167,16 +167,16 @@ func (s *systemtestSuite) testBasicSvcDiscovery(c *C, encap string) { logrus.Infof("Creating epg: %s", group2.GroupName) c.Assert(s.cli.EndpointGroupPost(group2), IsNil) - // create DNS container - dnsContainer, err := s.runContainersOnNode(1, "private", "default", "", s.nodes[0]) - c.Assert(err, IsNil) - dnsIpAddr := dnsContainer[0].eth0.ip + // create DNS container + dnsContainer, err := s.runContainersOnNode(1, "private", "default", "", s.nodes[0]) + c.Assert(err, IsNil) + dnsIpAddr := dnsContainer[0].eth0.ip containers1, err := s.runContainersWithDNS(s.basicInfo.Containers, "default", "private", - fmt.Sprintf("svc1%d", i), dnsIpAddr) + fmt.Sprintf("svc1%d", i), dnsIpAddr) c.Assert(err, IsNil) containers2, err := s.runContainersWithDNS(s.basicInfo.Containers, "default", "private", - fmt.Sprintf("svc2%d", i), dnsIpAddr) + fmt.Sprintf("svc2%d", i), dnsIpAddr) c.Assert(err, IsNil) containers := append(containers1, containers2...) @@ -194,7 +194,7 @@ func (s *systemtestSuite) testBasicSvcDiscovery(c *C, encap string) { c.Assert(s.pingTestByName(containers, fmt.Sprintf("svc2%d", i)), IsNil) // cleanup - c.Assert(s.removeContainers(dnsContainer), IsNil) + c.Assert(s.removeContainers(dnsContainer), IsNil) c.Assert(s.removeContainers(containers), IsNil) c.Assert(s.cli.EndpointGroupDelete(group1.TenantName, group1.GroupName), IsNil) c.Assert(s.cli.EndpointGroupDelete(group2.TenantName, group2.GroupName), IsNil) diff --git a/test/systemtests/util_test.go b/test/systemtests/util_test.go index 66b059c16..a88a6ab6a 100755 --- a/test/systemtests/util_test.go +++ b/test/systemtests/util_test.go @@ -310,10 +310,10 @@ func (s *systemtestSuite) runContainersWithDNS(num int, tenantName, networkName, errChan := make(chan error) - if len(dnsServer) <= 0 { - logrus.Errorf("no dns specified") - return nil, fmt.Errorf("no dns") - } + if len(dnsServer) <= 0 { + logrus.Errorf("no dns specified") + return nil, fmt.Errorf("no dns") + } docknetName := fmt.Sprintf("%s/%s", networkName, tenantName) if tenantName == "default" { From 136748dbc614d0fa7c5a00190e1e103da4e5e717 Mon Sep 17 00:00:00 2001 From: unclejack Date: Sat, 18 Feb 2017 21:13:50 +0200 Subject: [PATCH 2/3] systemtests: don't log error when logs are missing Signed-off-by: Cristian Staretu --- test/systemtests/init_test.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/systemtests/init_test.go b/test/systemtests/init_test.go index 73c7e0177..191052888 100755 --- a/test/systemtests/init_test.go +++ b/test/systemtests/init_test.go @@ -3,12 +3,14 @@ package systemtests import ( "flag" "fmt" + "os" + "strings" + . "testing" + "github.com/Sirupsen/logrus" "github.com/contiv/contivmodel/client" "github.com/contiv/remotessh" . "gopkg.in/check.v1" - "os" - . "testing" ) type systemtestSuite struct { @@ -136,6 +138,9 @@ func (s *systemtestSuite) TearDownSuite(c *C) { for _, node := range s.nodes { logrus.Infof("Checking for errors on %v", node.Name()) out, _ := node.runCommand(`for i in /tmp/net*; do grep "error\|fatal\|panic" $i; done`) + if strings.Contains(out, "No such file or directory") { + continue + } if out != "" { logrus.Errorf("Errors in logfiles on %s: \n", node.Name()) fmt.Printf("%s\n==========================\n\n", out) From 48a5c912e74103d9b798e8bbf3d2d6c9d44d204b Mon Sep 17 00:00:00 2001 From: unclejack Date: Sat, 18 Feb 2017 21:21:24 +0200 Subject: [PATCH 3/3] systemtests: parallelize cleanup scripts Signed-off-by: Cristian Staretu --- test/systemtests/docker_test.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/test/systemtests/docker_test.go b/test/systemtests/docker_test.go index 6e56a4199..3a3dbdb00 100755 --- a/test/systemtests/docker_test.go +++ b/test/systemtests/docker_test.go @@ -451,22 +451,25 @@ func (d *docker) startNetmaster() error { func (d *docker) cleanupMaster() { logrus.Infof("Cleaning up master on %s", d.node.Name()) vNode := d.node.tbnode - vNode.RunCommand("etcdctl rm --recursive /contiv") - vNode.RunCommand("etcdctl rm --recursive /contiv.io") - vNode.RunCommand("etcdctl rm --recursive /docker") - vNode.RunCommand("curl -X DELETE localhost:8500/v1/kv/contiv.io?recurse=true") - vNode.RunCommand("curl -X DELETE localhost:8500/v1/kv/docker?recurse=true") + vNode.RunCommand(`etcdctl rm --recursive /contiv || true & + etcdctl rm --recursive /contiv.io || true & + etcdctl rm --recursive /docker || true & + curl -X DELETE localhost:8500/v1/kv/contiv.io?recurse=true || true & + curl -X DELETE localhost:8500/v1/kv/docker?recurse=true || true & + wait`) } func (d *docker) cleanupSlave() { logrus.Infof("Cleaning up slave on %s", d.node.Name()) vNode := d.node.tbnode - vNode.RunCommand("sudo ovs-vsctl del-br contivVxlanBridge") - vNode.RunCommand("sudo ovs-vsctl del-br contivVlanBridge") - vNode.RunCommand("sudo ovs-vsctl del-br contivHostBridge") - vNode.RunCommand("for p in `ifconfig | grep vport | awk '{print $1}'`; do sudo ip link delete $p type veth; done") - vNode.RunCommand("sudo rm /var/run/docker/plugins/netplugin.sock") - vNode.RunCommand("sudo service docker restart") + vNode.RunCommand(`sudo ovs-vsctl del-br contivVxlanBridge || true & + sudo ovs-vsctl del-br contivVlanBridge || true & + sudo ovs-vsctl del-br contivHostBridge || true & + sudo service docker restart & + interfaces=$(ip link | grep vport | awk '"'"'{ print $2 }'"'"' | tr -d : > /tmp/vports || true) + for p in $interfaces; do sudo ip link delete $p type veth || true; done & + sudo rm /var/run/docker/plugins/netplugin.sock || true & + wait`) } func (d *docker) runCommandUntilNoNetpluginError() error {