@@ -30,19 +30,19 @@ func (m *mockGitHubClient) EditComment(ctx context.Context, owner, repo string,
3030
3131func TestPost (t * testing.T ) {
3232 t .Setenv ("BUILDKITE_PIPELINE_SLUG" , "test-pipeline" )
33- t .Setenv ("BUILDKITE_LABEL " , "test-label " )
33+ t .Setenv ("BUILDKITE_STEP_KEY " , "test" )
3434 t .Setenv (common .PluginPrefix + "MESSAGE_ID" , "1" )
3535
3636 mockClient := & mockGitHubClient {
3737 createComment : func (ctx context.Context , owner , repo string , number int , comment * github.IssueComment ) (* github.IssueComment , * github.Response , error ) {
38- if owner != "testdev" || repo != "hello" || number != 420 || * comment .Body != "Test comment\n \n <!-- test-pipeline:test-label :pr-commenter-buildkite-plugin:1 -->" {
38+ if owner != "testdev" || repo != "hello" || number != 420 || * comment .Body != "Test comment\n \n <!-- test-pipeline:test:pr-commenter-buildkite-plugin:1 -->" {
3939 t .Errorf ("Unexpected arguments: owner=%s, repo=%s, number=%d, body=%s" , owner , repo , number , * comment .Body )
4040 }
4141 return nil , nil , nil
4242 },
4343 }
4444
45- commenter := comment .NewCommenter (mockClient )
45+ commenter , _ := comment .NewCommenter (mockClient )
4646
4747 err := commenter .Post (context .Background (), "testdev" , "hello" , "420" , "Test comment" )
4848 if err != nil {
@@ -52,7 +52,7 @@ func TestPost(t *testing.T) {
5252
5353func TestPostCommentEmptyBody (t * testing.T ) {
5454 mockClient := & mockGitHubClient {}
55- commenter := comment .NewCommenter (mockClient )
55+ commenter , _ := comment .NewCommenter (mockClient )
5656
5757 err := commenter .Post (context .Background (), "testdev" , "hello" , "69" , "" )
5858 if err == nil {
@@ -62,11 +62,11 @@ func TestPostCommentEmptyBody(t *testing.T) {
6262
6363func TestFindExistingComment_Found (t * testing.T ) {
6464 t .Setenv ("BUILDKITE_PIPELINE_SLUG" , "test-pipeline" )
65- t .Setenv ("BUILDKITE_LABEL " , "test-label " )
65+ t .Setenv ("BUILDKITE_STEP_KEY " , "test" )
6666 t .Setenv (common .PluginPrefix + "MESSAGE_ID" , "1" )
6767
6868 expectedID := int64 (123 )
69- expectedBody := "Test comment\n \n <!-- test-pipeline:test-label :pr-commenter-buildkite-plugin:1 -->"
69+ expectedBody := "Test comment\n \n <!-- test-pipeline:test:pr-commenter-buildkite-plugin:1 -->"
7070 expectedURL := "https://github.com/test/repo/pull/1#issuecomment-123"
7171
7272 mockClient := & mockGitHubClient {
@@ -84,7 +84,7 @@ func TestFindExistingComment_Found(t *testing.T) {
8484 },
8585 }
8686
87- commenter := comment .NewCommenter (mockClient )
87+ commenter , _ := comment .NewCommenter (mockClient )
8888 result , err := commenter .FindExistingComment (context .Background (), "testdev" , "hello" , "320" )
8989
9090 if err != nil {
@@ -100,11 +100,11 @@ func TestFindExistingComment_Found(t *testing.T) {
100100
101101func TestUpdateComment_Success (t * testing.T ) {
102102 t .Setenv ("BUILDKITE_PIPELINE_SLUG" , "test-pipeline" )
103- t .Setenv ("BUILDKITE_LABEL " , "test-label " )
103+ t .Setenv ("BUILDKITE_STEP_KEY " , "test" )
104104 t .Setenv (common .PluginPrefix + "MESSAGE_ID" , "1" )
105105
106106 commentID := int64 (456 )
107- expectedBody := "Updated comment\n \n <!-- test-pipeline:test-label :pr-commenter-buildkite-plugin:1 -->"
107+ expectedBody := "Updated comment\n \n <!-- test-pipeline:test:pr-commenter-buildkite-plugin:1 -->"
108108
109109 mockClient := & mockGitHubClient {
110110 editComment : func (ctx context.Context , owner , repo string , id int64 , comment * github.IssueComment ) (* github.IssueComment , * github.Response , error ) {
@@ -118,7 +118,7 @@ func TestUpdateComment_Success(t *testing.T) {
118118 },
119119 }
120120
121- commenter := comment .NewCommenter (mockClient )
121+ commenter , _ := comment .NewCommenter (mockClient )
122122 err := commenter .UpdateComment (context .Background (), "testdev" , "hello" , "Updated comment" , commentID )
123123
124124 if err != nil {
0 commit comments