@@ -124,6 +124,26 @@ func TestProfileModification(t *testing.T) {
124124 t .Fatalf ("failed to find rule %s in profile %s" , unlinkedRule , profileName )
125125 }
126126
127+ tpName1 := fmt .Sprintf ("%s-tp-before-update" , pbName )
128+ tp1 := & compv1alpha1.TailoredProfile {
129+ ObjectMeta : metav1.ObjectMeta {
130+ Name : tpName1 ,
131+ Namespace : f .OperatorNamespace ,
132+ },
133+ Spec : compv1alpha1.TailoredProfileSpec {
134+ Title : "TestProfileModification Before Update" ,
135+ Description : "TailoredProfile created before ProfileBundle update" ,
136+ Extends : profileName ,
137+ },
138+ }
139+ if err := f .Client .Create (context .TODO (), tp1 , nil ); err != nil {
140+ t .Fatalf ("failed to create TailoredProfile %s: %s" , tpName1 , err )
141+ }
142+ defer f .Client .Delete (context .TODO (), tp1 )
143+ if err := f .WaitForTailoredProfileStatus (f .OperatorNamespace , tpName1 , compv1alpha1 .TailoredProfileStateReady ); err != nil {
144+ t .Fatal (err )
145+ }
146+
127147 // update the image with a new hash
128148 modPb := origPb .DeepCopy ()
129149 if err := f .Client .Get (context .TODO (), types.NamespacedName {Namespace : modPb .Namespace , Name : modPb .Name }, modPb ); err != nil {
@@ -161,6 +181,26 @@ func TestProfileModification(t *testing.T) {
161181 if found {
162182 t .Fatalf ("rule %s unexpectedly found" , unlinkedRuleName )
163183 }
184+
185+ tpName2 := fmt .Sprintf ("%s-tp-after-update" , pbName )
186+ tp2 := & compv1alpha1.TailoredProfile {
187+ ObjectMeta : metav1.ObjectMeta {
188+ Name : tpName2 ,
189+ Namespace : f .OperatorNamespace ,
190+ },
191+ Spec : compv1alpha1.TailoredProfileSpec {
192+ Title : "TestProfileModification After Update" ,
193+ Description : "TailoredProfile created after ProfileBundle update" ,
194+ Extends : profileName ,
195+ },
196+ }
197+ if err := f .Client .Create (context .TODO (), tp2 , nil ); err != nil {
198+ t .Fatalf ("failed to create TailoredProfile %s: %s" , tpName2 , err )
199+ }
200+ defer f .Client .Delete (context .TODO (), tp2 )
201+ if err := f .WaitForTailoredProfileStatus (f .OperatorNamespace , tpName2 , compv1alpha1 .TailoredProfileStateReady ); err != nil {
202+ t .Fatal (err )
203+ }
164204}
165205
166206func TestProfileISTagUpdate (t * testing.T ) {
0 commit comments