Skip to content

Commit

Permalink
Renaming ProxyUser to UserProxy(linter issue)
Browse files Browse the repository at this point in the history
Signed-off-by: Josef Kopriva <[email protected]>
  • Loading branch information
jkopriva committed Oct 10, 2023
1 parent 88bb103 commit fdc32be
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion test/e2e/proxy/applications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/proxy/shared_workspaces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/proxy/space_lister_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)

Expand Down
24 changes: 12 additions & 12 deletions testsupport/proxy/proxy_user.go → testsupport/proxy/user_proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand All @@ -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{}
Expand All @@ -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{}
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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",
Expand All @@ -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).
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions testsupport/proxy/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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{
Expand Down

0 comments on commit fdc32be

Please sign in to comment.