Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/test/tests/smoke-test/smoke_test.go
2496 views
1
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.
2
// Licensed under the GNU Affero General Public License (AGPL).
3
// See License.AGPL.txt in the project root for license information.
4
5
package smoketest
6
7
import (
8
"context"
9
"os"
10
"testing"
11
"time"
12
13
"sigs.k8s.io/e2e-framework/pkg/envconf"
14
"sigs.k8s.io/e2e-framework/pkg/features"
15
16
"github.com/gitpod-io/gitpod/test/pkg/integration"
17
)
18
19
func TestStartWorkspaceWithImageBuild(t *testing.T) {
20
userToken, _ := os.LookupEnv("USER_TOKEN")
21
integration.SkipWithoutUsername(t, username)
22
integration.SkipWithoutUserToken(t, userToken)
23
24
f := features.New("Start regular workspace").
25
Assess("it can start a regular workspace with image build", func(testCtx context.Context, t *testing.T, cfg *envconf.Config) context.Context {
26
ctx, cancel := context.WithTimeout(testCtx, 5*time.Minute)
27
defer cancel()
28
29
api := integration.NewComponentAPI(ctx, cfg.Namespace(), kubeconfig, cfg.Client())
30
t.Cleanup(func() {
31
api.Done(t)
32
})
33
34
_, err := api.CreateUser(username, userToken)
35
if err != nil {
36
t.Fatal(err)
37
}
38
39
_, stopWs, err := integration.LaunchWorkspaceFromContextURL(t, ctx, "imagebuild/https://github.com/gitpod-integration-test/example", username, api)
40
if err != nil {
41
t.Fatal(err)
42
}
43
defer func() {
44
sctx, scancel := context.WithTimeout(context.Background(), 5*time.Minute)
45
defer scancel()
46
47
sapi := integration.NewComponentAPI(sctx, cfg.Namespace(), kubeconfig, cfg.Client())
48
defer sapi.Done(t)
49
50
_, _ = stopWs(true, sapi)
51
}()
52
return testCtx
53
}).
54
Feature()
55
testEnv.Test(t, f)
56
}
57
58