Skip to content

Commit

Permalink
Add unit test for namespace labels
Browse files Browse the repository at this point in the history
  • Loading branch information
stehessel committed Jan 19, 2023
1 parent 1cd1843 commit a963444
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions fleetshard/pkg/central/reconciler/reconciler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,20 @@ func TestCentralChanged(t *testing.T) {

}

func TestNamespaceLabelsAreSet(t *testing.T) {
fakeClient := testutils.NewFakeClientBuilder(t).Build()
r := NewCentralReconciler(fakeClient, private.ManagedCentral{}, nil, CentralReconcilerOptions{UseRoutes: true})

_, err := r.Reconcile(context.TODO(), simpleManagedCentral)
require.NoError(t, err)

namespace := &v1.Namespace{}
err = fakeClient.Get(context.TODO(), client.ObjectKey{Name: centralNamespace}, namespace)
require.NoError(t, err)
assert.Equal(t, simpleManagedCentral.Id, namespace.GetLabels()[tenantIDLabelKey])
assert.Equal(t, simpleManagedCentral.Spec.Auth.OwnerOrgId, namespace.GetLabels()[orgIDLabelKey])
}

func TestReportRoutesStatuses(t *testing.T) {
fakeClient := testutils.NewFakeClientBuilder(t).Build()
r := NewCentralReconciler(fakeClient, private.ManagedCentral{}, nil, CentralReconcilerOptions{UseRoutes: true})
Expand Down

0 comments on commit a963444

Please sign in to comment.