Skip to content

Commit 16f21dd

Browse files
authored
Merge pull request #3516 from xrstf/fix-todos
replace NewOrganizationFixture with NewWorkspaceFixture
2 parents 6086bf4 + 3cf977c commit 16f21dd

38 files changed

+102
-74
lines changed

test/e2e/apibinding/apibinding_deletion_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import (
3636

3737
"github.com/kcp-dev/kcp/config/helpers"
3838
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
39+
"github.com/kcp-dev/kcp/sdk/apis/core"
3940
"github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/util/conditions"
4041
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
4142
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
@@ -55,7 +56,7 @@ func TestAPIBindingDeletion(t *testing.T) {
5556
ctx, cancel := context.WithCancel(context.Background())
5657
t.Cleanup(cancel)
5758

58-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
59+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
5960
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
6061
consumerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
6162

@@ -64,8 +65,6 @@ func TestAPIBindingDeletion(t *testing.T) {
6465
kcpClusterClient, err := kcpclientset.NewForConfig(cfg)
6566
require.NoError(t, err, "failed to construct kcp cluster client for server")
6667

67-
require.NoError(t, err, "failed to construct crd cluster client for server")
68-
6968
dynamicClusterClient, err := kcpdynamic.NewForConfig(cfg)
7069
require.NoError(t, err, "failed to construct dynamic cluster client for server")
7170

test/e2e/apibinding/apibinding_logicalcluster_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import (
3535

3636
"github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha1"
3737
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
38+
"github.com/kcp-dev/kcp/sdk/apis/core"
3839
corev1alpha1 "github.com/kcp-dev/kcp/sdk/apis/core/v1alpha1"
3940
"github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/util/conditions"
4041
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
@@ -52,7 +53,7 @@ func TestAPIBindingLogicalCluster(t *testing.T) {
5253

5354
server := kcptesting.SharedKcpServer(t)
5455

55-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
56+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
5657
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
5758
consumerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
5859

@@ -185,7 +186,7 @@ func TestAPIBindingCRDs(t *testing.T) {
185186

186187
server := kcptesting.SharedKcpServer(t)
187188

188-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
189+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
189190
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
190191
consumerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
191192

test/e2e/apibinding/apibinding_permissionclaims_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ import (
3838

3939
"github.com/kcp-dev/kcp/config/helpers"
4040
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
41+
"github.com/kcp-dev/kcp/sdk/apis/core"
4142
"github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/util/conditions"
4243
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
4344
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
@@ -57,7 +58,7 @@ func TestAPIBindingPermissionClaimsConditions(t *testing.T) {
5758
ctx, cancel := context.WithCancel(context.Background())
5859
t.Cleanup(cancel)
5960

60-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
61+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
6162
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
6263
consumerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
6364

test/e2e/apibinding/apibinding_protected_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333

3434
"github.com/kcp-dev/kcp/config/helpers"
3535
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
36+
"github.com/kcp-dev/kcp/sdk/apis/core"
3637
"github.com/kcp-dev/kcp/sdk/apis/third_party/conditions/util/conditions"
3738
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
3839
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
@@ -49,7 +50,7 @@ func TestProtectedAPI(t *testing.T) {
4950
ctx, cancel := context.WithCancel(context.Background())
5051
t.Cleanup(cancel)
5152

52-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
53+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
5354
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
5455
consumerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
5556

test/e2e/apibinding/apibinding_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func TestAPIBindingAPIExportReferenceImmutability(t *testing.T) {
7070
ctx, cancel := context.WithCancel(context.Background())
7171
t.Cleanup(cancel)
7272

73-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
73+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
7474
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath, kcptesting.WithName("service-provider-1"))
7575
consumerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath, kcptesting.WithName("consumer-1-bound-against-1"))
7676

@@ -182,7 +182,7 @@ func TestAPIBinding(t *testing.T) {
182182

183183
t.Logf("Shards: %v", shards.Items)
184184

185-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
185+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
186186
var provider1Path, provider2Path logicalcluster.Path
187187
var provider1, provider2 *tenancyv1alpha1.Workspace
188188
if len(shards.Items) == 1 {

test/e2e/apibinding/apibinding_webhook_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import (
4545

4646
"github.com/kcp-dev/kcp/config/helpers"
4747
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
48+
"github.com/kcp-dev/kcp/sdk/apis/core"
4849
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
4950
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
5051
kcptestinghelpers "github.com/kcp-dev/kcp/sdk/testing/helpers"
@@ -64,7 +65,7 @@ func TestAPIBindingMutatingWebhook(t *testing.T) {
6465
ctx, cancel := context.WithCancel(context.Background())
6566
t.Cleanup(cancel)
6667

67-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
68+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
6869
sourcePath, sourceWS := kcptesting.NewWorkspaceFixture(t, server, orgPath)
6970
targetPath, targetWS := kcptesting.NewWorkspaceFixture(t, server, orgPath)
7071

@@ -249,7 +250,7 @@ func TestAPIBindingValidatingWebhook(t *testing.T) {
249250
ctx, cancel := context.WithCancel(context.Background())
250251
t.Cleanup(cancel)
251252

252-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
253+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
253254
sourcePath, sourceWS := kcptesting.NewWorkspaceFixture(t, server, orgPath)
254255
targetPath, targetWS := kcptesting.NewWorkspaceFixture(t, server, orgPath)
255256

test/e2e/apibinding/default_apibinding_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ import (
3737
"github.com/kcp-dev/kcp/config/helpers"
3838
"github.com/kcp-dev/kcp/pkg/reconciler/committer"
3939
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
40+
"github.com/kcp-dev/kcp/sdk/apis/core"
4041
tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1"
4142
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
4243
apisv1alpha2client "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/typed/apis/v1alpha2"
@@ -51,7 +52,7 @@ func TestDefaultAPIBinding(t *testing.T) {
5152

5253
server := kcptesting.SharedKcpServer(t)
5354

54-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
55+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
5556
providerPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
5657

5758
t.Logf("providerPath: %v", providerPath)

test/e2e/apibinding/maximalpermissionpolicy_authorizer_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ import (
4040

4141
"github.com/kcp-dev/kcp/config/helpers"
4242
apisv1alpha2 "github.com/kcp-dev/kcp/sdk/apis/apis/v1alpha2"
43+
"github.com/kcp-dev/kcp/sdk/apis/core"
4344
tenancyv1alpha1 "github.com/kcp-dev/kcp/sdk/apis/tenancy/v1alpha1"
4445
kcpclientset "github.com/kcp-dev/kcp/sdk/client/clientset/versioned/cluster"
4546
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
@@ -69,7 +70,7 @@ func TestMaximalPermissionPolicyAuthorizerSystemGroupProtection(t *testing.T) {
6970
require.NoError(t, err)
7071

7172
t.Logf("Creating workspace")
72-
orgPath, _ := framework.NewOrganizationFixture(t, server, kcptesting.WithRootShard()) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
73+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithRootShard(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
7374

7475
t.Logf("Giving user-1 admin access")
7576
framework.AdmitWorkspaceAccess(ctx, t, kubeClusterClient, orgPath, []string{"user-1"}, nil, true)
@@ -154,7 +155,7 @@ func TestMaximalPermissionPolicyAuthorizer(t *testing.T) {
154155
ctx, cancel := context.WithCancel(context.Background())
155156
t.Cleanup(cancel)
156157

157-
orgPath, _ := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
158+
orgPath, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
158159
rbacServiceProviderPath, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
159160
serviceProvider2Workspace, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)
160161
consumer1Path, _ := kcptesting.NewWorkspaceFixture(t, server, orgPath)

test/e2e/audit/audit_log_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131

3232
kcpkubernetesclientset "github.com/kcp-dev/client-go/kubernetes"
3333

34+
"github.com/kcp-dev/kcp/sdk/apis/core"
3435
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
3536
kcptestingserver "github.com/kcp-dev/kcp/sdk/testing/server"
3637
"github.com/kcp-dev/kcp/test/e2e/framework"
@@ -53,7 +54,7 @@ func TestAuditLogs(t *testing.T) {
5354
cfg := server.BaseConfig(t)
5455

5556
t.Log("Creating org workspace")
56-
wsPath, ws := framework.NewOrganizationFixture(t, server) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
57+
wsPath, ws := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithType(core.RootCluster.Path(), "organization"))
5758
workspaceKubeClient, err := kcpkubernetesclientset.NewForConfig(cfg)
5859
require.NoError(t, err)
5960

test/e2e/authorizer/authorizer_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import (
4747

4848
confighelpers "github.com/kcp-dev/kcp/config/helpers"
4949
"github.com/kcp-dev/kcp/pkg/authorization"
50+
"github.com/kcp-dev/kcp/sdk/apis/core"
5051
kcptesting "github.com/kcp-dev/kcp/sdk/testing"
5152
kcptestinghelpers "github.com/kcp-dev/kcp/sdk/testing/helpers"
5253
"github.com/kcp-dev/kcp/test/e2e/framework"
@@ -73,7 +74,7 @@ func TestAuthorizer(t *testing.T) {
7374
dynamicClusterClient, err := kcpdynamic.NewForConfig(cfg)
7475
require.NoError(t, err)
7576

76-
org1, _ := framework.NewOrganizationFixture(t, server, kcptesting.WithNamePrefix("org1")) //nolint:staticcheck // TODO: switch to NewWorkspaceFixture.
77+
org1, _ := kcptesting.NewWorkspaceFixture(t, server, core.RootCluster.Path(), kcptesting.WithNamePrefix("org1"), kcptesting.WithType(core.RootCluster.Path(), "organization"))
7778
org2, _ := framework.NewRootShardOrganizationFixture(t, server, kcptesting.PrivilegedWorkspaceOption(kcptesting.WithNamePrefix("org2")), framework.WithRequiredGroups("empty-group"))
7879

7980
kcptesting.NewWorkspaceFixture(t, server, org1, kcptesting.WithName("workspace1"))

0 commit comments

Comments
 (0)