diff --git a/cmd/mr_test.go b/cmd/mr_test.go index 1a4707e0..95f92d50 100644 --- a/cmd/mr_test.go +++ b/cmd/mr_test.go @@ -29,7 +29,13 @@ func closeMR(t *testing.T, targetRepo string, cmdDir string, mrID string) { } func cleanupMR(t *testing.T, targetRepo string, cmdDir string, MRtitle string) { - openMRcmd := exec.Command(labBinaryPath, "mr", "list", targetRepo, MRtitle) + var openMRcmd *exec.Cmd + + if MRtitle == "" { + openMRcmd = exec.Command(labBinaryPath, "mr", "list", targetRepo) + } else { + openMRcmd = exec.Command(labBinaryPath, "mr", "list", targetRepo, MRtitle) + } openMRcmd.Dir = cmdDir openMRout, err := openMRcmd.CombinedOutput() if err != nil { @@ -61,7 +67,7 @@ func Test_mrCmd(t *testing.T) { repo := copyTestRepo(t) var mrID string t.Run("prepare", func(t *testing.T) { - cleanupMR(t, "lab-testing", repo, "mr title") + cleanupMR(t, "lab-testing", repo, "") }) t.Run("create", func(t *testing.T) { git := exec.Command("git", "checkout", "mrtest") @@ -124,8 +130,7 @@ func Test_mrCmd_MR_description_and_options(t *testing.T) { commentID string ) t.Run("prepare", func(t *testing.T) { - cleanupMR(t, "lab-testing", repo, "Fancy Description") - cleanupMR(t, "lab-testing", repo, "Updated Description") + cleanupMR(t, "lab-testing", repo, "") }) t.Run("create MR from file", func(t *testing.T) { git := exec.Command("git", "checkout", "mrtest") @@ -220,7 +225,7 @@ func Test_mrCmd_DifferingUpstreamBranchName(t *testing.T) { repo := copyTestRepo(t) var mrID string t.Run("prepare", func(t *testing.T) { - cleanupMR(t, "lab-testing", repo, "mr title") + cleanupMR(t, "lab-testing", repo, "") }) t.Run("create", func(t *testing.T) { git := exec.Command("git", "checkout", "-b", "local/mrtest", "origin/mrtest") @@ -256,7 +261,7 @@ func Test_mrCmd_Draft(t *testing.T) { repo := copyTestRepo(t) var mrID string t.Run("prepare", func(t *testing.T) { - cleanupMR(t, "lab-testing", repo, "Test draft") + cleanupMR(t, "lab-testing", repo, "") }) t.Run("create", func(t *testing.T) { git := exec.Command("git", "checkout", "mrtest") @@ -384,7 +389,7 @@ func Test_mrCmd_ByBranch(t *testing.T) { repo := copyTestRepo(t) var mrID string t.Run("prepare", func(t *testing.T) { - cleanupMR(t, "lab-testing", repo, "mr by branch") + cleanupMR(t, "lab-testing", repo, "") }) t.Run("create", func(t *testing.T) { git := exec.Command("git", "checkout", "mrtest") @@ -434,7 +439,7 @@ func Test_mrCmd_source(t *testing.T) { repo := copyTestRepo(t) var mrID string t.Run("prepare", func(t *testing.T) { - cleanupMR(t, "lab-testing", repo, "mr title") + cleanupMR(t, "lab-testing", repo, "") }) t.Run("create_invalid", func(t *testing.T) { git := exec.Command("git", "checkout", "mrtest")