@@ -327,6 +327,22 @@ func TestRegisterResourceInGatewayConfig(t *testing.T) {
327
327
// Docker Secret again, already exists
328
328
resources = registerAndGetResources (dockerSecret )
329
329
g .Expect (resources .DockerSecrets ).To (ContainElement (dockerSecretMeta ))
330
+
331
+ // clear out resources before next test
332
+ store .deleteResourcesForGateway (nsName )
333
+
334
+ // Dataplane Key Secret
335
+ dataplaneKeySecretMeta := metav1.ObjectMeta {
336
+ Name : controller .CreateNginxResourceName (defaultMeta .Name , store .dataplaneKeySecretName ),
337
+ Namespace : defaultMeta .Namespace ,
338
+ }
339
+ dataplaneKeySecret := & corev1.Secret {ObjectMeta : dataplaneKeySecretMeta }
340
+ resources = registerAndGetResources (dataplaneKeySecret )
341
+ g .Expect (resources .DataplaneKeySecret ).To (Equal (dataplaneKeySecretMeta ))
342
+
343
+ // Dataplane Key Secret again, already exists
344
+ resources = registerAndGetResources (dataplaneKeySecret )
345
+ g .Expect (resources .DataplaneKeySecret ).To (Equal (dataplaneKeySecretMeta ))
330
346
}
331
347
332
348
func TestGatewayChanged (t * testing.T ) {
@@ -500,6 +516,10 @@ func TestGatewayExistsForResource(t *testing.T) {
500
516
Namespace : "default" ,
501
517
},
502
518
},
519
+ DataplaneKeySecret : metav1.ObjectMeta {
520
+ Name : "test-dataplane-key-secret" ,
521
+ Namespace : "default" ,
522
+ },
503
523
}
504
524
505
525
tests := []struct {
@@ -637,6 +657,16 @@ func TestGatewayExistsForResource(t *testing.T) {
637
657
},
638
658
expected : gateway ,
639
659
},
660
+ {
661
+ name : "Dataplane Key Secret exists" ,
662
+ object : & corev1.Secret {
663
+ ObjectMeta : metav1.ObjectMeta {
664
+ Name : "test-dataplane-key-secret" ,
665
+ Namespace : "default" ,
666
+ },
667
+ },
668
+ expected : gateway ,
669
+ },
640
670
{
641
671
name : "Resource does not exist" ,
642
672
object : & corev1.Service {
@@ -733,6 +763,11 @@ func TestGetResourceVersionForObject(t *testing.T) {
733
763
ResourceVersion : "13" ,
734
764
},
735
765
},
766
+ DataplaneKeySecret : metav1.ObjectMeta {
767
+ Name : "test-dataplane-key-secret" ,
768
+ Namespace : "default" ,
769
+ ResourceVersion : "14" ,
770
+ },
736
771
}
737
772
738
773
tests := []struct {
@@ -870,6 +905,16 @@ func TestGetResourceVersionForObject(t *testing.T) {
870
905
},
871
906
expectedResult : "13" ,
872
907
},
908
+ {
909
+ name : "Dataplane Key Secret resource version" ,
910
+ object : & corev1.Secret {
911
+ ObjectMeta : metav1.ObjectMeta {
912
+ Name : "test-dataplane-key-secret" ,
913
+ Namespace : "default" ,
914
+ },
915
+ },
916
+ expectedResult : "14" ,
917
+ },
873
918
{
874
919
name : "Non-existent resource" ,
875
920
object : & corev1.Service {
0 commit comments