Skip to content

Commit d9b05a3

Browse files
committed
Fix unit tests
1 parent 607d35e commit d9b05a3

File tree

2 files changed

+1
-10
lines changed

2 files changed

+1
-10
lines changed

internal/controller/customresource/protection_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ func TestPatchLastConfigApplied(t *testing.T) {
216216
{
217217
title: "spec without changes is a noop",
218218
object: &akov2.AtlasProject{
219-
TypeMeta: metav1.TypeMeta{Kind: "AtlasProject", APIVersion: "atlas.mongodb.com"},
220219
ObjectMeta: metav1.ObjectMeta{Name: "test-project", Namespace: "ns", Annotations: map[string]string{}},
221220
Spec: akov2.AtlasProjectSpec{
222221
Name: "atlas-project-name",
@@ -243,7 +242,6 @@ func TestPatchLastConfigApplied(t *testing.T) {
243242
{
244243
title: "cleared spec is applied with no other changes",
245244
object: &akov2.AtlasProject{
246-
TypeMeta: metav1.TypeMeta{Kind: "AtlasProject", APIVersion: "atlas.mongodb.com"},
247245
ObjectMeta: metav1.ObjectMeta{Name: "test-project", Namespace: "ns", Annotations: map[string]string{}},
248246
Spec: akov2.AtlasProjectSpec{
249247
Name: "atlas-project-name",
@@ -309,7 +307,7 @@ func TestPatchLastConfigAppliedErrors(t *testing.T) {
309307
title: "empty struct cannot be patched",
310308
object: &akov2.AtlasProject{},
311309
spec: &struct{}{},
312-
wantErrorMsg: "failed to patch resource: \"\" is invalid: metadata.name: Required value: name is required",
310+
wantErrorMsg: "is invalid: metadata.name: Required value: name is required",
313311
},
314312
} {
315313
t.Run(tc.title, func(t *testing.T) {

pkg/controller/state/reconciler_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -295,13 +295,6 @@ func TestReconcile(t *testing.T) {
295295
},
296296
wantErr: "failed to manage finalizers: simulated patch error",
297297
},
298-
{
299-
name: "check state",
300-
existingObj: basePod,
301-
handleState: func(ctx context.Context, do *dummyObject) (Result, error) {
302-
return Result{NextState: "Initial"}, nil
303-
},
304-
},
305298
}
306299

307300
for _, tc := range tests {

0 commit comments

Comments
 (0)