@@ -11,6 +11,9 @@ import (
1111 "github.com/stretchr/testify/require"
1212)
1313
14+ // #3952 is not special, it's just a place to dump discussions as mr #1 filled up, long term should update the tests clean up what they create
15+ const mrCommentSlashDiscussionDumpsterID = "3952"
16+
1417func Test_mrCreateNote (t * testing.T ) {
1518 tests := []struct {
1619 Name string
@@ -19,16 +22,16 @@ func Test_mrCreateNote(t *testing.T) {
1922 }{
2023 {
2124 Name : "Normal text" ,
22- Args : []string {"lab-testing" , "1" , "-m" , "note text" },
23- ExpectedBody : "https://gitlab.com/lab-testing/test/merge_requests/1 #note_" ,
25+ Args : []string {"lab-testing" , mrCommentSlashDiscussionDumpsterID , "-m" , "note text" },
26+ ExpectedBody : "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + " #note_" ,
2427 },
2528 {
2629 // Escaped sequence text direct in the argument list as the
2730 // following one was already a problem:
2831 // https://github.com/zaquestion/lab/issues/376
2932 Name : "Escape char" ,
30- Args : []string {"lab-testing" , "1" , "-m" , "{\" key\" : \" value\" }" },
31- ExpectedBody : "https://gitlab.com/lab-testing/test/merge_requests/1 #note_" ,
33+ Args : []string {"lab-testing" , mrCommentSlashDiscussionDumpsterID , "-m" , "{\" key\" : \" value\" }" },
34+ ExpectedBody : "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + " #note_" ,
3235 },
3336 }
3437 noteCmd := []string {"mr" , "note" }
@@ -58,7 +61,7 @@ func Test_mrCreateNote_file(t *testing.T) {
5861 t .Fatal (err )
5962 }
6063
61- cmd := exec .Command (labBinaryPath , "mr" , "note" , "lab-testing" , "1" ,
64+ cmd := exec .Command (labBinaryPath , "mr" , "note" , "lab-testing" , mrCommentSlashDiscussionDumpsterID ,
6265 "-F" , "hellolab.txt" )
6366 cmd .Dir = repo
6467
@@ -68,13 +71,13 @@ func Test_mrCreateNote_file(t *testing.T) {
6871 t .Fatal (err )
6972 }
7073
71- require .Contains (t , string (b ), "https://gitlab.com/lab-testing/test/merge_requests/1 #note_" )
74+ require .Contains (t , string (b ), "https://gitlab.com/lab-testing/test/merge_requests/" + mrCommentSlashDiscussionDumpsterID + " #note_" )
7275}
7376
7477func Test_mrReplyAndResolve (t * testing.T ) {
7578 repo := copyTestRepo (t )
7679
77- cmd := exec .Command (labBinaryPath , "mr" , "note" , "lab-testing" , "1" , "-m" , "merge request text" )
80+ cmd := exec .Command (labBinaryPath , "mr" , "note" , "lab-testing" , mrCommentSlashDiscussionDumpsterID , "-m" , "merge request text" )
7881 cmd .Dir = repo
7982
8083 a , err := cmd .CombinedOutput ()
@@ -87,7 +90,7 @@ func Test_mrReplyAndResolve(t *testing.T) {
8790 noteID := noteIDs [1 ]
8891
8992 // add reply to the noteID
90- reply := exec .Command (labBinaryPath , "mr" , "reply" , "lab-testing" , "1 :"+ noteID , "-m" , "reply to note" )
93+ reply := exec .Command (labBinaryPath , "mr" , "reply" , "lab-testing" , mrCommentSlashDiscussionDumpsterID + " :"+ noteID , "-m" , "reply to note" )
9194 reply .Dir = repo
9295 c , err := reply .CombinedOutput ()
9396 if err != nil {
@@ -98,15 +101,15 @@ func Test_mrReplyAndResolve(t *testing.T) {
98101 replyIDs := strings .Split (_replyIDs [0 ], "#note_" )
99102 replyID := replyIDs [1 ]
100103
101- show := exec .Command (labBinaryPath , "mr" , "show" , "lab-testing" , "1" , "--comments" )
104+ show := exec .Command (labBinaryPath , "mr" , "show" , "lab-testing" , mrCommentSlashDiscussionDumpsterID , "--comments" )
102105 show .Dir = repo
103106 d , err := show .CombinedOutput ()
104107 if err != nil {
105108 t .Log (string (d ))
106109 t .Fatal (err )
107110 }
108111
109- resolve := exec .Command (labBinaryPath , "mr" , "resolve" , "lab-testing" , "1 :"+ noteID )
112+ resolve := exec .Command (labBinaryPath , "mr" , "resolve" , "lab-testing" , mrCommentSlashDiscussionDumpsterID + " :"+ noteID )
110113 resolve .Dir = repo
111114 e , err := resolve .CombinedOutput ()
112115 if err != nil {
0 commit comments