Skip to content

Commit

Permalink
adjust to new fake client behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
ccpeng committed May 29, 2024
1 parent 6454a44 commit f22d30f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions pkg/addon/addon_update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,6 @@ func TestUpdateAddonStatusLifecycleFromWorkflow(t *testing.T) {
testNamespace := "default"
testAddonName := "test-addon"

fakeCli := fake.NewClientBuilder().WithScheme(scheme).Build()

updater := NewAddonUpdater(fakeRcdr, fakeCli, NewAddonVersionCacheClient(), ctrl.Log.WithName("test"))
testAddon := &addonmgrv1alpha1.Addon{
ObjectMeta: metav1.ObjectMeta{
Name: testAddonName,
Expand All @@ -74,6 +71,10 @@ func TestUpdateAddonStatusLifecycleFromWorkflow(t *testing.T) {
Resources: []addonmgrv1alpha1.ObjectStatus{},
},
}

fakeCli := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(testAddon).Build()
updater := NewAddonUpdater(fakeRcdr, fakeCli, NewAddonVersionCacheClient(), ctrl.Log.WithName("test"))

err := updater.client.Create(ctx, testAddon, &client.CreateOptions{})
g.Expect(err).ToNot(gomega.HaveOccurred())

Expand Down Expand Up @@ -167,9 +168,6 @@ func TestUpdateAddonStatusLifecycleFromWorkflow_DeleteFailed(t *testing.T) {
testNamespace := "default"
testAddonName := "test-addon"

fakeCli := fake.NewClientBuilder().WithScheme(scheme).Build()

updater := NewAddonUpdater(fakeRcdr, fakeCli, NewAddonVersionCacheClient(), ctrl.Log.WithName("test"))
testAddon := &addonmgrv1alpha1.Addon{
ObjectMeta: metav1.ObjectMeta{
Name: testAddonName,
Expand All @@ -188,6 +186,10 @@ func TestUpdateAddonStatusLifecycleFromWorkflow_DeleteFailed(t *testing.T) {
Resources: []addonmgrv1alpha1.ObjectStatus{},
},
}

fakeCli := fake.NewClientBuilder().WithScheme(scheme).WithStatusSubresource(testAddon).Build()
updater := NewAddonUpdater(fakeRcdr, fakeCli, NewAddonVersionCacheClient(), ctrl.Log.WithName("test"))

err := updater.client.Create(ctx, testAddon, &client.CreateOptions{})
g.Expect(err).ToNot(gomega.HaveOccurred())

Expand Down

0 comments on commit f22d30f

Please sign in to comment.