@@ -170,6 +170,7 @@ func resourceChecks() []resourceCheck {
170
170
{(* cryostatTestInput ).expectAgentProxyConfigMap , "agent proxy config map" },
171
171
{(* cryostatTestInput ).expectAgentGatewayService , "agent gateway service" },
172
172
{(* cryostatTestInput ).expectAgentCallbackService , "agent callback service" },
173
+ {(* cryostatTestInput ).expectOAuthCookieSecret , "OAuth2 cookie secret" },
173
174
}
174
175
}
175
176
@@ -517,7 +518,7 @@ func (c *controllerTest) commonTests() {
517
518
Expect (err ).ToNot (HaveOccurred ())
518
519
519
520
Expect (metav1 .IsControlledBy (secret , cr .Object )).To (BeTrue ())
520
- Expect (secret .StringData ["CONNECTION_KEY" ]).To (Equal (oldSecret .StringData ["CONNECTION_KEY" ]))
521
+ Expect (secret .Data ["CONNECTION_KEY" ]).To (Equal (oldSecret .Data ["CONNECTION_KEY" ]))
521
522
})
522
523
})
523
524
Context ("with existing Routes" , func () {
@@ -1839,20 +1840,21 @@ func (c *controllerTest) commonTests() {
1839
1840
})
1840
1841
})
1841
1842
Context ("with secret provided for database" , func () {
1842
- var customSecret * corev1.Secret
1843
1843
BeforeEach (func () {
1844
- customSecret = t .NewCustomDatabaseSecret ()
1845
- t .objs = append (t .objs , t .NewCryostatWithDatabaseSecretProvided ().Object , customSecret )
1844
+ t .GeneratedPasswords = []string {"auth_cookie_secret" , "object_storage" , "keystore" }
1845
+ t .DatabaseSecret = t .NewCustomDatabaseSecret ()
1846
+ t .objs = append (t .objs , t .NewCryostatWithDatabaseSecretProvided ().Object , t .DatabaseSecret )
1846
1847
})
1847
1848
JustBeforeEach (func () {
1848
1849
t .reconcileCryostatFully ()
1849
1850
})
1850
1851
It ("should configure deployment appropriately" , func () {
1851
1852
t .expectMainDeployment ()
1853
+ t .expectDatabaseDeployment ()
1852
1854
})
1853
1855
It ("should set Database Secret in CR Status" , func () {
1854
1856
instance := t .getCryostatInstance ()
1855
- Expect (instance .Status .DatabaseSecret ).To (Equal (customSecret .Name ))
1857
+ Expect (instance .Status .DatabaseSecret ).To (Equal (t . DatabaseSecret .Name ))
1856
1858
})
1857
1859
It ("should not generate default secret" , func () {
1858
1860
secret := & corev1.Secret {}
@@ -2558,7 +2560,7 @@ func (c *controllerTest) commonTests() {
2558
2560
Expect (binding .RoleRef ).To (Equal (expected .RoleRef ))
2559
2561
})
2560
2562
})
2561
- Context ("with additionnal label and annotation" , func () {
2563
+ Context ("with additional label and annotation" , func () {
2562
2564
BeforeEach (func () {
2563
2565
t .ReportReplicas = 1
2564
2566
t .objs = append (t .objs , t .NewCryostatWithAdditionalMetadata ().Object )
@@ -2897,7 +2899,7 @@ func (t *cryostatTestInput) expectWaitingForCertificate() {
2897
2899
2898
2900
func (t * cryostatTestInput ) expectCertificates () {
2899
2901
// Check certificates
2900
- certs := []* certv1.Certificate {t .NewCryostatCert (), t .NewCACert (), t .NewReportsCert (), t .NewAgentProxyCert ()}
2902
+ certs := []* certv1.Certificate {t .NewCryostatCert (), t .NewCACert (), t .NewReportsCert (), t .NewAgentProxyCert (), t . NewDatabaseCert (), t . NewStorageCert () }
2901
2903
for _ , expected := range certs {
2902
2904
actual := & certv1.Certificate {}
2903
2905
err := t .Client .Get (context .Background (), types.NamespacedName {Name : expected .Name , Namespace : expected .Namespace }, actual )
@@ -2920,7 +2922,7 @@ func (t *cryostatTestInput) expectCertificates() {
2920
2922
err := t .Client .Get (context .Background (), types.NamespacedName {Name : expectedSecret .Name , Namespace : expectedSecret .Namespace }, secret )
2921
2923
Expect (err ).ToNot (HaveOccurred ())
2922
2924
t .checkMetadata (secret , expectedSecret )
2923
- Expect (secret .StringData ).To (Equal (expectedSecret .StringData ))
2925
+ Expect (secret .Data ).To (Equal (expectedSecret .Data ))
2924
2926
2925
2927
// Check CA Cert secrets in each target namespace
2926
2928
Expect (t .TargetNamespaces ).ToNot (BeEmpty ())
@@ -3099,7 +3101,7 @@ func (t *cryostatTestInput) expectOAuth2ConfigMap() {
3099
3101
t .checkMetadata (cm , expected )
3100
3102
Expect (cm .Data ).To (HaveLen (1 ))
3101
3103
Expect (cm .Data ).To (HaveKey ("alpha_config.json" ))
3102
- Expect (cm .Data ["alpha_config.json" ]).To (MatchJSON (expected .Data ["alpha_config.json" ]))
3104
+ Expect (cm .Data ["alpha_config.json" ]).To (Equal (expected .Data ["alpha_config.json" ]))
3103
3105
Expect (cm .Immutable ).To (Equal (expected .Immutable ))
3104
3106
}
3105
3107
@@ -3157,7 +3159,7 @@ func (t *cryostatTestInput) expectDatabaseSecret() {
3157
3159
// Compare to desired spec
3158
3160
expectedSecret := t .NewDatabaseSecret ()
3159
3161
t .checkMetadata (secret , expectedSecret )
3160
- Expect (secret .StringData ).To (Equal (expectedSecret .StringData ))
3162
+ Expect (secret .Data ).To (Equal (expectedSecret .Data ))
3161
3163
Expect (secret .Immutable ).To (Equal (expectedSecret .Immutable ))
3162
3164
}
3163
3165
@@ -3169,7 +3171,18 @@ func (t *cryostatTestInput) expectStorageSecret() {
3169
3171
// Compare to desired spec
3170
3172
expectedSecret := t .NewStorageSecret ()
3171
3173
t .checkMetadata (secret , expectedSecret )
3172
- Expect (secret .StringData ).To (Equal (expectedSecret .StringData ))
3174
+ Expect (secret .Data ).To (Equal (expectedSecret .Data ))
3175
+ }
3176
+
3177
+ func (t * cryostatTestInput ) expectOAuthCookieSecret () {
3178
+ expectedSecret := t .NewAuthProxyCookieSecret ()
3179
+ secret := & corev1.Secret {}
3180
+ err := t .Client .Get (context .Background (), types.NamespacedName {Name : expectedSecret .Name , Namespace : expectedSecret .Namespace }, secret )
3181
+ Expect (err ).ToNot (HaveOccurred ())
3182
+
3183
+ // Compare to desired spec
3184
+ t .checkMetadata (secret , expectedSecret )
3185
+ Expect (secret .Data ).To (Equal (expectedSecret .Data ))
3173
3186
}
3174
3187
3175
3188
func (t * cryostatTestInput ) expectCoreService () {
@@ -3421,6 +3434,7 @@ func (t *cryostatTestInput) checkMainPodTemplate(deployment *appsv1.Deployment,
3421
3434
"kind" : "cryostat" ,
3422
3435
"component" : "cryostat" ,
3423
3436
}))
3437
+ Expect (template .Annotations ).To (Equal (t .NewMainPodAnnotations ()))
3424
3438
Expect (template .Spec .Volumes ).To (ConsistOf (t .NewVolumes ()))
3425
3439
Expect (template .Spec .SecurityContext ).To (Equal (t .NewPodSecurityContext (cr )))
3426
3440
@@ -3499,10 +3513,10 @@ func (t *cryostatTestInput) expectMainPodTemplateHasExtraMetadata(deployment *ap
3499
3513
"myPodExtraLabel" : "myPodLabel" ,
3500
3514
"myPodSecondExtraLabel" : "myPodSecondLabel" ,
3501
3515
}))
3502
- Expect ( template . Annotations ). To ( Equal ( map [ string ] string {
3503
- "myPodExtraAnnotation" : "myPodAnnotation" ,
3504
- "mySecondPodExtraAnnotation" : "mySecondPodAnnotation" ,
3505
- } ))
3516
+ annotations := t . NewMainPodAnnotations ()
3517
+ annotations [ "myPodExtraAnnotation" ] = "myPodAnnotation"
3518
+ annotations [ "mySecondPodExtraAnnotation" ] = "mySecondPodAnnotation"
3519
+ Expect ( template . Annotations ). To ( Equal ( annotations ))
3506
3520
}
3507
3521
3508
3522
func (t * cryostatTestInput ) expectDatabaseDeployment () {
@@ -3534,6 +3548,7 @@ func (t *cryostatTestInput) expectDatabaseDeployment() {
3534
3548
"kind" : "cryostat" ,
3535
3549
"component" : "database" ,
3536
3550
}))
3551
+ Expect (template .Annotations ).To (Equal (t .NewDatabasePodAnnotations ()))
3537
3552
Expect (template .Spec .Volumes ).To (ConsistOf (t .NewDatabaseVolumes ()))
3538
3553
Expect (template .Spec .SecurityContext ).To (Equal (t .NewPodSecurityContext (cr )))
3539
3554
@@ -3587,6 +3602,7 @@ func (t *cryostatTestInput) expectStorageDeployment() {
3587
3602
"kind" : "cryostat" ,
3588
3603
"component" : "storage" ,
3589
3604
}))
3605
+ Expect (template .Annotations ).To (Equal (t .NewStoragePodAnnotations ()))
3590
3606
Expect (template .Spec .Volumes ).To (ConsistOf (t .NewStorageVolumes ()))
3591
3607
Expect (template .Spec .SecurityContext ).To (Equal (t .NewPodSecurityContext (cr )))
3592
3608
@@ -3643,6 +3659,7 @@ func (t *cryostatTestInput) checkReportsDeployment() {
3643
3659
"kind" : "cryostat" ,
3644
3660
"component" : "reports" ,
3645
3661
}))
3662
+ Expect (template .Annotations ).To (Equal (t .NewReportsPodAnnotations ()))
3646
3663
Expect (template .Spec .Volumes ).To (ConsistOf (t .NewReportsVolumes ()))
3647
3664
Expect (template .Spec .SecurityContext ).To (Equal (t .NewReportPodSecurityContext (cr )))
3648
3665
@@ -3689,10 +3706,10 @@ func (t *cryostatTestInput) expectReportsDeploymentHasExtraMetadata() {
3689
3706
"myPodExtraLabel" : "myPodLabel" ,
3690
3707
"myPodSecondExtraLabel" : "myPodSecondLabel" ,
3691
3708
}))
3692
- Expect ( template . Annotations ). To ( Equal ( map [ string ] string {
3693
- "myPodExtraAnnotation" : "myPodAnnotation" ,
3694
- "mySecondPodExtraAnnotation" : "mySecondPodAnnotation" ,
3695
- } ))
3709
+ annotations := t . NewReportsPodAnnotations ()
3710
+ annotations [ "myPodExtraAnnotation" ] = "myPodAnnotation"
3711
+ annotations [ "mySecondPodExtraAnnotation" ] = "mySecondPodAnnotation"
3712
+ Expect ( template . Annotations ). To ( Equal ( annotations ))
3696
3713
}
3697
3714
3698
3715
func (t * cryostatTestInput ) checkDeploymentHasTemplates () {
0 commit comments