diff --git a/test/tests/workspace/common/cgroup.go b/test/pkg/integration/common/cgroup.go similarity index 100% rename from test/tests/workspace/common/cgroup.go rename to test/pkg/integration/common/cgroup.go diff --git a/test/tests/ide/jetbrains/gateway_test.go b/test/tests/ide/jetbrains/gateway_test.go index e20b7deeee31e1..f41da9d327abfc 100644 --- a/test/tests/ide/jetbrains/gateway_test.go +++ b/test/tests/ide/jetbrains/gateway_test.go @@ -80,7 +80,8 @@ func TestJetBrainsGatewayWorkspace(t *testing.T) { integration.SkipWithoutUserToken(t, userToken) f := features.New("Start a workspace and let JetBrains Gateway connect"). - WithLabel("component", "IDE"). + WithLabel("team", "IDE"). + WithLabel("component", "jetbrains"). Assess("it can start a workspace and let JetBrains Gateway connect", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Minute) defer cancel() diff --git a/test/tests/ide/vscode/python_ws_test.go b/test/tests/ide/vscode/python_ws_test.go index aa2a43d47da51a..d0131d0c6b1b49 100644 --- a/test/tests/ide/vscode/python_ws_test.go +++ b/test/tests/ide/vscode/python_ws_test.go @@ -46,7 +46,8 @@ func TestPythonExtWorkspace(t *testing.T) { integration.SkipWithoutUserToken(t, userToken) f := features.New("PythonExtensionWorkspace"). - WithLabel("component", "server"). + WithLabel("team", "IDE"). + WithLabel("component", "vscode"). Assess("it can run python extension in a workspace", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/workspace/cgroup_v2_test.go b/test/tests/workspace/cgroup_v2_test.go index 8f36e059b90bc8..f605c951be6396 100644 --- a/test/tests/workspace/cgroup_v2_test.go +++ b/test/tests/workspace/cgroup_v2_test.go @@ -18,13 +18,14 @@ import ( agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api" "github.com/gitpod-io/gitpod/test/pkg/integration" - "github.com/gitpod-io/gitpod/test/tests/workspace/common" + "github.com/gitpod-io/gitpod/test/pkg/integration/common" "github.com/google/go-cmp/cmp" ) func TestCgroupV2(t *testing.T) { f := features.New("cgroup v2"). - WithLabel("component", "workspace"). + WithLabel("team", "workspace"). + WithLabel("component", "runtime"). Assess("it should create a new cgroup when cgroup v2 is enabled", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/workspace/common/git-client.go b/test/tests/workspace/common/git-client.go deleted file mode 100644 index 993e27d4b4b38d..00000000000000 --- a/test/tests/workspace/common/git-client.go +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 2020 Gitpod GmbH. All rights reserved. -// Licensed under the GNU Affero General Public License (AGPL). -// See License-AGPL.txt in the project root for license information. - -package common - -import ( - "net/rpc" - "strings" - - "golang.org/x/xerrors" - - agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api" -) - -type GitClient struct { - *rpc.Client -} - -func Git(rsa *rpc.Client) GitClient { - return GitClient{rsa} -} - -func (g GitClient) GetBranch(workspaceRoot string) (string, error) { - var resp agent.ExecResponse - err := g.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ - Dir: workspaceRoot, - Command: "git", - Args: []string{"rev-parse", "--abbrev-ref", "HEAD"}, - }, &resp) - if err != nil { - return "", xerrors.Errorf("getBranch error: %w", err) - } - if resp.ExitCode != 0 { - return "", xerrors.Errorf("getBranch rc!=0: %d", resp.ExitCode) - } - return strings.Trim(resp.Stdout, " \t\n"), nil -} - -func (g GitClient) Add(dir string, files ...string) error { - args := []string{"add"} - if files == nil { - args = append(args, ".") - } else { - args = append(args, files...) - } - var resp agent.ExecResponse - err := g.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ - Dir: dir, - Command: "git", - Args: args, - }, &resp) - if err != nil { - return err - } - if resp.ExitCode != 0 { - return xerrors.Errorf("commit returned rc: %d", resp.ExitCode) - } - return nil -} - -func (g GitClient) Commit(dir string, message string, all bool) error { - args := []string{"commit", "-m", message} - if all { - args = append(args, "--all") - } - var resp agent.ExecResponse - err := g.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ - Dir: dir, - Command: "git", - Args: args, - }, &resp) - if err != nil { - return err - } - if resp.ExitCode != 0 { - return xerrors.Errorf("commit returned rc: %d", resp.ExitCode) - } - return nil -} - -func (g GitClient) Push(dir string, force bool, moreArgs ...string) error { - args := []string{"push"} - if moreArgs != nil { - args = append(args, moreArgs...) - } - if force { - args = append(args, "--force") - } - var resp agent.ExecResponse - err := g.Call("WorkspaceAgent.Exec", &agent.ExecRequest{ - Dir: dir, - Command: "git", - Args: args, - }, &resp) - if err != nil { - return err - } - if resp.ExitCode != 0 { - return xerrors.Errorf("commit returned rc: %d", resp.ExitCode) - } - return nil -} diff --git a/test/tests/components/content-service/content-service_test.go b/test/tests/workspace/content-service/content-service_test.go similarity index 96% rename from test/tests/components/content-service/content-service_test.go rename to test/tests/workspace/content-service/content-service_test.go index 98b13f9de16ade..ed9697758ba862 100644 --- a/test/tests/components/content-service/content-service_test.go +++ b/test/tests/workspace/content-service/content-service_test.go @@ -63,6 +63,7 @@ func TestUploadUrl(t *testing.T) { } f := features.New("UploadUrlRequest"). + WithLabel("team", "workspace"). WithLabel("component", "content-service"). Assess("it should run content-service tests", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) @@ -123,7 +124,8 @@ func TestDownloadUrl(t *testing.T) { } f := features.New("DownloadUrl"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). + WithLabel("component", "content-service"). Assess("it should pass download URL tests", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -169,7 +171,8 @@ func TestDownloadUrl(t *testing.T) { func TestUploadDownloadBlob(t *testing.T) { f := features.New("UploadDownloadBlob"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). + WithLabel("component", "content-service"). Assess("it should upload and download blob", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -218,7 +221,8 @@ func TestUploadDownloadBlob(t *testing.T) { func TestUploadDownloadBlobViaServer(t *testing.T) { integration.SkipWithoutUsername(t, username) f := features.New("UploadDownloadBlobViaServer"). - WithLabel("component", "content-server"). + WithLabel("team", "workspace"). + WithLabel("component", "content-service"). Assess("it should uploads a blob via server → content-server and downloads it afterwards", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/components/content-service/main_test.go b/test/tests/workspace/content-service/main_test.go similarity index 100% rename from test/tests/components/content-service/main_test.go rename to test/tests/workspace/content-service/main_test.go diff --git a/test/tests/workspace/contexts_test.go b/test/tests/workspace/contexts_test.go index 48d8e0c84e2764..1f09f8bf3c0209 100644 --- a/test/tests/workspace/contexts_test.go +++ b/test/tests/workspace/contexts_test.go @@ -14,7 +14,7 @@ import ( "sigs.k8s.io/e2e-framework/pkg/features" "github.com/gitpod-io/gitpod/test/pkg/integration" - "github.com/gitpod-io/gitpod/test/tests/workspace/common" + "github.com/gitpod-io/gitpod/test/pkg/integration/common" ) type ContextTest struct { @@ -96,7 +96,7 @@ func TestGitLabContexts(t *testing.T) { func runContextTests(t *testing.T, tests []ContextTest) { integration.SkipWithoutUsername(t, username) f := features.New("context"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). Assess("should run context tests", func(ctx context.Context, t *testing.T, cfg *envconf.Config) context.Context { for _, test := range tests { t.Run(test.ContextURL, func(t *testing.T) { diff --git a/test/tests/workspace/docker_test.go b/test/tests/workspace/docker_test.go index 3cc4fa494bb2d2..fe8217aee8f9f9 100644 --- a/test/tests/workspace/docker_test.go +++ b/test/tests/workspace/docker_test.go @@ -18,7 +18,8 @@ import ( func TestRunDocker(t *testing.T) { f := features.New("docker"). - WithLabel("component", "workspace"). + WithLabel("team", "workspace"). + WithLabel("component", "runtime"). Assess("it should start a container", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/workspace/example_test.go b/test/tests/workspace/example_test.go index f8c6bed1ea3694..cc89a6ebc3ac5c 100644 --- a/test/tests/workspace/example_test.go +++ b/test/tests/workspace/example_test.go @@ -19,7 +19,7 @@ import ( func TestWorkspaceInstrumentation(t *testing.T) { integration.SkipWithoutUsername(t, username) f := features.New("instrumentation"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). Assess("it can instrument a workspace", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -62,7 +62,7 @@ func TestWorkspaceInstrumentation(t *testing.T) { func TestLaunchWorkspaceDirectly(t *testing.T) { f := features.New("workspace"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). Assess("it can run workspace tasks", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/workspace/git_test.go b/test/tests/workspace/git_test.go index c18491fa2a59b4..4f0bb8b731ac0d 100644 --- a/test/tests/workspace/git_test.go +++ b/test/tests/workspace/git_test.go @@ -15,7 +15,7 @@ import ( agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api" "github.com/gitpod-io/gitpod/test/pkg/integration" - "github.com/gitpod-io/gitpod/test/tests/workspace/common" + "github.com/gitpod-io/gitpod/test/pkg/integration/common" ) // @@ -98,7 +98,8 @@ func TestGitActions(t *testing.T) { } f := features.New("GitActions"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). + WithLabel("component", "git"). Assess("it can run git actions", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/components/image-builder/builder_test.go b/test/tests/workspace/image-builder/builder_test.go similarity index 98% rename from test/tests/components/image-builder/builder_test.go rename to test/tests/workspace/image-builder/builder_test.go index 6066e6a0f9201e..46fd62caae38a4 100644 --- a/test/tests/components/image-builder/builder_test.go +++ b/test/tests/workspace/image-builder/builder_test.go @@ -23,6 +23,7 @@ import ( func TestBaseImageBuild(t *testing.T) { f := features.New("database"). + WithLabel("team", "workspace"). WithLabel("component", "image-builder"). Assess("it should build a base image", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) @@ -99,6 +100,7 @@ func TestBaseImageBuild(t *testing.T) { func TestParallelBaseImageBuild(t *testing.T) { f := features.New("image-builder"). + WithLabel("team", "workspace"). WithLabel("component", "image-builder"). Assess("it should allow parallel build of images", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) diff --git a/test/tests/components/image-builder/main_test.go b/test/tests/workspace/image-builder/main_test.go similarity index 100% rename from test/tests/components/image-builder/main_test.go rename to test/tests/workspace/image-builder/main_test.go diff --git a/test/tests/components/image-builder/test.Dockerfile b/test/tests/workspace/image-builder/test.Dockerfile similarity index 100% rename from test/tests/components/image-builder/test.Dockerfile rename to test/tests/workspace/image-builder/test.Dockerfile diff --git a/test/tests/workspace/k3s_test.go b/test/tests/workspace/k3s_test.go index db83e8dfdd1ebe..6c6c4cf0c65c94 100644 --- a/test/tests/workspace/k3s_test.go +++ b/test/tests/workspace/k3s_test.go @@ -14,12 +14,13 @@ import ( agent "github.com/gitpod-io/gitpod/test/pkg/agent/workspace/api" "github.com/gitpod-io/gitpod/test/pkg/integration" - "github.com/gitpod-io/gitpod/test/tests/workspace/common" + "github.com/gitpod-io/gitpod/test/pkg/integration/common" ) func TestK3s(t *testing.T) { f := features.New("k3s"). - WithLabel("component", "workspace"). + WithLabel("team", "workspace"). + WithLabel("component", "k3s"). Assess("it should start a k3s when cgroup v2 enable", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/workspace/mount_proc_test.go b/test/tests/workspace/mount_proc_test.go index 7efdfba83d98ab..64ec55ba1eb60a 100644 --- a/test/tests/workspace/mount_proc_test.go +++ b/test/tests/workspace/mount_proc_test.go @@ -46,7 +46,8 @@ func loadMountProc(t *testing.T, rsa *rpc.Client) { func TestMountProc(t *testing.T) { f := features.New("proc mount"). - WithLabel("component", "workspace"). + WithLabel("team", "workspace"). + WithLabel("component", "runtime"). Assess("load test proc mount", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/components/ws-daemon/main_test.go b/test/tests/workspace/ws-daemon/main_test.go similarity index 100% rename from test/tests/components/ws-daemon/main_test.go rename to test/tests/workspace/ws-daemon/main_test.go diff --git a/test/tests/components/ws-daemon/storage_test.go b/test/tests/workspace/ws-daemon/storage_test.go similarity index 97% rename from test/tests/components/ws-daemon/storage_test.go rename to test/tests/workspace/ws-daemon/storage_test.go index f741e6569ad77f..3e5a5a0cf0b5db 100644 --- a/test/tests/components/ws-daemon/storage_test.go +++ b/test/tests/workspace/ws-daemon/storage_test.go @@ -19,6 +19,7 @@ import ( func TestCreateBucket(t *testing.T) { f := features.New("DaemonAgent.CreateBucket"). + WithLabel("team", "workspace"). WithLabel("component", "ws-daemon"). Assess("it should create a bucket", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) diff --git a/test/tests/components/ws-manager/content_test.go b/test/tests/workspace/ws-manager/content_test.go similarity index 97% rename from test/tests/components/ws-manager/content_test.go rename to test/tests/workspace/ws-manager/content_test.go index cece09f5bdbd7c..878283ca85024d 100644 --- a/test/tests/components/ws-manager/content_test.go +++ b/test/tests/workspace/ws-manager/content_test.go @@ -22,6 +22,8 @@ import ( // TestBackup tests a basic start/modify/restart cycle func TestBackup(t *testing.T) { f := features.New("backup"). + WithLabel("team", "workspace"). + WithLabel("component", "ws-manager"). Assess("it should start a workspace, create a file and successfully create a backup", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() @@ -136,7 +138,8 @@ func TestBackup(t *testing.T) { // TestMissingBackup ensures workspaces fail if they should have a backup but don't have one func TestMissingBackup(t *testing.T) { f := features.New("CreateWorkspace"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). + WithLabel("component", "ws-manager"). Assess("it can run workspace tasks", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/components/ws-manager/main_test.go b/test/tests/workspace/ws-manager/main_test.go similarity index 100% rename from test/tests/components/ws-manager/main_test.go rename to test/tests/workspace/ws-manager/main_test.go diff --git a/test/tests/components/ws-manager/prebuild_test.go b/test/tests/workspace/ws-manager/prebuild_test.go similarity index 96% rename from test/tests/components/ws-manager/prebuild_test.go rename to test/tests/workspace/ws-manager/prebuild_test.go index a997e7c74ea0e0..95af645c831dd9 100644 --- a/test/tests/components/ws-manager/prebuild_test.go +++ b/test/tests/workspace/ws-manager/prebuild_test.go @@ -18,6 +18,7 @@ import ( func TestPrebuildWorkspaceTaskSuccess(t *testing.T) { f := features.New("prebuild"). + WithLabel("team", "workspace"). WithLabel("component", "ws-manager"). Assess("it should create a prebuild and succeed the defined tasks", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) @@ -55,7 +56,8 @@ func TestPrebuildWorkspaceTaskFail(t *testing.T) { t.Skip("status never returns HeadlessTaskFailed (exit 1)") f := features.New("prebuild"). - WithLabel("component", "server"). + WithLabel("team", "workspace"). + WithLabel("component", "ws-manager"). Assess("it should create a prebuild and fail after running the defined tasks", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute) defer cancel() diff --git a/test/tests/components/ws-manager/tasks_test.go b/test/tests/workspace/ws-manager/tasks_test.go similarity index 99% rename from test/tests/components/ws-manager/tasks_test.go rename to test/tests/workspace/ws-manager/tasks_test.go index f150127d6dc534..cca34804a566c3 100644 --- a/test/tests/components/ws-manager/tasks_test.go +++ b/test/tests/workspace/ws-manager/tasks_test.go @@ -46,6 +46,7 @@ func TestRegularWorkspaceTasks(t *testing.T) { } f := features.New("ws-manager"). + WithLabel("team", "workspace"). WithLabel("component", "ws-manager"). WithLabel("type", "tasks"). Assess("it can run workspace tasks", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { diff --git a/test/tests/components/ws-manager/wsmanager_test.go b/test/tests/workspace/ws-manager/wsmanager_test.go similarity index 97% rename from test/tests/components/ws-manager/wsmanager_test.go rename to test/tests/workspace/ws-manager/wsmanager_test.go index b14d7d5a48c1b0..8d52546b6fea23 100644 --- a/test/tests/components/ws-manager/wsmanager_test.go +++ b/test/tests/workspace/ws-manager/wsmanager_test.go @@ -18,6 +18,7 @@ import ( func TestGetWorkspaces(t *testing.T) { f := features.New("workspaces"). + WithLabel("team", "workspace"). WithLabel("component", "ws-manager"). Assess("it should get workspaces", func(_ context.Context, t *testing.T, cfg *envconf.Config) context.Context { ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)