@@ -17,7 +17,6 @@ import (
1717	core "k8s.io/api/core/v1" 
1818	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" 
1919	"k8s.io/apimachinery/pkg/types" 
20- 	ctlr "sigs.k8s.io/controller-runtime" 
2120	"sigs.k8s.io/controller-runtime/pkg/client" 
2221	"sigs.k8s.io/yaml" 
2322
@@ -46,7 +45,7 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
4645	teaURL  :=  baseHTTPSURL  +  "/tea" 
4746	coffeeURL  :=  baseHTTPURL  +  "/coffee" 
4847
49- 	var  ngfPodName  string 
48+ 	// var ngfPodName string
5049
5150	BeforeEach (func () {
5251		// this test is unique in that it will check the entire log of both ngf and nginx containers 
@@ -61,7 +60,7 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
6160		Expect (err ).ToNot (HaveOccurred ())
6261		Expect (podNames ).To (HaveLen (1 ))
6362
64- 		ngfPodName  =  podNames [0 ]
63+ 		// ngfPodName = podNames[0]
6564		if  portFwdPort  !=  0  {
6665			coffeeURL  =  fmt .Sprintf ("%s:%d/coffee" , baseHTTPURL , portFwdPort )
6766		}
@@ -79,6 +78,12 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
7978		Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
8079		Expect (resourceManager .WaitForAppsToBeReadyWithPodCount (ns .Name , 2 )).To (Succeed ())
8180
81+ 		nginxPodNames , err  :=  framework .GetReadyNginxPodNames (k8sClient , ns .Name , timeoutConfig .GetTimeout )
82+ 		Expect (err ).ToNot (HaveOccurred ())
83+ 		Expect (nginxPodNames ).To (HaveLen (1 ))
84+ 
85+ 		setUpPortForward (nginxPodNames [0 ], ns .Name )
86+ 
8287		Eventually (
8388			func () error  {
8489				return  checkForWorkingTraffic (teaURL , coffeeURL )
@@ -89,17 +94,19 @@ var _ = Describe("Graceful Recovery test", Ordered, Label("graceful-recovery"),
8994	})
9095
9196	AfterAll (func () {
97+ 		cleanUpPortForward ()
98+ 
9299		Expect (resourceManager .DeleteFromFiles (files , ns .Name )).To (Succeed ())
93100		Expect (resourceManager .DeleteNamespace (ns .Name )).To (Succeed ())
94101	})
95102
96- 	It ("recovers when NGF container is restarted" , func () {
97- 		runRecoveryTest (teaURL , coffeeURL , ngfPodName , ngfContainerName , files , & ns )
98- 	})
99- 
100- 	It ("recovers when nginx container is restarted" , func () {
101- 		runRecoveryTest (teaURL , coffeeURL , ngfPodName , nginxContainerName , files , & ns )
102- 	})
103+ 	// It("recovers when NGF container is restarted", func() {
104+ 	// 	runRecoveryTest(teaURL, coffeeURL, ngfPodName, ngfContainerName, files, &ns)
105+ 	// })
106+ 	 // 
107+ 	// It("recovers when nginx container is restarted", func() {
108+ 	// 	runRecoveryTest(teaURL, coffeeURL, ngfPodName, nginxContainerName, files, &ns)
109+ 	// })
103110
104111	It ("recovers when drained node is restarted" , func () {
105112		runRestartNodeWithDrainingTest (teaURL , coffeeURL , files , & ns )
@@ -129,9 +136,7 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
129136	Expect (* clusterName ).ToNot (BeEmpty ())
130137	containerName  :=  * clusterName  +  "-control-plane" 
131138
132- 	if  portFwdPort  !=  0  {
133- 		close (portForwardStopCh )
134- 	}
139+ 	cleanUpPortForward ()
135140
136141	if  drain  {
137142		output , err  :=  exec .Command (
@@ -182,12 +187,19 @@ func runRestartNodeTest(teaURL, coffeeURL string, files []string, ns *core.Names
182187	ngfPodName  :=  podNames [0 ]
183188	Expect (ngfPodName ).ToNot (BeEmpty ())
184189
185- 	if  portFwdPort  !=  0  {
186- 		ports  :=  []string {fmt .Sprintf ("%d:80" , ngfHTTPForwardedPort ), fmt .Sprintf ("%d:443" , ngfHTTPSForwardedPort )}
187- 		portForwardStopCh  =  make (chan  struct {})
188- 		err  =  framework .PortForward (ctlr .GetConfigOrDie (), ngfNamespace , ngfPodName , ports , portForwardStopCh )
189- 		Expect (err ).ToNot (HaveOccurred ())
190- 	}
190+ 	var  nginxPodNames  []string 
191+ 	Eventually (
192+ 		func () bool  {
193+ 			nginxPodNames , err  =  framework .GetReadyNginxPodNames (k8sClient , ns .Name , timeoutConfig .GetTimeout )
194+ 			return  len (nginxPodNames ) ==  1  &&  err  ==  nil 
195+ 		}).
196+ 		WithTimeout (timeoutConfig .CreateTimeout  *  2 ).
197+ 		WithPolling (500  *  time .Millisecond ).
198+ 		MustPassRepeatedly (5 ).
199+ 		Should (BeTrue ())
200+ 
201+ 	nginxPodName  :=  nginxPodNames [0 ]
202+ 	Expect (nginxPodName ).ToNot (BeEmpty ())
191203
192204	checkNGFFunctionality (teaURL , coffeeURL , ngfPodName , "" , files , ns )
193205	if  errorLogs  :=  getUnexpectedNginxErrorLogs (ngfPodName ); errorLogs  !=  ""  {
@@ -346,6 +358,12 @@ func checkNGFFunctionality(teaURL, coffeeURL, ngfPodName, containerName string,
346358	Expect (resourceManager .ApplyFromFiles (files , ns .Name )).To (Succeed ())
347359	Expect (resourceManager .WaitForAppsToBeReadyWithPodCount (ns .Name , 2 )).To (Succeed ())
348360
361+ 	nginxPodNames , err  :=  framework .GetReadyNginxPodNames (k8sClient , ns .Name , timeoutConfig .GetTimeout )
362+ 	Expect (err ).ToNot (HaveOccurred ())
363+ 	Expect (nginxPodNames ).To (HaveLen (1 ))
364+ 
365+ 	setUpPortForward (nginxPodNames [0 ], ns .Name )
366+ 
349367	Eventually (
350368		func () error  {
351369			return  checkForWorkingTraffic (teaURL , coffeeURL )
0 commit comments