Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
gitpod-io
GitHub Repository: gitpod-io/gitpod
Path: blob/main/test/tests/ide/jetbrains/base_in_workspace_test.go
2500 views
1
// Copyright (c) 2024 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 ide
6
7
import (
8
"context"
9
"fmt"
10
"io"
11
"os"
12
"os/exec"
13
"testing"
14
)
15
16
type testLogWriter struct {
17
t *testing.T
18
}
19
20
var _ io.Writer = &testLogWriter{}
21
22
func (t *testLogWriter) Write(p []byte) (n int, err error) {
23
t.t.Log(string(p))
24
return len(p), nil
25
}
26
27
const localDebug = false
28
29
func testWithoutGithubAction(ctx context.Context, gatewayLink, gitpodAccessToken, secretEndpoint string, useLatest bool) {
30
scriptName := "dev/jetbrains-test:test-stable"
31
if useLatest {
32
scriptName = "dev/jetbrains-test:test-latest"
33
}
34
35
if localDebug {
36
fmt.Printf("Exec command below to run UI tests:\n\nexport DISPLAY=:0\nexport GATEWAY_LINK=\"%s\"\nexport GITPOD_TEST_ACCESSTOKEN=\"%s\"\nexport WS_ENDPOINT=%s\nleeway run %s -Dversion=integration-test -DpublishToJBMarketplace=false", gatewayLink, gitpodAccessToken, secretEndpoint, scriptName)
37
os.Exit(1)
38
}
39
cmdEnv := os.Environ()
40
cmdEnv = append(cmdEnv, "GATEWAY_LINK="+gatewayLink)
41
cmdEnv = append(cmdEnv, "GITPOD_TEST_ACCESSTOKEN="+gitpodAccessToken)
42
cmdEnv = append(cmdEnv, "WS_ENDPOINT="+secretEndpoint)
43
cmd := exec.CommandContext(ctx, "leeway", "run", scriptName, "-Dversion=integration-test", "-DpublishToJBMarketplace=false")
44
cmd.Env = cmdEnv
45
// writer := &testLogWriter{t: t}
46
cmd.Stdout = os.Stdout
47
cmd.Stderr = os.Stdout
48
cmd.Run()
49
}
50
51