Skip to content

Commit 7bfaadf

Browse files
jentingroboquat
authored andcommitted
workspace integration test: add PVC FF to TestPrebuildWorkspaceTaskSuccess
Signed-off-by: JenTing Hsiao <[email protected]>
1 parent 659da21 commit 7bfaadf

File tree

1 file changed

+40
-16
lines changed

1 file changed

+40
-16
lines changed

test/tests/components/ws-manager/prebuild_test.go

Lines changed: 40 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import (
1212
"sigs.k8s.io/e2e-framework/pkg/envconf"
1313
"sigs.k8s.io/e2e-framework/pkg/features"
1414

15+
csapi "github.com/gitpod-io/gitpod/content-service/api"
1516
"github.com/gitpod-io/gitpod/test/pkg/integration"
1617
wsmanapi "github.com/gitpod-io/gitpod/ws-manager/api"
1718
)
@@ -28,24 +29,47 @@ func TestPrebuildWorkspaceTaskSuccess(t *testing.T) {
2829
api.Done(t)
2930
})
3031

31-
_, stopWs, err := integration.LaunchWorkspaceDirectly(ctx, api, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
32-
req.Type = wsmanapi.WorkspaceType_PREBUILD
33-
req.Spec.Envvars = append(req.Spec.Envvars, &wsmanapi.EnvironmentVariable{
34-
Name: "GITPOD_TASKS",
35-
Value: `[{ "init": "echo \"some output\" > someFile; sleep 20; exit 0;" }]`,
32+
tests := []struct {
33+
Name string
34+
FF []wsmanapi.WorkspaceFeatureFlag
35+
}{
36+
{Name: "classic"},
37+
{Name: "pvc", FF: []wsmanapi.WorkspaceFeatureFlag{wsmanapi.WorkspaceFeatureFlag_PERSISTENT_VOLUME_CLAIM}},
38+
}
39+
for _, test := range tests {
40+
t.Run(test.Name, func(t *testing.T) {
41+
_, stopWs, err := integration.LaunchWorkspaceDirectly(ctx, api, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
42+
req.Type = wsmanapi.WorkspaceType_PREBUILD
43+
req.Spec.Envvars = append(req.Spec.Envvars, &wsmanapi.EnvironmentVariable{
44+
Name: "GITPOD_TASKS",
45+
Value: `[{ "init": "echo \"some output\" > someFile; sleep 20; exit 0;" }]`,
46+
})
47+
req.Spec.FeatureFlags = test.FF
48+
req.Spec.Initializer = &csapi.WorkspaceInitializer{
49+
Spec: &csapi.WorkspaceInitializer_Git{
50+
Git: &csapi.GitInitializer{
51+
RemoteUri: "https://github.com/gitpod-io/empty.git",
52+
TargetMode: csapi.CloneTargetMode_REMOTE_BRANCH,
53+
CloneTaget: "main",
54+
CheckoutLocation: "empty",
55+
Config: &csapi.GitConfig{},
56+
},
57+
},
58+
}
59+
req.Spec.WorkspaceLocation = "empty"
60+
return nil
61+
}))
62+
if err != nil {
63+
t.Fatalf("cannot launch a workspace: %q", err)
64+
}
65+
t.Cleanup(func() {
66+
err = stopWs(true)
67+
if err != nil {
68+
t.Errorf("cannot stop workspace: %q", err)
69+
}
70+
})
3671
})
37-
return nil
38-
}))
39-
if err != nil {
40-
t.Fatalf("cannot launch a workspace: %q", err)
4172
}
42-
t.Cleanup(func() {
43-
err = stopWs(true)
44-
if err != nil {
45-
t.Errorf("cannot stop workspace: %q", err)
46-
}
47-
})
48-
4973
return ctx
5074
}).
5175
Feature()

0 commit comments

Comments
 (0)