Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
09cb2e4
update dependecies versions
ranakan19 Apr 2, 2024
0076914
add context to eventHandlers
ranakan19 Apr 2, 2024
c131f66
update watches signature
ranakan19 Apr 2, 2024
324a1cf
Merge branch 'master' of github.com:codeready-toolchain/host-operator…
ranakan19 Apr 2, 2024
26e1c33
add context to eventHandlers after pulling
ranakan19 Apr 3, 2024
107ca15
updated watch signature usage - after pulling
ranakan19 Apr 3, 2024
3646ad4
update replace versions
ranakan19 Apr 10, 2024
6f91a19
resolve merge upstream master conflict
ranakan19 Apr 10, 2024
8ad1348
update option to SubResourceUpdateOption
ranakan19 Apr 11, 2024
876fdf9
Add context to eventHandler
ranakan19 Apr 11, 2024
c4acfd0
replace runtime object with runtimeClient Object
ranakan19 Apr 15, 2024
19fce7c
add context to eventHandler calls in tests
ranakan19 Apr 16, 2024
cedfcf4
replace with SubResourceUpdateOption for MockStatusUpdate
ranakan19 Apr 16, 2024
f8f8e5c
mur unit tests fixed to add finalizer with deletionTS
ranakan19 Apr 18, 2024
301f417
add notification to the subStatus resource
ranakan19 Apr 30, 2024
332dcdc
update common, and add finalizer to nstemplateset test
ranakan19 May 1, 2024
9552b40
prev changes
ranakan19 Jun 20, 2024
524b8a9
merge conflict resolve attempt
ranakan19 Jun 27, 2024
f9bcec7
runtimeclient options
ranakan19 Jun 28, 2024
17bde78
Add finalizers when deletionTS is present
ranakan19 Jul 5, 2024
6463c77
add notification obj by default in newController
ranakan19 Jul 9, 2024
2c9919b
merge conflict resolve, other unit test failures
ranakan19 Aug 7, 2024
7ecab05
Merge branch 'master' into runtime_15_host
ranakan19 Aug 7, 2024
90278f1
merge master, update common version
ranakan19 Aug 15, 2024
b1d4d83
Merge branch 'master' into runtime_15_host
ranakan19 Aug 15, 2024
6a2da79
merge resolve, update replaced toolchain-common version
ranakan19 Aug 15, 2024
2bdbf6b
options.Namespace is deprecated, replace it
ranakan19 Aug 15, 2024
29fdf5c
Merge branch 'master' into runtime_15_host
ranakan19 Nov 11, 2024
30e2461
update replace versions, library-go version, operator-utils and kubectl
ranakan19 Nov 11, 2024
e9e36a4
update kustome and controller-gen version in makefile
ranakan19 Nov 11, 2024
8faaca6
v5
ranakan19 Nov 11, 2024
32ae5a5
Merge branch 'master' into runtime_15_host
ranakan19 Nov 14, 2024
3b06460
update versions after merge, remove replace
ranakan19 Nov 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add notification to the subStatus resource
  • Loading branch information
ranakan19 committed Apr 30, 2024
commit 301f417363418ecddf85dbbcf26b8eb5bcc969cb
2 changes: 2 additions & 0 deletions controllers/masteruserrecord/sync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ func TestSyncMurStatusWithUserAccountStatusWhenUpdated(t *testing.T) {

// when
preSyncTime := metav1.Now()
// add a delay of a second to avoid flakiness
time.Sleep(1 * time.Second)
err := sync.synchronizeStatus(context.TODO())

// then
Expand Down
11 changes: 6 additions & 5 deletions controllers/notification/notification_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,8 @@ func TestNotificationSentFailure(t *testing.T) {
t.Run("will return an error since it cannot delete the Notification after successfully sending", func(t *testing.T) {
// given
ds, _ := mockDeliveryService(defaultTemplateLoader())
controller, cl := newController(t, ds, toolchainConfig)
controller, cl := newController(t, ds, toolchainConfig, &toolchainv1alpha1.Notification{})
// Add notification to fakeclient - update failing because notification status not found as subresource
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this would mean that you cannot call status update on kinds that were not added as part of the init step of the fake client. This looks a bit weird and like a bug to me. Is these being tracked somewhere or is that an expected feature?

Anyway, you can move adding the empty &toolchainv1alpha1.Notification{} object into the newController function and do it for all tests automatically.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an expected feature with the addition of SubResource - kubernetes-sigs/controller-runtime#2259

Thanks, added in newController in 6463c77

cl.MockDelete = func(ctx context.Context, obj runtimeclient.Object, opts ...runtimeclient.DeleteOption) error {
return fmt.Errorf("error")
}
Expand Down Expand Up @@ -141,7 +142,7 @@ func TestNotificationDelivery(t *testing.T) {
},
},
}
controller, cl := newController(t, ds, userSignup)
controller, cl := newController(t, ds, userSignup, &toolchainv1alpha1.Notification{})

notification, err := notify.NewNotificationBuilder(cl, test.HostOperatorNs).
WithUserContext(userSignup).
Expand Down Expand Up @@ -189,7 +190,7 @@ func TestNotificationDelivery(t *testing.T) {

t.Run("test admin notification delivery ok", func(t *testing.T) {
// given
controller, cl := newController(t, ds)
controller, cl := newController(t, ds, &toolchainv1alpha1.Notification{})

notification, err := notify.NewNotificationBuilder(cl, test.HostOperatorNs).
WithSubjectAndContent("Alert", "Something bad happened").
Expand Down Expand Up @@ -251,7 +252,7 @@ func TestNotificationDelivery(t *testing.T) {
},
}
// pass in nil for deliveryService since send won't be used (sending skipped)
controller, cl := newController(t, nil, userSignup, toolchainConfig)
controller, cl := newController(t, nil, userSignup, toolchainConfig, &toolchainv1alpha1.Notification{})

notification, err := notify.NewNotificationBuilder(cl, test.HostOperatorNs).
Create(context.TODO(), "[email protected]")
Expand Down Expand Up @@ -292,7 +293,7 @@ func TestNotificationDelivery(t *testing.T) {
},
}
mds := &MockDeliveryService{}
controller, cl := newController(t, mds, userSignup)
controller, cl := newController(t, mds, userSignup, &toolchainv1alpha1.Notification{})

notification, err := notify.NewNotificationBuilder(cl, test.HostOperatorNs).
Create(context.TODO(), "[email protected]")
Expand Down
4 changes: 3 additions & 1 deletion controllers/spacerequest/spacerequest_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,8 @@ func TestCreateSpaceRequest(t *testing.T) {
subSpace := spacetest.NewSpace(commontest.HostOperatorNs, spaceutil.SubSpaceName(parentSpace, sr),
spacetest.WithLabel(toolchainv1alpha1.SpaceRequestLabelKey, sr.GetName()), // subSpace was created from spaceRequest
spacetest.WithLabel(toolchainv1alpha1.SpaceRequestNamespaceLabelKey, sr.GetNamespace()), // subSpace was created from spaceRequest
spacetest.WithDeletionTimestamp(), // space is being deleted ...
spacetest.WithFinalizer(), // finalizer needs to be added to add deletionTS
spacetest.WithDeletionTimestamp(), // space is being deleted ...
spacetest.WithSpecParentSpace("jane"))
hostClient := commontest.NewFakeClient(t, appstudioEnvTier, parentSpace, subSpace)
ctrl := newReconciler(t, hostClient, member1)
Expand Down Expand Up @@ -953,6 +954,7 @@ func TestCreateSpaceRequest(t *testing.T) {
// given
parentSpace := spacetest.NewSpace(commontest.HostOperatorNs, "jane",
spacetest.WithCondition(spacetest.Terminating()),
spacetest.WithFinalizer(),
spacetest.WithDeletionTimestamp()) // parent space for some reason is being deleted
member1Client := commontest.NewFakeClient(t, sr, srNamespace)
member1 := NewMemberClusterWithClient(member1Client, "member-1", corev1.ConditionTrue)
Expand Down