-
-
Notifications
You must be signed in to change notification settings - Fork 102
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Even though we don't have a big enough repo for testing the feature properly, it's important keep a test for it, just in case. Signed-off-by: Bruno Meneguele <[email protected]>
- Loading branch information
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -148,6 +148,36 @@ func Test_fork(t *testing.T) { | |
} | ||
} | ||
|
||
func Test_forkWait(t *testing.T) { | ||
repo := copyTestRepo(t) | ||
os.Remove(path.Join(repo, ".git/config")) | ||
|
||
cmd := exec.Command("git", "remote", "add", "origin", "[email protected]:zaquestion/fork_test") | ||
cmd.Dir = repo | ||
err := cmd.Run() | ||
if err != nil { | ||
t.Fatal(err) | ||
} | ||
|
||
// The default behavior is to "wait" for the fork and it's already being | ||
// tested in the Test_fork() test. Here we only test the --no-wait | ||
// option, which we can't effectively test because we don't have a big | ||
// enough repo. | ||
t.Run("fork_nowait", func(t *testing.T) { | ||
cmd = exec.Command(labBinaryPath, []string{"fork", "--no-wait"}...) | ||
cmd.Dir = repo | ||
b, err := cmd.CombinedOutput() | ||
out := string(b) | ||
if err != nil { | ||
t.Log(out) | ||
t.Fatal(err) | ||
} | ||
require.Contains(t, out, "From gitlab.com:lab-testing/fork_test") | ||
require.Contains(t, out, "new remote: lab-testing") | ||
cleanupFork(t, "fork_test") | ||
}) | ||
} | ||
|
||
func Test_determineForkRemote(t *testing.T) { | ||
tests := []struct { | ||
desc string | ||
|