From fdc32be89ace5075991c6ddddbec24b803496528 Mon Sep 17 00:00:00 2001 From: Josef Kopriva Date: Tue, 10 Oct 2023 14:26:08 +0200 Subject: [PATCH] Renaming ProxyUser to UserProxy(linter issue) Signed-off-by: Josef Kopriva --- test/e2e/proxy/applications_test.go | 2 +- test/e2e/proxy/shared_workspaces_test.go | 2 +- test/e2e/proxy/space_lister_test.go | 4 ++-- .../proxy/{proxy_user.go => user_proxy.go} | 24 +++++++++---------- testsupport/proxy/watcher.go | 6 ++--- 5 files changed, 19 insertions(+), 19 deletions(-) rename testsupport/proxy/{proxy_user.go => user_proxy.go} (88%) diff --git a/test/e2e/proxy/applications_test.go b/test/e2e/proxy/applications_test.go index b58550741..fe531db32 100644 --- a/test/e2e/proxy/applications_test.go +++ b/test/e2e/proxy/applications_test.go @@ -50,7 +50,7 @@ func TestProxyFlow(t *testing.T) { t.Log("wait until the watcher is stopped") waitForWatcher.Wait() }() - users := CreateProxyUsersForTest(t, awaitilities) + users := CreateUsersProxyForTest(t, awaitilities) for index, user := range users { t.Run(user.Username, func(t *testing.T) { // Start a new websocket watcher diff --git a/test/e2e/proxy/shared_workspaces_test.go b/test/e2e/proxy/shared_workspaces_test.go index d6f58d835..44447b659 100644 --- a/test/e2e/proxy/shared_workspaces_test.go +++ b/test/e2e/proxy/shared_workspaces_test.go @@ -30,7 +30,7 @@ func TestSharedWorkspaces(t *testing.T) { waitForWatcher.Wait() }() - users := CreateProxyUsersForTest(t, awaitilities) + users := CreateUsersProxyForTest(t, awaitilities) // if there is an identity & user resources already present, but don't contain "owner" label, then they shouldn't be deleted preexistingUser, preexistingIdentity := CreatePreexistingUserAndIdentity(t, *users[0]) diff --git a/test/e2e/proxy/space_lister_test.go b/test/e2e/proxy/space_lister_test.go index 55cd848bb..5f198c9ec 100644 --- a/test/e2e/proxy/space_lister_test.go +++ b/test/e2e/proxy/space_lister_test.go @@ -27,7 +27,7 @@ func TestSpaceLister(t *testing.T) { t.Logf("Proxy URL: %s", hostAwait.APIProxyURL) - users := map[string]*ProxyUser{ + users := map[string]*UserProxy{ "car": { ExpectedMemberCluster: memberAwait, Username: "car", @@ -201,7 +201,7 @@ func TestSpaceLister(t *testing.T) { }) } -func expectedWorkspaceFor(t *testing.T, hostAwait *wait.HostAwaitility, user *ProxyUser, additionalWSOptions ...commonproxy.WorkspaceOption) toolchainv1alpha1.Workspace { +func expectedWorkspaceFor(t *testing.T, hostAwait *wait.HostAwaitility, user *UserProxy, additionalWSOptions ...commonproxy.WorkspaceOption) toolchainv1alpha1.Workspace { space, err := hostAwait.WaitForSpace(t, user.CompliantUsername, wait.UntilSpaceHasAnyTargetClusterSet(), wait.UntilSpaceHasAnyTierNameSet()) require.NoError(t, err) diff --git a/testsupport/proxy/proxy_user.go b/testsupport/proxy/user_proxy.go similarity index 88% rename from testsupport/proxy/proxy_user.go rename to testsupport/proxy/user_proxy.go index eed028de7..72825df6c 100644 --- a/testsupport/proxy/proxy_user.go +++ b/testsupport/proxy/user_proxy.go @@ -23,7 +23,7 @@ import ( kubewait "k8s.io/apimachinery/pkg/util/wait" ) -type ProxyUser struct { +type UserProxy struct { ExpectedMemberCluster *wait.MemberAwaitility Username string Token string @@ -32,7 +32,7 @@ type ProxyUser struct { CompliantUsername string } -func (u *ProxyUser) ShareSpaceWith(t *testing.T, hostAwait *wait.HostAwaitility, guestUser *ProxyUser) { +func (u *UserProxy) ShareSpaceWith(t *testing.T, hostAwait *wait.HostAwaitility, guestUser *UserProxy) { // share primaryUser space with guestUser guestUserMur, err := hostAwait.GetMasterUserRecord(guestUser.CompliantUsername) require.NoError(t, err) @@ -41,7 +41,7 @@ func (u *ProxyUser) ShareSpaceWith(t *testing.T, hostAwait *wait.HostAwaitility, spacebinding.CreateSpaceBinding(t, hostAwait, guestUserMur, primaryUserSpace, "admin") // creating a spacebinding gives guestUser access to primaryUser's space } -func (u *ProxyUser) ListWorkspaces(t *testing.T, hostAwait *wait.HostAwaitility) []toolchainv1alpha1.Workspace { +func (u *UserProxy) ListWorkspaces(t *testing.T, hostAwait *wait.HostAwaitility) []toolchainv1alpha1.Workspace { proxyCl := u.CreateProxyClient(t, hostAwait) workspaces := &toolchainv1alpha1.WorkspaceList{} @@ -50,13 +50,13 @@ func (u *ProxyUser) ListWorkspaces(t *testing.T, hostAwait *wait.HostAwaitility) return workspaces.Items } -func (u *ProxyUser) CreateProxyClient(t *testing.T, hostAwait *wait.HostAwaitility) client.Client { +func (u *UserProxy) CreateProxyClient(t *testing.T, hostAwait *wait.HostAwaitility) client.Client { proxyCl, err := hostAwait.CreateAPIProxyClient(t, u.Token, hostAwait.APIProxyURL) require.NoError(t, err) return proxyCl } -func (u *ProxyUser) GetWorkspace(t *testing.T, hostAwait *wait.HostAwaitility, workspaceName string) (*toolchainv1alpha1.Workspace, error) { +func (u *UserProxy) GetWorkspace(t *testing.T, hostAwait *wait.HostAwaitility, workspaceName string) (*toolchainv1alpha1.Workspace, error) { proxyCl := u.CreateProxyClient(t, hostAwait) workspace := &toolchainv1alpha1.Workspace{} @@ -71,7 +71,7 @@ func (u *ProxyUser) GetWorkspace(t *testing.T, hostAwait *wait.HostAwaitility, w return workspace, cause } -func (u *ProxyUser) GetApplication(t *testing.T, proxyClient client.Client, applicationName string) *appstudiov1.Application { +func (u *UserProxy) GetApplication(t *testing.T, proxyClient client.Client, applicationName string) *appstudiov1.Application { app := &appstudiov1.Application{} namespacedName := types.NamespacedName{Namespace: TenantNsName(u.CompliantUsername), Name: applicationName} // Get Application @@ -81,7 +81,7 @@ func (u *ProxyUser) GetApplication(t *testing.T, proxyClient client.Client, appl return app } -func (u *ProxyUser) GetApplicationWithoutProxy(t *testing.T, applicationName string) *appstudiov1.Application { +func (u *UserProxy) GetApplicationWithoutProxy(t *testing.T, applicationName string) *appstudiov1.Application { namespacedName := types.NamespacedName{Namespace: TenantNsName(u.CompliantUsername), Name: applicationName} app := &appstudiov1.Application{} err := u.ExpectedMemberCluster.Client.Get(context.TODO(), namespacedName, app) @@ -90,12 +90,12 @@ func (u *ProxyUser) GetApplicationWithoutProxy(t *testing.T, applicationName str return app } -func (u *ProxyUser) GetApplicationName(i int) string { +func (u *UserProxy) GetApplicationName(i int) string { return fmt.Sprintf("%s-test-app-%d", u.CompliantUsername, i) } -func CreateProxyUsersForTest(t *testing.T, awaitilities wait.Awaitilities) []*ProxyUser { - users := []*ProxyUser{ +func CreateUsersProxyForTest(t *testing.T, awaitilities wait.Awaitilities) []*UserProxy { + users := []*UserProxy{ { ExpectedMemberCluster: awaitilities.Member1(), Username: "proxymember1", @@ -119,7 +119,7 @@ func CreateProxyUsersForTest(t *testing.T, awaitilities wait.Awaitilities) []*Pr return users } -func CreateAppStudioUser(t *testing.T, awaitilities wait.Awaitilities, user *ProxyUser) { +func CreateAppStudioUser(t *testing.T, awaitilities wait.Awaitilities, user *UserProxy) { // Create and approve signup req := testsupport.NewSignupRequest(awaitilities). Username(user.Username). @@ -137,7 +137,7 @@ func CreateAppStudioUser(t *testing.T, awaitilities wait.Awaitilities, user *Pro require.NoError(t, err) } -func CreatePreexistingUserAndIdentity(t *testing.T, user ProxyUser) (*userv1.User, *userv1.Identity) { +func CreatePreexistingUserAndIdentity(t *testing.T, user UserProxy) (*userv1.User, *userv1.Identity) { preexistingUser := &userv1.User{ ObjectMeta: metav1.ObjectMeta{ Name: user.Username, diff --git a/testsupport/proxy/watcher.go b/testsupport/proxy/watcher.go index e802f3994..28379a051 100644 --- a/testsupport/proxy/watcher.go +++ b/testsupport/proxy/watcher.go @@ -35,7 +35,7 @@ type WsWatcher struct { done chan interface{} interrupt chan os.Signal t *testing.T - user ProxyUser + user UserProxy namespace string connection *websocket.Conn proxyBaseURL string @@ -67,7 +67,7 @@ func RunWatcher(t *testing.T, awaitilities wait.Awaitilities) *sync.WaitGroup { // ====================================================== t.Log("provisioning the watcher") - watchUser := &ProxyUser{ + watchUser := &UserProxy{ ExpectedMemberCluster: awaitilities.Member1(), Username: "watcher", IdentityID: uuid.Must(uuid.NewV4()), @@ -113,7 +113,7 @@ func RunWatcher(t *testing.T, awaitilities wait.Awaitilities) *sync.WaitGroup { return &waitForWatcher } -func NewWsWatcher(t *testing.T, user ProxyUser, namespace, proxyURL string) *WsWatcher { +func NewWsWatcher(t *testing.T, user UserProxy, namespace, proxyURL string) *WsWatcher { _, err := url.Parse(proxyURL) require.NoError(t, err) return &WsWatcher{