@@ -2654,6 +2654,30 @@ func TestDeployment(t *testing.T) {
26542654 secret * corev1.Secret
26552655 wantDeployment * applyappsv1.DeploymentApplyConfiguration
26562656 }{
2657+ {
2658+ name : "migration hash is preserved when migrations are not skipped" ,
2659+ cluster : v1alpha1.ClusterSpec {
2660+ SecretRef : "test-secret" ,
2661+ Config : json .RawMessage (`
2662+ {
2663+ "logLevel": "debug",
2664+ "datastoreEngine": "cockroachdb"
2665+ }
2666+ ` ),
2667+ },
2668+ secret : & corev1.Secret {Data : map [string ][]byte {
2669+ "datastore_uri" : []byte ("uri" ),
2670+ "preshared_key" : []byte ("psk" ),
2671+ }},
2672+ wantDeployment : expectedDeployment (func (dep * applyappsv1.DeploymentApplyConfiguration ) {
2673+ // migrations not skipped: the deployment must carry the real
2674+ // migration hash so check_migrations can tell it apart from a
2675+ // "skipped" deployment.
2676+ dep .WithAnnotations (map [string ]string {
2677+ metadata .SpiceDBMigrationRequirementsKey : "1" ,
2678+ })
2679+ }),
2680+ },
26572681 {
26582682 name : "container name back compat: smp patch with old name" ,
26592683 cluster : v1alpha1.ClusterSpec {
@@ -3734,7 +3758,10 @@ func expectedDeployment(apply ...func(dep *applyappsv1.DeploymentApplyConfigurat
37343758 metadata .KubernetesVersionLabelKey : "v1" ,
37353759 }).
37363760 WithAnnotations (map [string ]string {
3737- metadata .SpiceDBMigrationRequirementsKey : "1" ,
3761+ // every TestDeployment case below sets skipMigrations: true, so the
3762+ // deployment must advertise "skipped" rather than the real migration
3763+ // hash (otherwise check_migrations would treat it as already migrated).
3764+ metadata .SpiceDBMigrationRequirementsKey : "skipped" ,
37383765 }).
37393766 WithOwnerReferences (applymetav1 .OwnerReference ().
37403767 WithName ("test" ).
0 commit comments