Skip to content

Commit

Permalink
workspace integration test: add PVC FF to TestPrebuildWorkspaceTaskSu…
Browse files Browse the repository at this point in the history
…ccess

Signed-off-by: JenTing Hsiao <[email protected]>
  • Loading branch information
jenting authored and roboquat committed Sep 12, 2022
1 parent 659da21 commit 7bfaadf
Showing 1 changed file with 40 additions and 16 deletions.
56 changes: 40 additions & 16 deletions test/tests/components/ws-manager/prebuild_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"sigs.k8s.io/e2e-framework/pkg/envconf"
"sigs.k8s.io/e2e-framework/pkg/features"

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

_, stopWs, err := integration.LaunchWorkspaceDirectly(ctx, api, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
req.Type = wsmanapi.WorkspaceType_PREBUILD
req.Spec.Envvars = append(req.Spec.Envvars, &wsmanapi.EnvironmentVariable{
Name: "GITPOD_TASKS",
Value: `[{ "init": "echo \"some output\" > someFile; sleep 20; exit 0;" }]`,
tests := []struct {
Name string
FF []wsmanapi.WorkspaceFeatureFlag
}{
{Name: "classic"},
{Name: "pvc", FF: []wsmanapi.WorkspaceFeatureFlag{wsmanapi.WorkspaceFeatureFlag_PERSISTENT_VOLUME_CLAIM}},
}
for _, test := range tests {
t.Run(test.Name, func(t *testing.T) {
_, stopWs, err := integration.LaunchWorkspaceDirectly(ctx, api, integration.WithRequestModifier(func(req *wsmanapi.StartWorkspaceRequest) error {
req.Type = wsmanapi.WorkspaceType_PREBUILD
req.Spec.Envvars = append(req.Spec.Envvars, &wsmanapi.EnvironmentVariable{
Name: "GITPOD_TASKS",
Value: `[{ "init": "echo \"some output\" > someFile; sleep 20; exit 0;" }]`,
})
req.Spec.FeatureFlags = test.FF
req.Spec.Initializer = &csapi.WorkspaceInitializer{
Spec: &csapi.WorkspaceInitializer_Git{
Git: &csapi.GitInitializer{
RemoteUri: "https://github.com/gitpod-io/empty.git",
TargetMode: csapi.CloneTargetMode_REMOTE_BRANCH,
CloneTaget: "main",
CheckoutLocation: "empty",
Config: &csapi.GitConfig{},
},
},
}
req.Spec.WorkspaceLocation = "empty"
return nil
}))
if err != nil {
t.Fatalf("cannot launch a workspace: %q", err)
}
t.Cleanup(func() {
err = stopWs(true)
if err != nil {
t.Errorf("cannot stop workspace: %q", err)
}
})
})
return nil
}))
if err != nil {
t.Fatalf("cannot launch a workspace: %q", err)
}
t.Cleanup(func() {
err = stopWs(true)
if err != nil {
t.Errorf("cannot stop workspace: %q", err)
}
})

return ctx
}).
Feature()
Expand Down

0 comments on commit 7bfaadf

Please sign in to comment.