Skip to content

Commit

Permalink
test/e2e/syncer: ensure pods cannot be created outside upsyncer
Browse files Browse the repository at this point in the history
  • Loading branch information
jmprusi committed Feb 6, 2023
1 parent c3fbb9c commit eb61c60
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/e2e/syncer/tunnels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,10 @@ func TestSyncerTunnel(t *testing.T) {
labels["state.workload.kcp.io/"+workloadv1alpha1.ToSyncTargetKey(synctargetWsName, syncTarget.Name)] = "Upsync"
pod.SetLabels(labels)

// Try to create the pod in KCP, it should fail because the user doesn't have the right permissions
_, err = userKcpClient.Cluster(userWsPath).CoreV1().Pods(upstreamNamespaceName).Create(ctx, &pod, metav1.CreateOptions{})
require.EqualError(t, err, "pods is forbidden: User \"user-1\" cannot create resource \"pods\" in API group \"\" in the namespace \"test-syncer\": access denied")

// Create a client that uses the upsyncer URL
upsyncerKCPClient, err := kcpkubernetesclientset.NewForConfig(syncerFixture.UpsyncerVirtualWorkspaceConfig)
require.NoError(t, err)
Expand Down

0 comments on commit eb61c60

Please sign in to comment.