Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Move gitlab client test data into testdata/ files #4086

Merged
merged 2 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 54 additions & 25 deletions server/events/vcs/gitlab_client_test.go

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions server/events/vcs/testdata/gitlab-changes-available.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{
"id": 8312,
"iid": 102,
"target_branch": "main",
"source_branch": "TestBranch",
"project_id": 3771,
"title": "Update somefile.yaml",
"state": "opened",
"created_at": "2023-03-14T13:43:17.895Z",
"updated_at": "2023-03-14T13:43:59.978Z",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1755902,
"name": "Luke Kysow",
"username": "lkysow",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80\\u0026d=identicon",
"web_url": "https://gitlab.com/lkysow"
},
"assignee": null,
"assignees": [],
"reviewers": [],
"source_project_id": 3771,
"target_project_id": 3771,
"labels": [],
"description": "",
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"detailed_merge_status": "not_approved",
"merge_error": "",
"merged_by": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"subscribed": false,
"sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"merge_commit_sha": null,
"squash_commit_sha": null,
"user_notes_count": 0,
"changes_count": "1",
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"allow_collaboration": false,
"web_url": "https://gitlab.com/lkysow/atlantis-example/merge_requests/13",
"references": {
"short": "!13",
"relative": "!13",
"full": "lkysow/atlantis-example!13"
},
"discussion_locked": null,
"changes": [
{
"old_path": "somefile.yaml",
"new_path": "somefile.yaml",
"a_mode": "100644",
"b_mode": "100644",
"diff": "--- a/somefile.yaml\\ +++ b/somefile.yaml\\ @@ -1 +1 @@\\ -gud\\ +good",
"new_file": false,
"renamed_file": false,
"deleted_file": false
}
],
"user": {
"can_merge": true
},
"time_stats": {
"human_time_estimate": null,
"human_total_time_spent": null,
"time_estimate": 0,
"total_time_spent": 0
},
"squash": false,
"pipeline": null,
"head_pipeline": null,
"diff_refs": {
"base_sha": "67cb91d3f6198189f433c045154a885784ba6977",
"head_sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"start_sha": "67cb91d3f6198189f433c045154a885784ba6977"
},
"approvals_before_merge": null,
"reference": "!13",
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"overflow": false,
"merge_status": "can_be_merged"
}
85 changes: 85 additions & 0 deletions server/events/vcs/testdata/gitlab-changes-pending.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
{
"id": 8312,
"iid": 102,
"target_branch": "main",
"source_branch": "TestBranch",
"project_id": 3771,
"title": "Update somefile.yaml",
"state": "opened",
"created_at": "2023-03-14T13:43:17.895Z",
"updated_at": "2023-03-14T13:43:17.895Z",
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1755902,
"name": "Luke Kysow",
"username": "lkysow",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80\\u0026d=identicon",
"web_url": "https://gitlab.com/lkysow"
},
"assignee": null,
"assignees": [],
"reviewers": [],
"source_project_id": 3771,
"target_project_id": 3771,
"labels": "",
"description": "",
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"detailed_merge_status": "checking",
"merge_error": "",
"merged_by": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"subscribed": false,
"sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"merge_commit_sha": "",
"squash_commit_sha": "",
"user_notes_count": 0,
"changes_count": "",
"should_remove_source_branch": false,
"force_remove_source_branch": true,
"allow_collaboration": false,
"web_url": "https://gitlab.com/lkysow/atlantis-example/merge_requests/13",
"references": {
"short": "!13",
"relative": "!13",
"full": "lkysow/atlantis-example!13"
},
"discussion_locked": false,
"changes": [],
"user": {
"can_merge": true
},
"time_stats": {
"human_time_estimate": "",
"human_total_time_spent": "",
"time_estimate": 0,
"total_time_spent": 0
},
"squash": false,
"pipeline": null,
"head_pipeline": null,
"diff_refs": {
"base_sha": "",
"head_sha": "",
"start_sha": ""
},
"diverged_commits_count": 0,
"rebase_in_progress": false,
"approvals_before_merge": 0,
"reference": "!13",
"first_contribution": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"overflow": false,
"merge_status": "checking"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"id": 22461274,
"iid": 13,
"project_id": 4580910,
"title": "Update main.tf",
"description": "",
"state": "opened",
"created_at": "2019-01-15T18:27:29.375Z",
"updated_at": "2019-01-25T17:28:01.437Z",
"merged_by": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "patch-1",
"source_branch": "patch-1-merger",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1755902,
"name": "Luke Kysow",
"username": "lkysow",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80&d=identicon",
"web_url": "https://gitlab.com/lkysow"
},
"assignee": null,
"reviewers": [],
"source_project_id": 4580910,
"target_project_id": 4580910,
"labels": [],
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"detailed_merge_status": "ci_must_pass",
"sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"reference": "!13",
"references": {
"short": "!13",
"relative": "!13",
"full": "lkysow/atlantis-example!13"
},
"web_url": "https://gitlab.com/lkysow/atlantis-example/merge_requests/13",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": true,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null,
"subscribed": false,
"changes_count": "1",
"latest_build_started_at": "2019-01-15T18:27:29.375Z",
"latest_build_finished_at": "2019-01-25T17:28:01.437Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 488598,
"sha": "67cb91d3f6198189f433c045154a885784ba6977",
"ref": "patch-1-merger",
"status": "success",
"created_at": "2019-01-15T18:27:29.375Z",
"updated_at": "2019-01-25T17:28:01.437Z",
"web_url": "https://gitlab.com/lkysow/atlantis-example/-/pipelines/488598"
},
"head_pipeline": {
"id": 488598,
"sha": "67cb91d3f6198189f433c045154a885784ba6977",
"ref": "patch-1-merger",
"status": "success",
"created_at": "2019-01-15T18:27:29.375Z",
"updated_at": "2019-01-25T17:28:01.437Z",
"web_url": "https://gitlab.com/lkysow/atlantis-example/-/pipelines/488598",
"before_sha": "0000000000000000000000000000000000000000",
"tag": false,
"yaml_errors": null,
"user": {
"id": 1755902,
"name": "Luke Kysow",
"username": "lkysow",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80&d=identicon",
"web_url": "https://gitlab.com/lkysow"
},
"started_at": "2019-01-15T18:27:29.375Z",
"finished_at": "2019-01-25T17:28:01.437Z",
"committed_at": null,
"duration": 31,
"coverage": null,
"detailed_status": {
"icon": "status_success",
"text": "passed",
"label": "passed",
"group": "success",
"tooltip": "passed",
"has_details": true,
"details_path": "/lkysow/atlantis-example/-/pipelines/488598",
"illustration": null,
"favicon": "/assets/ci_favicons/favicon_status_success-8451333011eee8ce9f2ab25dc487fe24a8758c694827a582f17f42b0a90446a2.png"
}
},
"diff_refs": {
"base_sha": "67cb91d3f6198189f433c045154a885784ba6977",
"head_sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"start_sha": "67cb91d3f6198189f433c045154a885784ba6977"
},
"merge_error": null,
"first_contribution": false,
"user": {
"can_merge": true
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"id": 22461274,
"iid": 13,
"project_id": 4580910,
"title": "Update main.tf",
"description": "",
"state": "opened",
"created_at": "2019-01-15T18:27:29.375Z",
"updated_at": "2019-01-25T17:28:01.437Z",
"merged_by": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "patch-1",
"source_branch": "patch-1-merger",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 1755902,
"name": "Luke Kysow",
"username": "lkysow",
"state": "active",
"avatar_url": "https://secure.gravatar.com/avatar/25fd57e71590fe28736624ff24d41c5f?s=80&d=identicon",
"web_url": "https://gitlab.com/lkysow"
},
"assignee": null,
"reviewers": [],
"source_project_id": 4580910,
"target_project_id": 4580910,
"labels": [],
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"detailed_merge_status": "mergeable",
"sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": true,
"reference": "!13",
"references": {
"short": "!13",
"relative": "!13",
"full": "lkysow/atlantis-example!13"
},
"web_url": "https://gitlab.com/lkysow/atlantis-example/merge_requests/13",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": true,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null,
"subscribed": false,
"changes_count": "1",
"latest_build_started_at": "2019-01-15T18:27:29.375Z",
"latest_build_finished_at": "2019-01-25T17:28:01.437Z",
"first_deployed_to_production_at": null,
"pipeline": {
"id": 488598,
"sha": "67cb91d3f6198189f433c045154a885784ba6977",
"ref": "patch-1-merger",
"status": "success",
"created_at": "2019-01-15T18:27:29.375Z",
"updated_at": "2019-01-25T17:28:01.437Z",
"web_url": "https://gitlab.com/lkysow/atlantis-example/-/pipelines/488598"
},
"head_pipeline": null,
"diff_refs": {
"base_sha": "67cb91d3f6198189f433c045154a885784ba6977",
"head_sha": "cb86d70f464632bdfbe1bb9bc0f2f9d847a774a0",
"start_sha": "67cb91d3f6198189f433c045154a885784ba6977"
},
"merge_error": null,
"first_contribution": false,
"user": {
"can_merge": true
}
}
Loading