Unrealistic merge request fixtures
The command rails frontend:mock_server_rspec_fixtures
will generate unrealistic merge request responses. In a typical system the ID
and created_at
values will ascend together. However, the generated merge request data has data that is out of step.
The below sample is taken from the file generated by the command above (`tmp/tests/frontend/fixtures-ee/api/merge_requests/get.json`)
[
{
"id": 204,
"iid": 1,
"project_id": 231,
"title": "My title 1",
"description": null,
"state": "opened",
"created_at": "2022-05-06T06:13:07.705Z",
"updated_at": "2022-05-06T06:13:07.705Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "feature",
"source_branch": "master",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 397,
"username": "gitlab-test",
"name": "Sidney Jones2",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/2c75f98f3ea6cd6ee75cfbdfbb031388?s=80\u0026d=identicon",
"web_url": "http://localhost/gitlab-test"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 231,
"target_project_id": 231,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"sha": "b83d6e391c22777fca1ed3012fce84f633d7fed0",
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": null,
"reference": "!1",
"references": {
"short": "!1",
"relative": "!1",
"full": "gitlab-test/lorem-ipsum!1"
},
"web_url": "http://localhost/gitlab-test/lorem-ipsum/-/merge_requests/1",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
{
"id": 208,
"iid": 5,
"project_id": 231,
"title": "My title 5",
"description": null,
"state": "opened",
"created_at": "2015-07-03T10:00:00.000Z",
"updated_at": "2015-07-03T10:00:00.000Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "feature",
"source_branch": "branch-3",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 397,
"username": "gitlab-test",
"name": "Sidney Jones2",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/2c75f98f3ea6cd6ee75cfbdfbb031388?s=80\u0026d=identicon",
"web_url": "http://localhost/gitlab-test"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 231,
"target_project_id": 231,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"sha": null,
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": null,
"reference": "!5",
"references": {
"short": "!5",
"relative": "!5",
"full": "gitlab-test/lorem-ipsum!5"
},
"web_url": "http://localhost/gitlab-test/lorem-ipsum/-/merge_requests/5",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
{
"id": 207,
"iid": 4,
"project_id": 231,
"title": "My title 4",
"description": null,
"state": "opened",
"created_at": "2015-07-03T10:00:00.000Z",
"updated_at": "2015-07-03T10:00:00.000Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "feature",
"source_branch": "branch-2",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 397,
"username": "gitlab-test",
"name": "Sidney Jones2",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/2c75f98f3ea6cd6ee75cfbdfbb031388?s=80\u0026d=identicon",
"web_url": "http://localhost/gitlab-test"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 231,
"target_project_id": 231,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"sha": null,
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": null,
"reference": "!4",
"references": {
"short": "!4",
"relative": "!4",
"full": "gitlab-test/lorem-ipsum!4"
},
"web_url": "http://localhost/gitlab-test/lorem-ipsum/-/merge_requests/4",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
{
"id": 206,
"iid": 3,
"project_id": 231,
"title": "My title 3",
"description": null,
"state": "opened",
"created_at": "2015-07-03T10:00:00.000Z",
"updated_at": "2015-07-03T10:00:00.000Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "feature",
"source_branch": "branch-1",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 397,
"username": "gitlab-test",
"name": "Sidney Jones2",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/2c75f98f3ea6cd6ee75cfbdfbb031388?s=80\u0026d=identicon",
"web_url": "http://localhost/gitlab-test"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 231,
"target_project_id": 231,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"sha": null,
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": null,
"reference": "!3",
"references": {
"short": "!3",
"relative": "!3",
"full": "gitlab-test/lorem-ipsum!3"
},
"web_url": "http://localhost/gitlab-test/lorem-ipsum/-/merge_requests/3",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
},
{
"id": 205,
"iid": 2,
"project_id": 231,
"title": "My title 2",
"description": null,
"state": "opened",
"created_at": "2015-07-03T10:00:00.000Z",
"updated_at": "2015-07-03T10:00:00.000Z",
"merged_by": null,
"merge_user": null,
"merged_at": null,
"closed_by": null,
"closed_at": null,
"target_branch": "feature",
"source_branch": "branch-0",
"user_notes_count": 0,
"upvotes": 0,
"downvotes": 0,
"author": {
"id": 397,
"username": "gitlab-test",
"name": "Sidney Jones2",
"state": "active",
"avatar_url": "https://www.gravatar.com/avatar/2c75f98f3ea6cd6ee75cfbdfbb031388?s=80\u0026d=identicon",
"web_url": "http://localhost/gitlab-test"
},
"assignees": [],
"assignee": null,
"reviewers": [],
"source_project_id": 231,
"target_project_id": 231,
"labels": [],
"draft": false,
"work_in_progress": false,
"milestone": null,
"merge_when_pipeline_succeeds": false,
"merge_status": "can_be_merged",
"sha": null,
"merge_commit_sha": null,
"squash_commit_sha": null,
"discussion_locked": null,
"should_remove_source_branch": null,
"force_remove_source_branch": null,
"reference": "!2",
"references": {
"short": "!2",
"relative": "!2",
"full": "gitlab-test/lorem-ipsum!2"
}
"web_url": "http://localhost/gitlab-test/lorem-ipsum/-/merge_requests/2",
"time_stats": {
"time_estimate": 0,
"total_time_spent": 0,
"human_time_estimate": null,
"human_total_time_spent": null
},
"squash": false,
"task_completion_status": {
"count": 0,
"completed_count": 0
},
"has_conflicts": false,
"blocking_discussions_resolved": true,
"approvals_before_merge": null
}
]
While this is a seemingly small problem, it's breaking my MR which is attempting to implement a database team recommendation.