Skip to content

Commit 203407e

Browse files
author
Nont
committed
Add explanation for complex test logics and TODO for refactoring
Signed-off-by: Nont <[email protected]>
1 parent d38f3a7 commit 203407e

File tree

4 files changed

+7
-0
lines changed

4 files changed

+7
-0
lines changed

pkg/webhook/managedresource/createordelete.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ func EnsureVAP(ctx context.Context, c client.Client, isHub bool) error {
3939
obj client.Object
4040
mutate func() error
4141
}
42+
// TODO: this can be simplified by dealing with the specific type rather than using client.Object
4243
vap, mutateVAP := getVAPWithMutator(isHub)
4344
vapb, mutateVAPB := getVAPBindingWithMutator()
4445
objsAndMutators := []vapObjectAndMutator{

pkg/webhook/managedresource/createordelete_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ func TestEnsureVAP(t *testing.T) {
127127
}
128128

129129
interceptorFuncs := interceptor.Funcs{
130+
// This is needed for a test scenario that GET would retrieve the same object as what was created/updated.
131+
// TODO: refactor to simplify this. The store should not be needed as UPDATE should update the same object provided in fakeClient's WithObjects
130132
Get: func(ctx context.Context, c client.WithWatch, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error {
131133
if storedObj, exists := objectStore[key]; exists {
132134
switch v := obj.(type) {

pkg/webhook/managedresource/validatingadmissionpolicy.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import (
1010
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1111
)
1212

13+
// TODO use a differnt name for binding to simplify the code
14+
// and add a migration path
1315
const resourceName = "aks-fleet-managed-by-arm"
1416

1517
var forbidden = metav1.StatusReasonForbidden

test/e2e/setup_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,7 @@ func beforeSuiteForProcess1() {
397397

398398
setAllMemberClustersToJoin()
399399
checkIfAllMemberClustersHaveJoined()
400+
// TODO: add checks for VAP and its binding existence in Join Leave scenarios
400401
for _, c := range allMemberClusters {
401402
checkVAPAndBindingExistence(c)
402403
}
@@ -418,6 +419,7 @@ var _ = SynchronizedAfterSuite(func() {}, func() {
418419
deleteTestResourceCRD()
419420
setAllMemberClustersToLeave()
420421
checkIfAllMemberClustersHaveLeft()
422+
// TODO: add checks for VAP and its binding absence in Join Leave scenarios
421423
for _, c := range allMemberClusters {
422424
checkVAPAndBindingAbsence(c)
423425
}

0 commit comments

Comments
 (0)