You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@devlake.apache.org by kl...@apache.org on 2022/10/13 06:42:42 UTC

[incubator-devlake] branch main updated: fix: ineffectual e2e test case for calculateChangeLeadTime (#3404)

This is an automated email from the ASF dual-hosted git repository.

klesh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git


The following commit(s) were added to refs/heads/main by this push:
     new b49b3c88 fix: ineffectual e2e test case for calculateChangeLeadTime (#3404)
b49b3c88 is described below

commit b49b3c88fb87f65a52e78bd6143d966d88009c5e
Author: abeizn <zi...@merico.dev>
AuthorDate: Thu Oct 13 14:42:38 2022 +0800

    fix: ineffectual e2e test case for calculateChangeLeadTime (#3404)
    
    * fix: ineffectual e2e test case for calculateChangeLeadTime
    
    * fix: ineffectual e2e test case for calculateChangeLeadTime
    
    * fix: ineffectual e2e test case for calculateChangeLeadTime
---
 .../dora/e2e/calculate_change_lead_time_test.go    | 53 ++++++++++++++++++----
 plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv    |  6 +--
 .../dora/e2e/snapshot_tables/lake_cicd_tasks.csv   |  6 +--
 plugins/dora/e2e/snapshot_tables/pull_requests.csv | 20 ++++----
 4 files changed, 59 insertions(+), 26 deletions(-)

diff --git a/plugins/dora/e2e/calculate_change_lead_time_test.go b/plugins/dora/e2e/calculate_change_lead_time_test.go
index 90b7ef61..599d8c48 100644
--- a/plugins/dora/e2e/calculate_change_lead_time_test.go
+++ b/plugins/dora/e2e/calculate_change_lead_time_test.go
@@ -21,7 +21,6 @@ import (
 	"testing"
 
 	"github.com/apache/incubator-devlake/helpers/e2ehelper"
-	"github.com/apache/incubator-devlake/models/common"
 	"github.com/apache/incubator-devlake/models/domainlayer/code"
 	"github.com/apache/incubator-devlake/models/domainlayer/devops"
 	"github.com/apache/incubator-devlake/plugins/dora/impl"
@@ -37,25 +36,59 @@ func TestCalculateCLTimeDataFlow(t *testing.T) {
 			RepoId: "github:GithubRepo:1:384111310",
 			TransformationRules: tasks.TransformationRules{
 				ProductionPattern: "(?i)deploy",
-				StagingPattern:    "(?i)stag",
-				TestingPattern:    "(?i)test",
 			},
 		},
 	}
+
 	dataflowTester.FlushTabler(&code.PullRequest{})
+
 	// import raw data table
-	dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_pipeline_commits.csv", &devops.CiCDPipelineCommit{})
-	dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_tasks_for_other_jobs.csv", &devops.CICDTask{})
+	dataflowTester.ImportCsvIntoTabler("./raw_tables/lake_cicd_tasks.csv", &devops.CICDTask{})
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_requests.csv", &code.PullRequest{})
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_request_comments.csv", &code.PullRequestComment{})
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/pull_request_commits.csv", &code.PullRequestCommit{})
 	dataflowTester.ImportCsvIntoTabler("./raw_tables/commits.csv", &code.Commit{})
-	dataflowTester.ImportCsvIntoTabler("./raw_tables/repos.csv", &code.Repo{})
 
 	// verify converter
 	dataflowTester.Subtask(tasks.CalculateChangeLeadTimeMeta, taskData)
-	dataflowTester.VerifyTableWithOptions(&code.PullRequest{}, e2ehelper.TableOptions{
-		CSVRelPath:  "./snapshot_tables/pull_requests.csv",
-		IgnoreTypes: []interface{}{common.NoPKModel{}},
-	})
+	dataflowTester.VerifyTable(
+		code.PullRequest{},
+		"./snapshot_tables/pull_requests.csv",
+		[]string{
+			"id",
+			"_raw_data_params",
+			"_raw_data_table",
+			"_raw_data_id",
+			"_raw_data_remark",
+			"base_repo_id",
+			"head_repo_id",
+			"status",
+			"title",
+			"description",
+			"url",
+			"author_name",
+			"author_id",
+			"parent_pr_id",
+			"pull_request_key",
+			"created_date",
+			"merged_date",
+			"closed_date",
+			"type",
+			"component",
+			"merge_commit_sha",
+			"head_ref",
+			"base_ref",
+			"base_commit_sha",
+			"head_commit_sha",
+			"coding_timespan",
+			"review_lag",
+			"review_timespan",
+			"deploy_timespan",
+			"change_timespan",
+			"orig_coding_timespan",
+			"orig_review_lag",
+			"orig_review_timespan",
+			"orig_deploy_timespan",
+		},
+	)
 }
diff --git a/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv b/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv
index 4ea2b348..9e891d7f 100644
--- a/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv
+++ b/plugins/dora/e2e/raw_tables/lake_cicd_tasks.csv
@@ -1,7 +1,7 @@
 id,created_at,updated_at,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,name,pipeline_id,result,status,type,duration_sec,started_date,finished_date,environment
-github:GithubJob:1:8269045794,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,2,"",deploy,github:GithubRun:1:3022052551,FAILURE,DONE,"",72,2022-09-09 11:27:13,2022-09-09 11:28:25,""
-github:GithubJob:1:8269045795,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,3,"",test (ubuntu-latest),github:GithubRun:1:3022052557,SUCCESS,DONE,"",191,2022-09-09 11:27:42,2022-09-09 11:30:53,""
-github:GithubJob:1:8269045819,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,1,"",commit-msg,github:GithubRun:1:3022052555,SUCCESS,DONE,"",8,2022-09-09 11:26:38,2022-09-09 11:26:46,""
+github:GithubJob:1:8269045794,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,2,"",deploy,github:GithubRun:1:3022052551,FAILURE,DONE,"DEPLOYMENT",72,2022-09-09 11:27:13,2022-09-09 11:28:25,""
+github:GithubJob:1:8269045795,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,3,"",test (ubuntu-latest),github:GithubRun:1:3022052557,SUCCESS,DONE,"DEPLOYMENT",191,2022-09-09 11:27:42,2022-09-09 11:30:53,""
+github:GithubJob:1:8269045819,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,1,"",commit-msg,github:GithubRun:1:3022052555,SUCCESS,DONE,"DEPLOYMENT",8,2022-09-09 11:26:38,2022-09-09 11:26:46,""
 github:GithubJob:1:8269045928,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,4,"",e2e-mysql,github:GithubRun:1:3022052558,SUCCESS,DONE,"",200,2022-09-09 11:28:00,2022-09-09 11:31:20,""
 github:GithubJob:1:8269046116,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,6,"",check Apache license header,github:GithubRun:1:3022052589,SUCCESS,DONE,"",57,2022-09-09 11:28:34,2022-09-09 11:29:31,""
 github:GithubJob:1:8269415129,2022-09-15 03:20:03.867,2022-09-15 03:20:03.867,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_jobs,5,"",deploy,github:GithubRun:1:3022190519,FAILURE,DONE,"",84,2022-09-09 11:51:21,2022-09-09 11:52:45,""
diff --git a/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv b/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv
index c2bfa418..412d95d9 100644
--- a/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv
+++ b/plugins/dora/e2e/snapshot_tables/lake_cicd_tasks.csv
@@ -1,7 +1,7 @@
 id,name,pipeline_id,result,status,type,environment,duration_sec,started_date,finished_date
-github:GithubJob:1:8269045794,deploy,github:GithubRun:1:3022052551,FAILURE,DONE,,PRODUCTION,72,2022-09-09T11:27:13.000+00:00,2022-09-09T11:28:25.000+00:00
-github:GithubJob:1:8269045795,test (ubuntu-latest),github:GithubRun:1:3022052557,SUCCESS,DONE,,,191,2022-09-09T11:27:42.000+00:00,2022-09-09T11:30:53.000+00:00
-github:GithubJob:1:8269045819,commit-msg,github:GithubRun:1:3022052555,SUCCESS,DONE,,,8,2022-09-09T11:26:38.000+00:00,2022-09-09T11:26:46.000+00:00
+github:GithubJob:1:8269045794,deploy,github:GithubRun:1:3022052551,FAILURE,DONE,DEPLOYMENT,PRODUCTION,72,2022-09-09T11:27:13.000+00:00,2022-09-09T11:28:25.000+00:00
+github:GithubJob:1:8269045795,test (ubuntu-latest),github:GithubRun:1:3022052557,SUCCESS,DONE,DEPLOYMENT,,191,2022-09-09T11:27:42.000+00:00,2022-09-09T11:30:53.000+00:00
+github:GithubJob:1:8269045819,commit-msg,github:GithubRun:1:3022052555,SUCCESS,DONE,DEPLOYMENT,,8,2022-09-09T11:26:38.000+00:00,2022-09-09T11:26:46.000+00:00
 github:GithubJob:1:8269045928,e2e-mysql,github:GithubRun:1:3022052558,SUCCESS,DONE,,,200,2022-09-09T11:28:00.000+00:00,2022-09-09T11:31:20.000+00:00
 github:GithubJob:1:8269046116,check Apache license header,github:GithubRun:1:3022052589,SUCCESS,DONE,,,57,2022-09-09T11:28:34.000+00:00,2022-09-09T11:29:31.000+00:00
 github:GithubJob:1:8269415129,deploy,github:GithubRun:1:3022190519,FAILURE,DONE,,PRODUCTION,84,2022-09-09T11:51:21.000+00:00,2022-09-09T11:52:45.000+00:00
diff --git a/plugins/dora/e2e/snapshot_tables/pull_requests.csv b/plugins/dora/e2e/snapshot_tables/pull_requests.csv
index e7352a29..cab46ef5 100644
--- a/plugins/dora/e2e/snapshot_tables/pull_requests.csv
+++ b/plugins/dora/e2e/snapshot_tables/pull_requests.csv
@@ -1,10 +1,10 @@
-id,base_repo_id,head_repo_id,status,title,description,url,author_name,author_id,parent_pr_id,pull_request_key,created_date,merged_date,closed_date,type,component,merge_commit_sha,head_ref,base_ref,base_commit_sha,head_commit_sha,coding_timespan,review_lag,review_timespan,deploy_timespan,change_timespan,orig_coding_timespan,orig_review_lag,orig_review_timespan,orig_deploy_timespan
-github:GithubPullRequest:1:1043463302,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,feat: implement API for plugin `customize`,"""# Summary\r\n\r\nfulfill the requirement \r\n#2880 ([Feature][customize] implement API for plugin customize) \r\n#2985 ([Feature][customize] new sub-task ExtractCustomizedFields for plugin customize)\r\n\r\nrelated to #2802 \r\nWe take Jira issue as an example.\r\n\r\n1. find all primary keys of table `issues`, which is `id`\r\n2.  retriev [...]
-github:GithubPullRequest:1:1048233599,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,feat: new plugin for gitea,"""# Summary\r\n[Gitea](https://gitea.io/) is an open-source software package for hosting software development version control using Git as well as other collaborative features like bug tracking, code review, kanban boards, tickets, and wikis.\r\n<!--\r\nThanks for submitting a pull request!\r\n\r\nWe appreciate you spending the time to work on these changes [...]
-github:GithubPullRequest:1:1049191985,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,[issue-2908]: Bump lake-builder version to 0.0.8,"""### ⚠️ Pre Checklist\r\n\r\n> Please complete _ALL_ items in this checklist, and remove before submitting\r\n\r\n- [x] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).\r\n- [x] I have added relevant tests.\r\n- [x] I have added relevant documentation.\r\n- [ ] I will add labels to the PR, s [...]
-github:GithubPullRequest:1:1051243958,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix: golangci-lint error,"""# Summary\r\n\r\ngolint-ci was down for a while, this PR try to fix all missed linting errors during the period.\r\n\r\n### Screenshots\r\n![image](https://user-images.githubusercontent.com/61080/189302830-d54ad54d-a3e6-470c-b517-9d803dbcd248.png)\r\n\r\n\r\n""",https://github.com/apache/incubator-devlake/pull/3032,klesh,github:GithubAccount:1:61080,,3032,2 [...]
-github:GithubPullRequest:1:1051273681,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix: update pipelineId,"""# Summary\r\n\r\nupdate pipelineId\r\n\r\n### Does this close any open issues?\r\nrelated to #2998 \r\n\r\n### Screenshots\r\n![image](https://user-images.githubusercontent.com/101256042/189307562-88fc6b6d-5daf-4b9c-8cec-0493cfe5a42c.png)\r\n\r\n### Other Information\r\nAny other information that is important to this PR.\r\n""",https://github.com/apache/incub [...]
-github:GithubPullRequest:1:1051340471,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,Jenkins fix,"""# Summary\r\nAdd TestJenkinsStagesDataFlow.\r\nAdd path to stages collect.\r\n\r\n<!--\r\nThanks for submitting a pull request!\r\n\r\nWe appreciate you spending the time to work on these changes.\r\nPlease fill out as many sections below as possible.\r\n-->\r\n\r\n### Does this close any open issues?\r\nCloses #3026 \r\n\r\n### Screenshots\r\n![image](https://user-imag [...]
-github:GithubPullRequest:1:1051524882,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix: task failure caused by 404,"""# Summary\r\nfix #2960 [Bug][gitihub] collect account failed by not found user\r\nIn the case of `err == ErrIgnoreAndContinue`, the `err` should not be wrapped, because on the caller side, the expression `err == ErrIgnoreAndContinue`  would evaluate as false.\r\n```go\r\nif apiClient.afterResponse != nil {\r\n\t\terr = apiClient.afterResponse(res)\r\ [...]
-github:GithubPullRequest:1:1051574863,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix(jenkins): update e2e,"""# Summary\r\n\r\nUpdate e2e according to recent changes\r\n\r\n### Does this close any open issues?\r\nrelate to #2854\r\n\r\n\r\n### Screenshots\r\nInclude any relevant screenshots here.\r\n\r\n### Other Information\r\nAny other information that is important to this PR.\r\n""",https://github.com/apache/incubator-devlake/pull/3039,warren830,github:GithubAcc [...]
-github:GithubPullRequest:1:1051637383,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix(gitlab): update e2e,"""# Summary\r\n\r\nupdate gitlab e2e according to recent changes\r\n\r\n### Does this close any open issues?\r\nrelate to #2871\r\n\r\n\r\n### Screenshots\r\nInclude any relevant screenshots here.\r\n\r\n### Other Information\r\nAny other information that is important to this PR.\r\n""",https://github.com/apache/incubator-devlake/pull/3041,warren830,github:Git [...]
+id,_raw_data_params,_raw_data_table,_raw_data_id,_raw_data_remark,base_repo_id,head_repo_id,status,title,description,url,author_name,author_id,parent_pr_id,pull_request_key,created_date,merged_date,closed_date,type,component,merge_commit_sha,head_ref,base_ref,base_commit_sha,head_commit_sha,coding_timespan,review_lag,review_timespan,deploy_timespan,change_timespan,orig_coding_timespan,orig_review_lag,orig_review_timespan,orig_deploy_timespan
+github:GithubPullRequest:1:1043463302,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,13176,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,feat: implement API for plugin `customize`,"""# Summary\r\n\r\nfulfill the requirement \r\n#2880 ([Feature][customize] implement API for plugin customize) \r\n#2985 ([Feature][customize] new sub-task ExtractCustomizedFields for plugin customize)\r\n\r\nrelated to #2802 \r\nW [...]
+github:GithubPullRequest:1:1048233599,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,13211,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,feat: new plugin for gitea,"""# Summary\r\n[Gitea](https://gitea.io/) is an open-source software package for hosting software development version control using Git as well as other collaborative features like bug tracking, code review, kanban boards, tickets, and wikis.\r\n< [...]
+github:GithubPullRequest:1:1049191985,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12680,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,[issue-2908]: Bump lake-builder version to 0.0.8,"""### ⚠️ Pre Checklist\r\n\r\n> Please complete _ALL_ items in this checklist, and remove before submitting\r\n\r\n- [x] I have read through the [Contributing Documentation](https://devlake.apache.org/community/).\r\n- [x] I  [...]
+github:GithubPullRequest:1:1051243958,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12691,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix: golangci-lint error,"""# Summary\r\n\r\ngolint-ci was down for a while, this PR try to fix all missed linting errors during the period.\r\n\r\n### Screenshots\r\n![image](https://user-images.githubusercontent.com/61080/189302830-d54ad54d-a3e6-470c-b517-9d803dbcd248.png) [...]
+github:GithubPullRequest:1:1051273681,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12693,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix: update pipelineId,"""# Summary\r\n\r\nupdate pipelineId\r\n\r\n### Does this close any open issues?\r\nrelated to #2998 \r\n\r\n### Screenshots\r\n![image](https://user-images.githubusercontent.com/101256042/189307562-88fc6b6d-5daf-4b9c-8cec-0493cfe5a42c.png)\r\n\r\n### [...]
+github:GithubPullRequest:1:1051340471,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12694,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,Jenkins fix,"""# Summary\r\nAdd TestJenkinsStagesDataFlow.\r\nAdd path to stages collect.\r\n\r\n<!--\r\nThanks for submitting a pull request!\r\n\r\nWe appreciate you spending the time to work on these changes.\r\nPlease fill out as many sections below as possible.\r\n-->\r [...]
+github:GithubPullRequest:1:1051524882,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12696,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix: task failure caused by 404,"""# Summary\r\nfix #2960 [Bug][gitihub] collect account failed by not found user\r\nIn the case of `err == ErrIgnoreAndContinue`, the `err` should not be wrapped, because on the caller side, the expression `err == ErrIgnoreAndContinue`  would [...]
+github:GithubPullRequest:1:1051574863,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12697,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix(jenkins): update e2e,"""# Summary\r\n\r\nUpdate e2e according to recent changes\r\n\r\n### Does this close any open issues?\r\nrelate to #2854\r\n\r\n\r\n### Screenshots\r\nInclude any relevant screenshots here.\r\n\r\n### Other Information\r\nAny other information that  [...]
+github:GithubPullRequest:1:1051637383,"{""ConnectionId"":1,""Owner"":""apache"",""Repo"":""incubator-devlake""}",_raw_github_api_pull_requests,12699,,github:GithubRepo:1:384111310,github:GithubRepo:1:384111310,closed,fix(gitlab): update e2e,"""# Summary\r\n\r\nupdate gitlab e2e according to recent changes\r\n\r\n### Does this close any open issues?\r\nrelate to #2871\r\n\r\n\r\n### Screenshots\r\nInclude any relevant screenshots here.\r\n\r\n### Other Information\r\nAny other information [...]