@@ -339,7 +339,7 @@ var _ = Describe("Test AutoScalingListener controller", func() {
339339 autoscalingListenerTestInterval ).Should (BeEquivalentTo (rulesForListenerRole ([]string {updated .Spec .EphemeralRunnerSetName })), "Role should be updated" )
340340 })
341341
342- It ("It should re-create pod whenever listener container is terminated" , func () {
342+ It ("It should re-create pod and config secret whenever listener container is terminated" , func () {
343343 // Waiting for the pod is created
344344 pod := new (corev1.Pod )
345345 Eventually (
@@ -355,7 +355,18 @@ var _ = Describe("Test AutoScalingListener controller", func() {
355355 autoscalingListenerTestInterval ,
356356 ).Should (BeEquivalentTo (autoscalingListener .Name ), "Pod should be created" )
357357
358+ secret := new (corev1.Secret )
359+ Eventually (
360+ func () error {
361+ return k8sClient .Get (ctx , client.ObjectKey {Name : scaleSetListenerConfigName (autoscalingListener ), Namespace : autoscalingListener .Namespace }, secret )
362+ },
363+ autoscalingListenerTestTimeout ,
364+ autoscalingListenerTestInterval ,
365+ ).Should (Succeed (), "Config secret should be created" )
366+
358367 oldPodUID := string (pod .UID )
368+ oldSecretUID := string (secret .UID )
369+
359370 updated := pod .DeepCopy ()
360371 updated .Status .ContainerStatuses = []corev1.ContainerStatus {
361372 {
@@ -384,6 +395,21 @@ var _ = Describe("Test AutoScalingListener controller", func() {
384395 autoscalingListenerTestTimeout ,
385396 autoscalingListenerTestInterval ,
386397 ).ShouldNot (BeEquivalentTo (oldPodUID ), "Pod should be re-created" )
398+
399+ // Check if config secret is re-created
400+ Eventually (
401+ func () (string , error ) {
402+ secret := new (corev1.Secret )
403+ err := k8sClient .Get (ctx , client.ObjectKey {Name : scaleSetListenerConfigName (autoscalingListener ), Namespace : autoscalingListener .Namespace }, secret )
404+ if err != nil {
405+ return "" , err
406+ }
407+
408+ return string (secret .UID ), nil
409+ },
410+ autoscalingListenerTestTimeout ,
411+ autoscalingListenerTestInterval ,
412+ ).ShouldNot (BeEquivalentTo (oldSecretUID ), "Config secret should be re-created" )
387413 })
388414 })
389415})
0 commit comments