Skip to content

Commit 156cf06

Browse files
committed
Fix tests with hash change
1 parent 29a653d commit 156cf06

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

pkg/controller/controller_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ func TestControllerNamespacing(t *testing.T) {
134134
registry := typed.NewRegistry()
135135
broadcaster := record.NewBroadcaster()
136136
dclient := fake.NewSimpleDynamicClient(scheme.Scheme)
137-
kclient := kfake.NewSimpleClientset()
137+
kclient := kfake.NewClientset()
138138
c, err := NewController(ctx, registry, dclient, kclient, nil, "", "", broadcaster, tt.watchedNamespaces)
139139
require.NoError(t, err)
140140
queue := newKeyRecordingQueue(workqueue.NewTypedRateLimitingQueue(workqueue.DefaultTypedControllerRateLimiter[string]()))

pkg/controller/ensure_deployment_test.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
6262
migrationHash: "testtesttesttest",
6363
secretHash: "secret",
6464
existingDeployments: []*appsv1.Deployment{{ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
65-
metadata.SpiceDBConfigKey: "d63755f0adf415d2",
65+
metadata.SpiceDBConfigKey: "95f10575d028890f",
6666
}}}},
6767
expectNext: nextKey,
6868
},
@@ -71,7 +71,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
7171
migrationHash: "testtesttesttest",
7272
secretHash: "secret",
7373
existingDeployments: []*appsv1.Deployment{{}, {ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
74-
metadata.SpiceDBConfigKey: "d63755f0adf415d2",
74+
metadata.SpiceDBConfigKey: "95f10575d028890f",
7575
}}}},
7676
expectDelete: true,
7777
expectNext: nextKey,
@@ -81,7 +81,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
8181
migrationHash: "testtesttesttest",
8282
secretHash: "secret1",
8383
existingDeployments: []*appsv1.Deployment{{ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
84-
metadata.SpiceDBConfigKey: "d63755f0adf415d2",
84+
metadata.SpiceDBConfigKey: "95f10575d028890f",
8585
}}}},
8686
expectApply: true,
8787
expectRequeueAfter: true,
@@ -118,7 +118,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
118118
}},
119119
existingDeployments: []*appsv1.Deployment{{
120120
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
121-
metadata.SpiceDBConfigKey: "e3370c15d9428dca",
121+
metadata.SpiceDBConfigKey: "20730b08a142770d",
122122
}},
123123
Status: appsv1.DeploymentStatus{
124124
Replicas: 2,
@@ -155,7 +155,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
155155
}},
156156
existingDeployments: []*appsv1.Deployment{{
157157
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
158-
metadata.SpiceDBConfigKey: "e3370c15d9428dca",
158+
metadata.SpiceDBConfigKey: "20730b08a142770d",
159159
}},
160160
Status: appsv1.DeploymentStatus{
161161
Replicas: 2,
@@ -186,7 +186,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
186186
}},
187187
existingDeployments: []*appsv1.Deployment{{
188188
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
189-
metadata.SpiceDBConfigKey: "e3370c15d9428dca",
189+
metadata.SpiceDBConfigKey: "20730b08a142770d",
190190
}},
191191
Status: appsv1.DeploymentStatus{
192192
Replicas: 2,
@@ -237,7 +237,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
237237
}},
238238
existingDeployments: []*appsv1.Deployment{{
239239
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
240-
metadata.SpiceDBConfigKey: "e3370c15d9428dca",
240+
metadata.SpiceDBConfigKey: "20730b08a142770d",
241241
}},
242242
Status: appsv1.DeploymentStatus{
243243
Replicas: 2,
@@ -309,7 +309,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
309309
}},
310310
existingDeployments: []*appsv1.Deployment{{
311311
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
312-
metadata.SpiceDBConfigKey: "e3370c15d9428dca",
312+
metadata.SpiceDBConfigKey: "20730b08a142770d",
313313
}},
314314
Status: appsv1.DeploymentStatus{
315315
Replicas: 2,
@@ -345,7 +345,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
345345
}},
346346
existingDeployments: []*appsv1.Deployment{{
347347
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
348-
metadata.SpiceDBConfigKey: "e3370c15d9428dca",
348+
metadata.SpiceDBConfigKey: "20730b08a142770d",
349349
}},
350350
Status: appsv1.DeploymentStatus{
351351
Replicas: 2,
@@ -378,7 +378,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
378378
tt.expectStatus = &v1alpha1.SpiceDBCluster{}
379379
}
380380

381-
ctx := CtxConfig.WithValue(context.Background(), &config.Config{
381+
ctx := CtxConfig.WithValue(t.Context(), &config.Config{
382382
MigrationConfig: config.MigrationConfig{TargetSpiceDBImage: "test"},
383383
SpiceConfig: config.SpiceConfig{Replicas: tt.replicas},
384384
})
@@ -416,7 +416,7 @@ func TestEnsureDeploymentHandler(t *testing.T) {
416416
cluster.Status.Conditions[i].LastTransitionTime = now
417417
}
418418
require.Equal(t, tt.expectStatus, cluster)
419-
require.Equal(t, tt.expectApply, applyCalled)
419+
require.Equal(t, tt.expectApply, applyCalled, "apply's called status was different than expected")
420420
require.Equal(t, tt.expectDelete, deleteCalled)
421421
require.Equal(t, tt.expectPatchStatus, patchCalled)
422422
require.Equal(t, tt.expectNext, called)

0 commit comments

Comments
 (0)