@@ -10,6 +10,7 @@ import (
1010 "k8s.io/utils/ptr"
1111
1212 metalv1alpha1 "github.com/ironcore-dev/metal-operator/api/v1alpha1"
13+ . "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
1314)
1415
1516var _ = Describe ("BMCSecret Webhook" , func () {
@@ -31,7 +32,6 @@ var _ = Describe("BMCSecret Webhook", func() {
3132 "username" : []byte ("admin" ),
3233 "password" : []byte ("adminpass" ),
3334 },
34- Immutable : ptr .To (true ),
3535 }
3636 By ("Creating an BMCSecret" )
3737 Expect (k8sClient .Create (ctx , BMCSecret )).To (Succeed ())
@@ -40,6 +40,11 @@ var _ = Describe("BMCSecret Webhook", func() {
4040
4141 Context ("When creating or updating BMCSecret under Validating Webhook" , func () {
4242 It ("Should deny Update BMCSecret if Immutable is set to True" , func (ctx SpecContext ) {
43+ By ("Setting Immutable to True" )
44+ Eventually (Update (BMCSecret , func () {
45+ BMCSecret .Immutable = ptr .To (true )
46+ })).Should (Succeed ())
47+
4348 By ("Updating an BMCSecret with Immutable set to True" )
4449 BMCSecretUpdated := BMCSecret .DeepCopy ()
4550 BMCSecretUpdated .Data ["username" ] = []byte ("newadmin" )
0 commit comments