Skip to content

Commit dc3007a

Browse files
author
Vipin Jain
committed
Merge branch 'add_regression'
2 parents 8def6ff + f7b9ffa commit dc3007a

14 files changed

+701
-114
lines changed

Makefile

+6-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,9 @@ unit-test: build
2424
./scripts/unittests -vagrant
2525

2626
system-test: build
27-
go test -v github.com/contiv/netplugin/systemtests/singlehost
28-
go test --timeout 20m -v github.com/contiv/netplugin/systemtests/twohosts
27+
go test -v -run "sanity" github.com/contiv/netplugin/systemtests/singlehost
28+
go test --timeout 20m -v -run "sanity" github.com/contiv/netplugin/systemtests/twohosts
29+
30+
regress-test: build
31+
go test -v -run "regress" github.com/contiv/netplugin/systemtests/singlehost
32+
go test --timeout 60m -v -run "regress" github.com/contiv/netplugin/systemtests/twohosts

examples/one_host_multiple_nets.json

+20-17
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11

22
{
3-
"Tenants" : [ {
3+
"Hosts" : [{
4+
"Name" : "host1",
5+
"Intf" : "eth2"
6+
}],
7+
"Tenants" : [{
48
"Name" : "tenant-one",
59
"DefaultNetType" : "vlan",
610
"SubnetPool" : "11.1.0.0/16",
@@ -9,26 +13,25 @@
913
"Networks" : [
1014
{
1115
"Name" : "orange",
12-
"Endpoints" : [
13-
{
14-
"Container" : "myContainer1"
16+
"Endpoints" : [{
17+
"Container" : "myContainer1",
18+
"Host" : "host1"
1519
},
1620
{
17-
"Container" : "myContainer2"
18-
}
19-
]
20-
},
21+
"Container" : "myContainer2",
22+
"Host" : "host1"
23+
}]
24+
},
2125
{
2226
"Name" : "purple",
23-
"Endpoints" : [
24-
{
25-
"Container" : "myContainer3"
27+
"Endpoints" : [{
28+
"Container" : "myContainer3",
29+
"Host" : "host1"
2630
},
2731
{
28-
"Container" : "myContainer4"
29-
}
30-
]
31-
}
32-
]
33-
} ]
32+
"Container" : "myContainer4",
33+
"Host" : "host1"
34+
}]
35+
}]
36+
}]
3437
}
+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/***
2+
Copyright 2014 Cisco Systems Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
package singlehost
17+
18+
import (
19+
"io/ioutil"
20+
"testing"
21+
22+
"github.com/contiv/netplugin/systemtests/utils"
23+
)
24+
25+
func TestOneHostMultipleNets_regress(t *testing.T) {
26+
defer func() {
27+
utils.ConfigCleanupCommon(t, vagrant.GetNodes())
28+
}()
29+
30+
cfgFile := utils.GetCfgFile("one_host_multiple_nets")
31+
jsonCfg, err := ioutil.ReadFile(cfgFile)
32+
if err != nil {
33+
t.Fatalf("failed to read config file %s \n", err)
34+
}
35+
utils.ConfigSetupCommon(t, string(jsonCfg), vagrant.GetNodes())
36+
37+
node1 := vagrant.GetNodes()[0]
38+
39+
utils.StartServer(t, node1, "myContainer1")
40+
defer func() {
41+
utils.DockerCleanup(node1, "myContainer1")
42+
}()
43+
ipAddress := utils.GetIpAddress(t, node1, "orange-myContainer1")
44+
utils.StartClient(t, node1, "myContainer2", ipAddress)
45+
defer func() {
46+
utils.DockerCleanup(node1, "myContainer2")
47+
}()
48+
49+
utils.StartServer(t, node1, "myContainer4")
50+
defer func() {
51+
utils.DockerCleanup(node1, "myContainer4")
52+
}()
53+
ipAddress = utils.GetIpAddress(t, node1, "purple-myContainer4")
54+
utils.StartClient(t, node1, "myContainer3", ipAddress)
55+
defer func() {
56+
utils.DockerCleanup(node1, "myContainer3")
57+
}()
58+
}
59+
60+
func TestOneHostVlan_regress(t *testing.T) {
61+
defer func() {
62+
utils.ConfigCleanupCommon(t, vagrant.GetNodes())
63+
}()
64+
65+
cfgFile := utils.GetCfgFile("one_host_vlan")
66+
jsonCfg, err := ioutil.ReadFile(cfgFile)
67+
if err != nil {
68+
t.Fatalf("failed to read config file %s \n", err)
69+
}
70+
utils.ConfigSetupCommon(t, string(jsonCfg), vagrant.GetNodes())
71+
72+
node1 := vagrant.GetNodes()[0]
73+
74+
utils.StartServer(t, node1, "myContainer1")
75+
defer func() {
76+
utils.DockerCleanup(node1, "myContainer1")
77+
}()
78+
79+
ipAddress := utils.GetIpAddress(t, node1, "orange-myContainer1")
80+
utils.StartClient(t, node1, "myContainer2", ipAddress)
81+
defer func() {
82+
utils.DockerCleanup(node1, "myContainer2")
83+
}()
84+
}

systemtests/singlehost/configsetup_test.go systemtests/singlehost/sanity_test.go

+18-26
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,32 @@
1+
/***
2+
Copyright 2014 Cisco Systems Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
116
package singlehost
217

318
import (
419
"fmt"
5-
"log"
6-
"os"
720
"strings"
821
"testing"
922

1023
"github.com/contiv/netplugin/systemtests/utils"
1124
)
1225

13-
var vagrant *utils.Vagrant
14-
15-
func TestMain(m *testing.M) {
16-
// setup a single node vagrant testbed
17-
vagrant = &utils.Vagrant{}
18-
log.Printf("Starting vagrant up...")
19-
err := vagrant.Setup(os.Getenv("CONTIV_ENV"), 1)
20-
log.Printf("Done with vagrant up...")
21-
if err != nil {
22-
log.Printf("Vagrant setup failed. Error: %s", err)
23-
vagrant.Teardown()
24-
os.Exit(1)
25-
}
26-
27-
exitCode := m.Run()
28-
29-
vagrant.Teardown()
30-
31-
os.Exit(exitCode)
32-
}
33-
3426
// Testcase:
3527
// - Create a single vlan network with two endpoints
3628
// - Verify that the endpoints are able to ping
37-
func TestSingleHostSingleVlanPingSuccess(t *testing.T) {
29+
func TestSingleHostSingleVlanPingSuccess_sanity(t *testing.T) {
3830
defer func() {
3931
utils.ConfigCleanupCommon(t, vagrant.GetNodes())
4032
}()
@@ -114,7 +106,7 @@ func TestSingleHostSingleVlanPingSuccess(t *testing.T) {
114106
// Testcase:
115107
// - Create a network with two vlans with two endpoints each
116108
// - Verify that the endpoints in same vlan are able to ping
117-
func TestSingleHostMultiVlanPingSuccess(t *testing.T) {
109+
func TestSingleHostMultiVlanPingSuccess_sanity(t *testing.T) {
118110
defer func() {
119111
utils.ConfigCleanupCommon(t, vagrant.GetNodes())
120112
}()
@@ -206,7 +198,7 @@ func TestSingleHostMultiVlanPingSuccess(t *testing.T) {
206198
// Testcase:
207199
// - Create a network with two vlans with one endpoints each
208200
// - Verify that the endpoints in different vlans are not able to ping
209-
func TestSingleHostMultiVlanPingFailure(t *testing.T) {
201+
func TestSingleHostMultiVlanPingFailure_sanity(t *testing.T) {
210202
defer func() {
211203
utils.ConfigCleanupCommon(t, vagrant.GetNodes())
212204
}()

systemtests/singlehost/setup_test.go

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/***
2+
Copyright 2014 Cisco Systems Inc. All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
*/
15+
16+
package singlehost
17+
18+
import (
19+
"log"
20+
"os"
21+
"testing"
22+
23+
"github.com/contiv/netplugin/systemtests/utils"
24+
)
25+
26+
var vagrant *utils.Vagrant
27+
28+
func TestMain(m *testing.M) {
29+
// setup a single node vagrant testbed
30+
vagrant = &utils.Vagrant{}
31+
log.Printf("Starting vagrant up...")
32+
err := vagrant.Setup(os.Getenv("CONTIV_ENV"), 1)
33+
log.Printf("Done with vagrant up...")
34+
if err != nil {
35+
log.Printf("Vagrant setup failed. Error: %s", err)
36+
vagrant.Teardown()
37+
os.Exit(1)
38+
}
39+
40+
exitCode := m.Run()
41+
42+
vagrant.Teardown()
43+
44+
os.Exit(exitCode)
45+
}

0 commit comments

Comments
 (0)