@@ -133,12 +133,22 @@ func TestMailStorageHealthAcrossActivation(t *testing.T) {
133133func TestEncryptedMailStorageHealthAcrossServing (t * testing.T ) {
134134 health := appsClaimHealth (t )
135135 tests := []struct {
136- name , phase , path string
137- mutate func (map [string ]any , map [string ]any )
138- want bool
139- wantFailed bool
136+ name , phase , path , claim string
137+ mutate func (map [string ]any , map [string ]any )
138+ want bool
139+ wantFailed bool
140140 }{
141141 {name : "prepared encrypted storage" , phase : "Pending" , want : true },
142+ {name : "prepared encrypted V2 claim" , phase : "Pending" , path : "k8s/providers/hetzner/apps" , claim : "email-data-encrypted-v2" , want : true },
143+ {name : "encrypted V2 with the older class" , phase : "Pending" , claim : "email-data-encrypted-v2" ,
144+ mutate : func (_ , s map [string ]any ) { s ["storageClassName" ] = "email-encrypted" }},
145+ {name : "encrypted V1 with the V2 class" , phase : "Pending" ,
146+ mutate : func (_ , s map [string ]any ) { s ["storageClassName" ] = "email-encrypted-v2" }},
147+ {name : "V2 provisioning has started" , phase : "Pending" , claim : "email-data-encrypted-v2" , mutate : func (m , _ map [string ]any ) {
148+ mapping (t , m ["annotations" ])["volume.kubernetes.io/selected-node" ] = "worker"
149+ }},
150+ {name : "V2 binding has started" , phase : "Pending" , claim : "email-data-encrypted-v2" ,
151+ mutate : func (_ , s map [string ]any ) { s ["volumeName" ] = "mail-v2-volume" }},
142152 {name : "production serving must bind" , phase : "Pending" , path : "k8s/providers/hetzner/apps" },
143153 {name : "production serving bound" , phase : "Bound" , path : "k8s/providers/hetzner/apps" , want : true },
144154 {name : "retained bound storage" , phase : "Bound" , want : true },
@@ -166,7 +176,11 @@ func TestEncryptedMailStorageHealthAcrossServing(t *testing.T) {
166176 if path == "" {
167177 path = "k8s/bases/apps/email-encrypted-storage"
168178 }
169- claim := object (t , render (t , path ), "PersistentVolumeClaim" , "email-data-encrypted" )
179+ name := tt .claim
180+ if name == "" {
181+ name = "email-data-encrypted"
182+ }
183+ claim := object (t , render (t , path ), "PersistentVolumeClaim" , name )
170184 metadata , claimSpec := mapping (t , claim ["metadata" ]), mapping (t , claim ["spec" ])
171185 if tt .mutate != nil {
172186 tt .mutate (metadata , claimSpec )
0 commit comments