Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Workspace testing does not guarantee branch name creation #12801

Merged
merged 2 commits into from
Sep 9, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 7 additions & 9 deletions test/tests/workspace/contexts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ package workspace

import (
"context"
"fmt"
"os"
"testing"
"time"
Expand All @@ -32,8 +31,8 @@ func TestGitHubContexts(t *testing.T) {
tests := []ContextTest{
{
Name: "open repository",
ContextURL: "github.com/gitpod-io/gitpod",
WorkspaceRoot: "/workspace/gitpod",
ContextURL: "github.com/gitpod-io/template-golang-cli",
WorkspaceRoot: "/workspace/template-golang-cli",
ExpectedBranch: "main",
},
{
Expand All @@ -43,12 +42,10 @@ func TestGitHubContexts(t *testing.T) {
ExpectedBranch: "integration-test-1",
},
{
// Branch name decisions are not tested in the workspace as it is the server side logic
Name: "open issue",
ContextURL: "github.com/gitpod-io/gitpod-test-repo/issues/88",
WorkspaceRoot: "/workspace/gitpod-test-repo",
ExpectedBranchFunc: func(username string) string {
return fmt.Sprintf("%s/integration-88", username)
},
},
{
Name: "open tag",
Expand Down Expand Up @@ -94,9 +91,6 @@ func TestGitLabContexts(t *testing.T) {
Name: "open issue",
ContextURL: "gitlab.com/AlexTugarev/gp-test/issues/1",
WorkspaceRoot: "/workspace/gp-test",
ExpectedBranchFunc: func(username string) string {
return fmt.Sprintf("%s/write-a-readme-1", username)
},
},
{
Name: "open tag",
Expand Down Expand Up @@ -164,6 +158,10 @@ func runContextTests(t *testing.T, tests []ContextTest) {
defer rsa.Close()
integration.DeferCloser(t, closer)

if test.ExpectedBranch == "" && test.ExpectedBranchFunc == nil {
return
}

// get actual from workspace
git := common.Git(rsa)
err = git.ConfigSafeDirectory()
Expand Down