Skip to content

Commit a801eea

Browse files
committed
[tests] Add TestGitLabContexts
1 parent c7bf50b commit a801eea

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

test/tests/workspace/contexts_test.go

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ func TestGitHubContexts(t *testing.T) {
2929
WorkspaceRoot: "/workspace/gitpod",
3030
ExpectedBranch: "main",
3131
},
32+
{
33+
Name: "open branch",
34+
ContextURL: "github.com/gitpod-io/gitpod-test-repo/integration-test-1",
35+
WorkspaceRoot: "/workspace/gitpod-test-repo",
36+
ExpectedBranch: "integration-test-1",
37+
},
3238
{
3339
Name: "open issue",
3440
ContextURL: "github.com/gitpod-io/gitpod-test-repo/issues/88",
@@ -45,6 +51,36 @@ func TestGitHubContexts(t *testing.T) {
4551
runContextTests(t, tests)
4652
}
4753

54+
func TestGitLabContexts(t *testing.T) {
55+
tests := []ContextTest{
56+
{
57+
Name: "open repository",
58+
ContextURL: "gitlab.com/AlexTugarev/gp-test",
59+
WorkspaceRoot: "/workspace/gp-test",
60+
ExpectedBranch: "main",
61+
},
62+
{
63+
Name: "open branch",
64+
ContextURL: "gitlab.com/AlexTugarev/gp-test/tree/wip",
65+
WorkspaceRoot: "/workspace/gp-test",
66+
ExpectedBranch: "wip",
67+
},
68+
{
69+
Name: "open issue",
70+
ContextURL: "gitlab.com/AlexTugarev/gp-test/issues/1",
71+
WorkspaceRoot: "/workspace/gp-test",
72+
ExpectedBranch: "main",
73+
},
74+
{
75+
Name: "open tag",
76+
ContextURL: "gitlab.com/AlexTugarev/gp-test/merge_requests/2",
77+
WorkspaceRoot: "/workspace/gp-test",
78+
ExpectedBranch: "HEAD",
79+
},
80+
}
81+
runContextTests(t, tests)
82+
}
83+
4884
func runContextTests(t *testing.T, tests []ContextTest) {
4985
for _, test := range tests {
5086
t.Run(test.ContextURL, func(t *testing.T) {

0 commit comments

Comments
 (0)