-
Notifications
You must be signed in to change notification settings - Fork 2
/
workspace_given.go
50 lines (39 loc) · 1.41 KB
/
workspace_given.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package workspace
import (
"context"
tcontext "github.com/konflux-workspaces/workspaces/e2e/pkg/context"
"github.com/konflux-workspaces/workspaces/e2e/step/user"
workspacesv1alpha1 "github.com/konflux-workspaces/workspaces/operator/api/v1alpha1"
)
func givenDefaultWorkspaceIsCreatedForThem(ctx context.Context) (context.Context, error) {
return defaultWorkspaceIsCreatedForThem(ctx)
}
func givenAPrivateWorkspaceExists(ctx context.Context) (context.Context, error) {
cli := tcontext.RetrieveHostClient(ctx)
ns := tcontext.RetrieveKubespaceNamespace(ctx)
u, w, err := createUserSignupAndWaitForWorkspace(ctx, cli, ns, user.DefaultUserName)
if err != nil {
return ctx, err
}
ctx = tcontext.InjectUser(ctx, *u)
ctx = tcontext.InjectWorkspace(ctx, *w)
return ctx, nil
}
func givenACommunityWorkspaceExists(ctx context.Context) (context.Context, error) {
cli := tcontext.RetrieveHostClient(ctx)
ns := tcontext.RetrieveKubespaceNamespace(ctx)
u, err := user.OnboardUser(ctx, cli, ns, user.DefaultUserName)
if err != nil {
return ctx, err
}
w, err := createWorkspace(ctx, cli, ns, "new-community", u.Status.CompliantUsername, workspacesv1alpha1.InternalWorkspaceVisibilityCommunity)
if err != nil {
return ctx, err
}
if err := workspaceIsReadableForEveryone(ctx, cli, ns, w.Name); err != nil {
return ctx, err
}
ctx = tcontext.InjectUser(ctx, *u)
ctx = tcontext.InjectWorkspace(ctx, *w)
return ctx, nil
}