Skip to content

Commit

Permalink
special -> specific
Browse files Browse the repository at this point in the history
  • Loading branch information
Devtools committed Aug 26, 2024
1 parent 1bd9407 commit f677a45
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion pkg/cmd/generate/admin-manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func ensureCluster(ctx *adminManifestsContext, clusterType configuration.Cluster
if specificKMemberName == "" {
ctx.PrintContextSeparatorf("Generating manifests for %s cluster type", clusterType)
} else {
ctx.PrintContextSeparatorf("Generating manifests for %s cluster type in the special Kustomize component: %s", clusterType, specificKMemberName)
ctx.PrintContextSeparatorf("Generating manifests for %s cluster type in the separate Kustomize component: %s", clusterType, specificKMemberName)
}

clusterCtx := &clusterContext{
Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/generate/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func TestEnsureServiceAccounts(t *testing.T) {
WithSkippedMembers("wrong-member")), // doesn't have any effect on filtering
[]assets.User{})
ctx := newAdminManifestsContextWithDefaultFiles(t, kubeSawAdmins)
clusterCtx := newFakeClusterContext(ctx, configuration.Member, withSpecialKMemberName("member-1"))
clusterCtx := newFakeClusterContext(ctx, configuration.Member, withSpecificKMemberName("member-1"))
t.Cleanup(gock.OffAll)
cache := objectsCache{}

Expand Down Expand Up @@ -207,7 +207,7 @@ func TestUsers(t *testing.T) {
WithSkippedMembers("wrong-member")), // doesn't have any effect on filtering
)
ctx := newAdminManifestsContextWithDefaultFiles(t, kubeSawAdmins)
clusterCtx := newFakeClusterContext(ctx, configuration.Member, withSpecialKMemberName("member-1"))
clusterCtx := newFakeClusterContext(ctx, configuration.Member, withSpecificKMemberName("member-1"))
t.Cleanup(gock.OffAll)
cache := objectsCache{}

Expand Down
4 changes: 2 additions & 2 deletions pkg/cmd/generate/mock_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ func newFakeClusterContext(adminManifestsContext *adminManifestsContext, cluster

type fakeClusterContextOption func(ctx *clusterContext)

func withSpecialKMemberName(specialKMemberName string) fakeClusterContextOption {
func withSpecificKMemberName(specificKMemberName string) fakeClusterContextOption {
return func(ctx *clusterContext) {
ctx.specificKMemberName = specialKMemberName
ctx.specificKMemberName = specificKMemberName
}
}
18 changes: 9 additions & 9 deletions pkg/cmd/generate/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,20 @@ func TestEnsureObject(t *testing.T) {
testEnsureObject(t, clusterType, "")
})
}
t.Run("when using specialKMemberName", func(t *testing.T) {
t.Run("when using specificKMemberName", func(t *testing.T) {
testEnsureObject(t, configuration.Member, "member-1")
})
}

func testEnsureObject(t *testing.T, clusterType configuration.ClusterType, specialKMemberName string) {
func testEnsureObject(t *testing.T, clusterType configuration.ClusterType, specificKMemberName string) {
t.Helper()

t.Run("for User object", func(t *testing.T) {
verifyEnsureManifest(t, clusterType, &userv1.User{}, specialKMemberName)
verifyEnsureManifest(t, clusterType, &userv1.User{}, specificKMemberName)
})

t.Run("for ServiceAccount object", func(t *testing.T) {
verifyEnsureManifest(t, clusterType, &corev1.ServiceAccount{}, specialKMemberName)
verifyEnsureManifest(t, clusterType, &corev1.ServiceAccount{}, specificKMemberName)
})
}

Expand All @@ -57,17 +57,17 @@ func prepareObjects(t *testing.T, name string, namespace string, object runtimec
return toBeStored, expectedWithTypeMeta
}

func verifyEnsureManifest(t *testing.T, clusterType configuration.ClusterType, object runtimeclient.Object, specialKMemberName string) {
func verifyEnsureManifest(t *testing.T, clusterType configuration.ClusterType, object runtimeclient.Object, specificKMemberName string) {
for _, namespace := range []string{"johnspace", "second-namespace", ""} {
t.Run("for namespace "+namespace, func(t *testing.T) {
// given
ctx := newAdminManifestsContextWithDefaultFiles(t, nil)
cache := objectsCache{}
toBeStored, expected := prepareObjects(t, "john", namespace, object)
clusterCtx := newFakeClusterContext(ctx, clusterType, withSpecialKMemberName(specialKMemberName))
clusterCtx := newFakeClusterContext(ctx, clusterType, withSpecificKMemberName(specificKMemberName))
rootKDir := clusterType.String()
if specialKMemberName != "" {
rootKDir = specialKMemberName
if specificKMemberName != "" {
rootKDir = specificKMemberName
}

// when
Expand Down Expand Up @@ -153,7 +153,7 @@ func verifyEnsureManifest(t *testing.T, clusterType configuration.ClusterType, o
assertObjectDoesNotExist(toBeStored.GetNamespace(), "john", object)
})

if specialKMemberName == "" {
if specificKMemberName == "" {
rootKDir := clusterType.String()
t.Run("single-cluster mode enabled", func(t *testing.T) {
// given
Expand Down

0 comments on commit f677a45

Please sign in to comment.