@@ -18,51 +18,60 @@ import (
1818)
1919
2020var  _  =  Describe ("Dataplane performance" , Ordered , Label ("nfr" , "performance" ), func () {
21- 	files  :=  []string {
22- 		"dp-perf/coffee.yaml" ,
23- 		"dp-perf/gateway.yaml" ,
24- 		"dp-perf/cafe-routes.yaml" ,
25- 	}
26- 
27- 	var  ns  core.Namespace 
28- 
29- 	var  addr  string 
30- 	targetURL  :=  "http://cafe.example.com" 
31- 	var  outFile  * os.File 
32- 
33- 	t1  :=  framework.Target {
34- 		Method : "GET" ,
35- 		URL :    fmt .Sprintf ("%s%s" , targetURL , "/latte" ),
36- 	}
37- 	t2  :=  framework.Target {
38- 		Method : "GET" ,
39- 		URL :    fmt .Sprintf ("%s%s" , targetURL , "/coffee" ),
40- 		Header : http.Header {"version" : []string {"v2" }},
41- 	}
42- 	t3  :=  framework.Target {
43- 		Method : "GET" ,
44- 		URL :    fmt .Sprintf ("%s%s" , targetURL , "/coffee?TEST=v2" ),
45- 	}
46- 	t4  :=  framework.Target {
47- 		Method : "GET" ,
48- 		URL :    fmt .Sprintf ("%s%s" , targetURL , "/tea" ),
49- 	}
50- 	t5  :=  framework.Target {
51- 		Method : "POST" ,
52- 		URL :    fmt .Sprintf ("%s%s" , targetURL , "/tea" ),
53- 	}
21+ 	var  (
22+ 		files  =  []string {
23+ 			"dp-perf/coffee.yaml" ,
24+ 			"dp-perf/gateway.yaml" ,
25+ 			"dp-perf/cafe-routes.yaml" ,
26+ 		}
27+ 
28+ 		namespace  =  "dp-perf" 
29+ 
30+ 		targetURL  =  "http://cafe.example.com" 
31+ 
32+ 		t1  =  framework.Target {
33+ 			Method : "GET" ,
34+ 			URL :    fmt .Sprintf ("%s%s" , targetURL , "/latte" ),
35+ 		}
36+ 		t2  =  framework.Target {
37+ 			Method : "GET" ,
38+ 			URL :    fmt .Sprintf ("%s%s" , targetURL , "/coffee" ),
39+ 			Header : http.Header {"version" : []string {"v2" }},
40+ 		}
41+ 		t3  =  framework.Target {
42+ 			Method : "GET" ,
43+ 			URL :    fmt .Sprintf ("%s%s" , targetURL , "/coffee?TEST=v2" ),
44+ 		}
45+ 		t4  =  framework.Target {
46+ 			Method : "GET" ,
47+ 			URL :    fmt .Sprintf ("%s%s" , targetURL , "/tea" ),
48+ 		}
49+ 		t5  =  framework.Target {
50+ 			Method : "POST" ,
51+ 			URL :    fmt .Sprintf ("%s%s" , targetURL , "/tea" ),
52+ 		}
53+ 
54+ 		outFile  * os.File 
55+ 		addr     string 
56+ 	)
5457
5558	BeforeAll (func () {
56- 		ns  =  core.Namespace {
59+ 		ns  : =Namespace {
5760			ObjectMeta : metav1.ObjectMeta {
58- 				Name : "dp-perf" ,
61+ 				Name : namespace ,
5962			},
6063		}
6164
6265		Expect (resourceManager .Apply ([]client.Object {& ns })).To (Succeed ())
6366		Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
6467		Expect (resourceManager .WaitForAppsToBeReady (ns .Name )).To (Succeed ())
6568
69+ 		nginxPodNames , err  :=  framework .GetReadyNginxPodNames (k8sClient , namespace , timeoutConfig .GetTimeout )
70+ 		Expect (err ).ToNot (HaveOccurred ())
71+ 		Expect (nginxPodNames ).To (HaveLen (1 ))
72+ 
73+ 		setUpPortForward (nginxPodNames [0 ], namespace )
74+ 
6675		port  :=  ":80" 
6776		if  portFwdPort  !=  0  {
6877			port  =  fmt .Sprintf (":%s" , strconv .Itoa (portFwdPort ))
@@ -79,8 +88,10 @@ var _ = Describe("Dataplane performance", Ordered, Label("nfr", "performance"),
7988	})
8089
8190	AfterAll (func () {
82- 		Expect (resourceManager .DeleteFromFiles (files , ns .Name )).To (Succeed ())
83- 		Expect (resourceManager .DeleteNamespace (ns .Name )).To (Succeed ())
91+ 		cleanUpPortForward ()
92+ 
93+ 		Expect (resourceManager .DeleteFromFiles (files , namespace )).To (Succeed ())
94+ 		Expect (resourceManager .DeleteNamespace (namespace )).To (Succeed ())
8495		outFile .Close ()
8596	})
8697
0 commit comments