You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by GitBox <gi...@apache.org> on 2022/06/16 11:55:10 UTC

[GitHub] [incubator-devlake] warren830 opened a new pull request, #2224: Ref gitlab conn id mr note 2

warren830 opened a new pull request, #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224

   # Summary
   
   Refactor gitlab mr note&comment tasks with connection_id
   Add e2e test
   
   ### Does this close any open issues?
   Please mention the issues here.
   
   ### Screenshots
   Include any relevant screenshots here.
   
   ### Other Information
   Any other information that is important to this PR.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899174455


##########
plugins/gitlab/impl/impl.go:
##########
@@ -68,13 +68,13 @@ func (plugin Gitlab) SubTaskMetas() []core.SubTaskMeta {
 		tasks.ExtractApiPipelinesMeta,
 		tasks.EnrichMergeRequestsMeta,
 		tasks.ConvertProjectMeta,
-		tasks.ConvertIssuesMeta,
-		tasks.ConvertIssueLabelsMeta,
 		tasks.ConvertApiMergeRequestsMeta,
-		tasks.ConvertApiCommitsMeta,
 		tasks.ConvertApiNotesMeta,
 		tasks.ConvertMergeRequestCommentMeta,
 		tasks.ConvertApiMergeRequestsCommitsMeta,
+		tasks.ConvertIssuesMeta,
+		tasks.ConvertIssueLabelsMeta,
+		tasks.ConvertApiCommitsMeta,

Review Comment:
   Because we need to convert others first and test



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899175662


##########
plugins/gitlab/tasks/mr_note_extractor.go:
##########
@@ -73,11 +73,12 @@ func ExtractApiMergeRequestsNotes(taskCtx core.SubTaskContext) error {
 					AuthorUsername:  toolMrNote.AuthorUsername,
 					GitlabCreatedAt: toolMrNote.GitlabCreatedAt,
 					Resolvable:      toolMrNote.Resolvable,
+					ConnectionId:    data.Options.ConnectionId,
 				}
 				results = append(results, toolMrComment)
 
 			}
-
+			toolMrNote.ConnectionId = data.Options.ConnectionId

Review Comment:
   fix
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899235727


##########
plugins/gitlab/e2e/mr_notes_test.go:
##########
@@ -28,18 +28,17 @@ import (
 	"github.com/apache/incubator-devlake/plugins/gitlab/tasks"
 )
 
-func TestGitlabMrDataFlow(t *testing.T) {
+func TestGitlabMrNoteDataFlow(t *testing.T) {
 
 	var gitlab impl.Gitlab
 	dataflowTester := e2ehelper.NewDataFlowTester(t, "gitlab", gitlab)
 
 	taskData := &tasks.GitlabTaskData{
 		Options: &tasks.GitlabOptions{
 			ConnectionId: 1,
-			ProjectId:    18524154,
+			ProjectId:    20171709,
 		},
 	}
-
 	// import raw data table
 	dataflowTester.ImportCsvIntoRawTable("./tables/_raw_gitlab_api_merge_requests.csv",

Review Comment:
   It should be spilt after https://github.com/apache/incubator-devlake/pull/2207/files#diff-496adff56c77277556e295cc57e896a1085ed532bc1a30ec143d4a1976ef4619R119 merged



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899207798


##########
plugins/gitlab/e2e/snapshot_tables/notes.csv:
##########
@@ -0,0 +1 @@
+id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,pr_id,type,author,body,resolvable,is_system,created_date

Review Comment:
   changed repo, now it's not empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899207154


##########
plugins/gitlab/impl/impl.go:
##########
@@ -68,13 +68,13 @@ func (plugin Gitlab) SubTaskMetas() []core.SubTaskMeta {
 		tasks.ExtractApiPipelinesMeta,
 		tasks.EnrichMergeRequestsMeta,
 		tasks.ConvertProjectMeta,
-		tasks.ConvertIssuesMeta,
-		tasks.ConvertIssueLabelsMeta,
 		tasks.ConvertApiMergeRequestsMeta,
-		tasks.ConvertApiCommitsMeta,
 		tasks.ConvertApiNotesMeta,
 		tasks.ConvertMergeRequestCommentMeta,
 		tasks.ConvertApiMergeRequestsCommitsMeta,
+		tasks.ConvertIssuesMeta,
+		tasks.ConvertIssueLabelsMeta,
+		tasks.ConvertApiCommitsMeta,

Review Comment:
   > Is there any reason for the order?
   
   changed repo, now it's not empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899207523


##########
plugins/gitlab/e2e/snapshot_tables/pull_request_comments.csv:
##########
@@ -0,0 +1 @@
+id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,pull_request_id,body,user_id,created_date,commit_sha,position

Review Comment:
   changed repo, now it's not empty
   
   
   > empty?
   
   changed repo, now it's not empty



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899229644


##########
plugins/gitlab/e2e/snapshot_tables/_tool_gitlab_merge_request_notes.csv:
##########
@@ -0,0 +1,146 @@
+connection_id,gitlab_id,merge_request_id,merge_request_iid,noteable_type,author_username,body,gitlab_created_at,confidential,resolvable,is_system,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
+1,427956607,72934330,1,MergeRequest,gerilleto,"@lucas.rosa.merico sorry for the late response, i didn't notice this MR

Review Comment:
   It can be fixed future if MySQL can run with it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899208139


##########
plugins/gitlab/e2e/mr_notes_test.go:
##########
@@ -0,0 +1,114 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package e2e
+
+import (
+	"fmt"
+	"github.com/apache/incubator-devlake/models/domainlayer/code"
+	"testing"
+
+	"github.com/apache/incubator-devlake/helpers/e2ehelper"
+	"github.com/apache/incubator-devlake/plugins/gitlab/impl"
+	"github.com/apache/incubator-devlake/plugins/gitlab/models"
+	"github.com/apache/incubator-devlake/plugins/gitlab/tasks"
+)
+
+func TestGitlabMrNoteDataFlow(t *testing.T) {
+
+	var gitlab impl.Gitlab
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "gitlab", gitlab)
+
+	taskData := &tasks.GitlabTaskData{
+		Options: &tasks.GitlabOptions{
+			ConnectionId: 1,
+			ProjectId:    20171709,
+		},
+	}
+
+	// import raw data table
+	dataflowTester.ImportCsvIntoRawTable("./tables/_raw_gitlab_api_merge_request_notes.csv",
+		"_raw_gitlab_api_merge_request_notes")
+
+	// verify extraction
+	dataflowTester.FlushTabler(&models.GitlabMergeRequestNote{})
+	dataflowTester.FlushTabler(&models.GitlabMergeRequestComment{})
+	dataflowTester.Subtask(tasks.ExtractApiMergeRequestsNotesMeta, taskData)

Review Comment:
   nope



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] klesh merged pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
klesh merged PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] likyh commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
likyh commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899155957


##########
plugins/gitlab/e2e/mr_notes_test.go:
##########
@@ -0,0 +1,114 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one or more
+contributor license agreements.  See the NOTICE file distributed with
+this work for additional information regarding copyright ownership.
+The ASF licenses this file to You under the Apache License, Version 2.0
+(the "License"); you may not use this file except in compliance with
+the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package e2e
+
+import (
+	"fmt"
+	"github.com/apache/incubator-devlake/models/domainlayer/code"
+	"testing"
+
+	"github.com/apache/incubator-devlake/helpers/e2ehelper"
+	"github.com/apache/incubator-devlake/plugins/gitlab/impl"
+	"github.com/apache/incubator-devlake/plugins/gitlab/models"
+	"github.com/apache/incubator-devlake/plugins/gitlab/tasks"
+)
+
+func TestGitlabMrNoteDataFlow(t *testing.T) {
+
+	var gitlab impl.Gitlab
+	dataflowTester := e2ehelper.NewDataFlowTester(t, "gitlab", gitlab)
+
+	taskData := &tasks.GitlabTaskData{
+		Options: &tasks.GitlabOptions{
+			ConnectionId: 1,
+			ProjectId:    20171709,
+		},
+	}
+
+	// import raw data table
+	dataflowTester.ImportCsvIntoRawTable("./tables/_raw_gitlab_api_merge_request_notes.csv",
+		"_raw_gitlab_api_merge_request_notes")
+
+	// verify extraction
+	dataflowTester.FlushTabler(&models.GitlabMergeRequestNote{})
+	dataflowTester.FlushTabler(&models.GitlabMergeRequestComment{})
+	dataflowTester.Subtask(tasks.ExtractApiMergeRequestsNotesMeta, taskData)

Review Comment:
   Can ExtractApiMergeRequestsNotesMeta run without GitlabMergeRequest?



##########
plugins/gitlab/e2e/snapshot_tables/_tool_gitlab_merge_request_notes.csv:
##########
@@ -0,0 +1,146 @@
+connection_id,gitlab_id,merge_request_id,merge_request_iid,noteable_type,author_username,body,gitlab_created_at,confidential,resolvable,is_system,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark
+1,427956607,72934330,1,MergeRequest,gerilleto,"@lucas.rosa.merico sorry for the late response, i didn't notice this MR

Review Comment:
   It's cannot run in postgres. I suggest Good practice:
   ![origin_img_v2_b9e18ecf-6524-40e6-ad91-ddf8cf8ae68g](https://user-images.githubusercontent.com/3294100/174094697-0491fe1c-18c7-445d-8f07-e76afeb99554.jpg)
   ![origin_img_v2_c8635bba-fc98-4c4c-9684-4775038b5feg](https://user-images.githubusercontent.com/3294100/174094791-962aa455-fa59-43fe-a98a-1548d928c1ac.jpg)
   
   Bade practice:
   ![origin_img_v2_beb6b386-a612-463e-976e-1797b087426g](https://user-images.githubusercontent.com/3294100/174094845-e10a4cd9-8b2b-4261-80f7-1f83d7b1b0bd.jpg)
   
   it cannot run in pg because of the miss-match of "\r\n" and "\n". And I have no idea about this.



##########
plugins/gitlab/tasks/mr_note_extractor.go:
##########
@@ -73,11 +73,12 @@ func ExtractApiMergeRequestsNotes(taskCtx core.SubTaskContext) error {
 					AuthorUsername:  toolMrNote.AuthorUsername,
 					GitlabCreatedAt: toolMrNote.GitlabCreatedAt,
 					Resolvable:      toolMrNote.Resolvable,
+					ConnectionId:    data.Options.ConnectionId,
 				}
 				results = append(results, toolMrComment)
 
 			}
-
+			toolMrNote.ConnectionId = data.Options.ConnectionId

Review Comment:
   move to Line 65 after convertMergeRequestNote?



##########
plugins/gitlab/e2e/snapshot_tables/notes.csv:
##########
@@ -0,0 +1 @@
+id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,pr_id,type,author,body,resolvable,is_system,created_date

Review Comment:
   empty? Snapshot needs checking by human after creating auto.



##########
plugins/gitlab/impl/impl.go:
##########
@@ -68,13 +68,13 @@ func (plugin Gitlab) SubTaskMetas() []core.SubTaskMeta {
 		tasks.ExtractApiPipelinesMeta,
 		tasks.EnrichMergeRequestsMeta,
 		tasks.ConvertProjectMeta,
-		tasks.ConvertIssuesMeta,
-		tasks.ConvertIssueLabelsMeta,
 		tasks.ConvertApiMergeRequestsMeta,
-		tasks.ConvertApiCommitsMeta,
 		tasks.ConvertApiNotesMeta,
 		tasks.ConvertMergeRequestCommentMeta,
 		tasks.ConvertApiMergeRequestsCommitsMeta,
+		tasks.ConvertIssuesMeta,
+		tasks.ConvertIssueLabelsMeta,
+		tasks.ConvertApiCommitsMeta,

Review Comment:
   Is there any reason for the order?



##########
plugins/gitlab/e2e/snapshot_tables/pull_request_comments.csv:
##########
@@ -0,0 +1 @@
+id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,pull_request_id,body,user_id,created_date,commit_sha,position

Review Comment:
   empty?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [incubator-devlake] warren830 commented on a diff in pull request #2224: Ref gitlab conn id mr note 2

Posted by GitBox <gi...@apache.org>.
warren830 commented on code in PR #2224:
URL: https://github.com/apache/incubator-devlake/pull/2224#discussion_r899195281


##########
plugins/gitlab/e2e/snapshot_tables/pull_request_comments.csv:
##########
@@ -0,0 +1 @@
+id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,pull_request_id,body,user_id,created_date,commit_sha,position

Review Comment:
   yes... I double checked



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@devlake.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org