Skip to content

Commit

Permalink
tests: add cases that require per-build state tracking of statuses
Browse files Browse the repository at this point in the history
`status.success_test_different_steps_from_prev`

This is for an incoming successful build on develop branch with
a single build step, "notabot-test/build". There exist past successes
for same branch + different steps, and for different branch + same
step, but not for same branch + same step. Thus, it should generate
a notification.

`status.success_test_not_affected_by_unrelated_success_with_different_steps`

This is for an incoming successful build on develop branch with
two steps, "notabot-test/{build-infra,setup}". Here, previously a build with
steps "build-infra" and "setup" failed on step "build-infra". Then a
subsequent build with step "build" succeeded, so the overall pipeline state
is a success. However, the more recent successful but unrelated build should not
affect generation of another success notification, given the change in status
state for "build-infra".
  • Loading branch information
yasunariw committed Jan 8, 2021
1 parent c3cba41 commit 091b1c2
Show file tree
Hide file tree
Showing 7 changed files with 763 additions and 0 deletions.
222 changes: 222 additions & 0 deletions mock_payloads/status.success_test_different_steps_from_prev.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
{
"id": 1437427,
"sha": "71a5b16f3e880a58a4b63201174254c9663faca4",
"name": "ahrefs/notabot_test",
"target_url": "https://buildkite.com/ahrefs/notabot-test/builds/4",
"avatar_url": "https://git.ahrefs.com/avatars/oa/6?",
"context": "buildkite/notabot-test",
"description": "Build #4 passed (5 minutes, 19 seconds)",
"state": "success",
"commit": {
"sha": "71a5b16f3e880a58a4b63201174254c9663faca4",
"node_id": "MDY6Q29tbWl0MTgyOjBkOTUzMDJhZGRkNjZjMTgxNmJjZTFiMWQ0OTVlZDFjOTNjY2Q0Nzg=",
"commit": {
"author": {
"name": "Louis Roché",
"email": "[email protected]",
"date": "2020-06-02T03:14:51Z"
},
"committer": {
"name": "GitHub Enterprise",
"email": "[email protected]",
"date": "2020-06-02T03:14:51Z"
},
"message": "Update README.md",
"tree": {
"sha": "ee5c539cad37c77348ce7a55756acc542b41cfc7",
"url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/trees/ee5c539cad37c77348ce7a55756acc542b41cfc7"
},
"url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/commits/71a5b16f3e880a58a4b63201174254c9663faca4",
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/commits/71a5b16f3e880a58a4b63201174254c9663faca4",
"html_url": "https://git.ahrefs.com/ahrefs/notabot_test/commit/71a5b16f3e880a58a4b63201174254c9663faca4",
"comments_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/commits/71a5b16f3e880a58a4b63201174254c9663faca4/comments",
"author": {
"login": "louis",
"id": 34,
"node_id": "MDQ6VXNlcjM0",
"avatar_url": "https://git.ahrefs.com/avatars/u/34?",
"gravatar_id": "",
"url": "https://git.ahrefs.com/api/v3/users/louis",
"html_url": "https://git.ahrefs.com/louis",
"followers_url": "https://git.ahrefs.com/api/v3/users/louis/followers",
"following_url": "https://git.ahrefs.com/api/v3/users/louis/following{/other_user}",
"gists_url": "https://git.ahrefs.com/api/v3/users/louis/gists{/gist_id}",
"starred_url": "https://git.ahrefs.com/api/v3/users/louis/starred{/owner}{/repo}",
"subscriptions_url": "https://git.ahrefs.com/api/v3/users/louis/subscriptions",
"organizations_url": "https://git.ahrefs.com/api/v3/users/louis/orgs",
"repos_url": "https://git.ahrefs.com/api/v3/users/louis/repos",
"events_url": "https://git.ahrefs.com/api/v3/users/louis/events{/privacy}",
"received_events_url": "https://git.ahrefs.com/api/v3/users/louis/received_events",
"type": "User",
"site_admin": false
},
"committer": null,
"parents": [
{
"sha": "04cb72d6dc8d92131282a7eff57f6caf632f0a39",
"url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/commits/04cb72d6dc8d92131282a7eff57f6caf632f0a39",
"html_url": "https://git.ahrefs.com/ahrefs/notabot_test/commit/04cb72d6dc8d92131282a7eff57f6caf632f0a39"
}
]
},
"branches": [
{
"name": "develop",
"commit": {
"sha": "71a5b16f3e880a58a4b63201174254c9663faca4",
"url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/commits/71a5b16f3e880a58a4b63201174254c9663faca4"
},
"protected": false
}
],
"created_at": "2020-06-02T03:21:39+00:00",
"updated_at": "2020-06-02T03:21:39+00:00",
"repository": {
"id": 182,
"node_id": "MDEwOlJlcG9zaXRvcnkxODI=",
"name": "notabot_test",
"full_name": "ahrefs/notabot_test",
"private": true,
"owner": {
"login": "ahrefs",
"id": 7,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc=",
"avatar_url": "https://git.ahrefs.com/avatars/u/7?",
"gravatar_id": "",
"url": "https://git.ahrefs.com/api/v3/users/ahrefs",
"html_url": "https://git.ahrefs.com/ahrefs",
"followers_url": "https://git.ahrefs.com/api/v3/users/ahrefs/followers",
"following_url": "https://git.ahrefs.com/api/v3/users/ahrefs/following{/other_user}",
"gists_url": "https://git.ahrefs.com/api/v3/users/ahrefs/gists{/gist_id}",
"starred_url": "https://git.ahrefs.com/api/v3/users/ahrefs/starred{/owner}{/repo}",
"subscriptions_url": "https://git.ahrefs.com/api/v3/users/ahrefs/subscriptions",
"organizations_url": "https://git.ahrefs.com/api/v3/users/ahrefs/orgs",
"repos_url": "https://git.ahrefs.com/api/v3/users/ahrefs/repos",
"events_url": "https://git.ahrefs.com/api/v3/users/ahrefs/events{/privacy}",
"received_events_url": "https://git.ahrefs.com/api/v3/users/ahrefs/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://git.ahrefs.com/ahrefs/notabot_test",
"description": null,
"fork": false,
"url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test",
"forks_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/forks",
"keys_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/keys{/key_id}",
"collaborators_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/collaborators{/collaborator}",
"teams_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/teams",
"hooks_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/hooks",
"issue_events_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/issues/events{/number}",
"events_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/events",
"assignees_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/assignees{/user}",
"branches_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/branches{/branch}",
"tags_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/tags",
"blobs_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/blobs{/sha}",
"git_tags_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/tags{/sha}",
"git_refs_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/refs{/sha}",
"trees_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/trees{/sha}",
"statuses_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/statuses/{sha}",
"languages_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/languages",
"stargazers_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/stargazers",
"contributors_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/contributors",
"subscribers_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/subscribers",
"subscription_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/subscription",
"commits_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/commits{/sha}",
"git_commits_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/git/commits{/sha}",
"comments_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/comments{/number}",
"issue_comment_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/issues/comments{/number}",
"contents_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/contents/{+path}",
"compare_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/compare/{base}...{head}",
"merges_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/merges",
"archive_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/{archive_format}{/ref}",
"downloads_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/downloads",
"issues_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/issues{/number}",
"pulls_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/pulls{/number}",
"milestones_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/milestones{/number}",
"notifications_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/notifications{?since,all,participating}",
"labels_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/labels{/name}",
"releases_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/releases{/id}",
"deployments_url": "https://git.ahrefs.com/api/v3/repos/ahrefs/notabot_test/deployments",
"created_at": "2020-06-01T18:44:17Z",
"updated_at": "2020-06-02T03:14:53Z",
"pushed_at": "2020-06-02T03:14:51Z",
"git_url": "git://git.ahrefs.com/ahrefs/notabot_test.git",
"ssh_url": "[email protected]:ahrefs/notabot_test.git",
"clone_url": "https://git.ahrefs.com/ahrefs/notabot_test.git",
"svn_url": "https://git.ahrefs.com/ahrefs/notabot_test",
"homepage": null,
"size": 0,
"stargazers_count": 0,
"watchers_count": 0,
"language": "Shell",
"has_issues": true,
"has_projects": false,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"forks_count": 0,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 0,
"license": null,
"forks": 0,
"open_issues": 0,
"watchers": 0,
"default_branch": "master"
},
"organization": {
"login": "ahrefs",
"id": 7,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc=",
"url": "https://git.ahrefs.com/api/v3/orgs/ahrefs",
"repos_url": "https://git.ahrefs.com/api/v3/orgs/ahrefs/repos",
"events_url": "https://git.ahrefs.com/api/v3/orgs/ahrefs/events",
"hooks_url": "https://git.ahrefs.com/api/v3/orgs/ahrefs/hooks",
"issues_url": "https://git.ahrefs.com/api/v3/orgs/ahrefs/issues",
"members_url": "https://git.ahrefs.com/api/v3/orgs/ahrefs/members{/member}",
"public_members_url": "https://git.ahrefs.com/api/v3/orgs/ahrefs/public_members{/member}",
"avatar_url": "https://git.ahrefs.com/avatars/u/7?",
"description": null
},
"enterprise": {
"id": 1,
"slug": "ahrefs-pte-ltd",
"name": "Ahrefs Pte Ltd",
"node_id": "MDEwOkVudGVycHJpc2Ux",
"avatar_url": "https://git.ahrefs.com/avatars/b/1?",
"description": null,
"website_url": null,
"html_url": "https://git.ahrefs.com/enterprises/ahrefs-pte-ltd",
"created_at": "2019-01-09T18:50:55Z",
"updated_at": "2019-03-01T16:07:28Z"
},
"sender": {
"login": "ip",
"id": 3,
"node_id": "MDQ6VXNlcjM=",
"avatar_url": "https://git.ahrefs.com/avatars/u/3?",
"gravatar_id": "",
"url": "https://git.ahrefs.com/api/v3/users/ip",
"html_url": "https://git.ahrefs.com/ip",
"followers_url": "https://git.ahrefs.com/api/v3/users/ip/followers",
"following_url": "https://git.ahrefs.com/api/v3/users/ip/following{/other_user}",
"gists_url": "https://git.ahrefs.com/api/v3/users/ip/gists{/gist_id}",
"starred_url": "https://git.ahrefs.com/api/v3/users/ip/starred{/owner}{/repo}",
"subscriptions_url": "https://git.ahrefs.com/api/v3/users/ip/subscriptions",
"organizations_url": "https://git.ahrefs.com/api/v3/users/ip/orgs",
"repos_url": "https://git.ahrefs.com/api/v3/users/ip/repos",
"events_url": "https://git.ahrefs.com/api/v3/users/ip/events{/privacy}",
"received_events_url": "https://git.ahrefs.com/api/v3/users/ip/received_events",
"type": "User",
"site_admin": true
}
}
Loading

0 comments on commit 091b1c2

Please sign in to comment.