Skip to content

Commit

Permalink
tests: add cases that check repo-specific behavior
Browse files Browse the repository at this point in the history
`status.multi_repo_disallowed_repo`
If `allowed_repositories` excludes the payload repo, it should be
ignored even if payload would generate notification otherwise.

`status.multi_repo_independent_status_state`
The status rules should be evaluated for the correct repo. In this
test case, it should correctly detect that `master`'s last build
status was a failure for the given payload repo, and issue a
success notification, despite the last build status success in a
different repo.
  • Loading branch information
yasunariw committed Jan 5, 2021
1 parent d595729 commit 1fa5f6e
Show file tree
Hide file tree
Showing 5 changed files with 490 additions and 0 deletions.
222 changes: 222 additions & 0 deletions mock_payloads/status.multi_repo_disallowed_repo.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
{
"id": 1437427,
"sha": "0d95302addd66c1816bce1b1d495ed1c93ccd478",
"name": "acme/monorobot_test",
"target_url": "https://buildkite.com/acme/notabot-test/builds/2",
"avatar_url": "https://git.acme.org/avatars/oa/6?",
"context": "buildkite/notabot-test",
"description": "Build #2 passed (5 minutes, 19 seconds)",
"state": "success",
"commit": {
"sha": "0d95302addd66c1816bce1b1d495ed1c93ccd478",
"node_id": "MDY6Q29tbWl0MTgyOjBkOTUzMDJhZGRkNjZjMTgxNmJjZTFiMWQ0OTVlZDFjOTNjY2Q0Nzg=",
"commit": {
"author": {
"name": "Wile E. Coyote",
"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.acme.org/api/v3/repos/acme/monorobot_test/git/trees/ee5c539cad37c77348ce7a55756acc542b41cfc7"
},
"url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/git/commits/0d95302addd66c1816bce1b1d495ed1c93ccd478",
"comment_count": 0,
"verification": {
"verified": false,
"reason": "unsigned",
"signature": null,
"payload": null
}
},
"url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/commits/0d95302addd66c1816bce1b1d495ed1c93ccd478",
"html_url": "https://git.acme.org/acme/monorobot_test/commit/0d95302addd66c1816bce1b1d495ed1c93ccd478",
"comments_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/commits/0d95302addd66c1816bce1b1d495ed1c93ccd478/comments",
"author": {
"login": "wileecoyote",
"id": 34,
"node_id": "MDQ6VXNlcjM0",
"avatar_url": "https://git.acme.org/avatars/u/34?",
"gravatar_id": "",
"url": "https://git.acme.org/api/v3/users/wileecoyote",
"html_url": "https://git.acme.org/wileecoyote",
"followers_url": "https://git.acme.org/api/v3/users/wileecoyote/followers",
"following_url": "https://git.acme.org/api/v3/users/wileecoyote/following{/other_user}",
"gists_url": "https://git.acme.org/api/v3/users/wileecoyote/gists{/gist_id}",
"starred_url": "https://git.acme.org/api/v3/users/wileecoyote/starred{/owner}{/repo}",
"subscriptions_url": "https://git.acme.org/api/v3/users/wileecoyote/subscriptions",
"organizations_url": "https://git.acme.org/api/v3/users/wileecoyote/orgs",
"repos_url": "https://git.acme.org/api/v3/users/wileecoyote/repos",
"events_url": "https://git.acme.org/api/v3/users/wileecoyote/events{/privacy}",
"received_events_url": "https://git.acme.org/api/v3/users/wileecoyote/received_events",
"type": "User",
"site_admin": false
},
"committer": null,
"parents": [
{
"sha": "04cb72d6dc8d92131282a7eff57f6caf632f0a39",
"url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/commits/04cb72d6dc8d92131282a7eff57f6caf632f0a39",
"html_url": "https://git.acme.org/acme/monorobot_test/commit/04cb72d6dc8d92131282a7eff57f6caf632f0a39"
}
]
},
"branches": [
{
"name": "master",
"commit": {
"sha": "0d95302addd66c1816bce1b1d495ed1c93ccd478",
"url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/commits/0d95302addd66c1816bce1b1d495ed1c93ccd478"
},
"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": "monorobot_test",
"full_name": "acme/monorobot_test",
"private": true,
"owner": {
"login": "acme",
"id": 7,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc=",
"avatar_url": "https://git.acme.org/avatars/u/7?",
"gravatar_id": "",
"url": "https://git.acme.org/api/v3/users/acme",
"html_url": "https://git.acme.org/acme",
"followers_url": "https://git.acme.org/api/v3/users/acme/followers",
"following_url": "https://git.acme.org/api/v3/users/acme/following{/other_user}",
"gists_url": "https://git.acme.org/api/v3/users/acme/gists{/gist_id}",
"starred_url": "https://git.acme.org/api/v3/users/acme/starred{/owner}{/repo}",
"subscriptions_url": "https://git.acme.org/api/v3/users/acme/subscriptions",
"organizations_url": "https://git.acme.org/api/v3/users/acme/orgs",
"repos_url": "https://git.acme.org/api/v3/users/acme/repos",
"events_url": "https://git.acme.org/api/v3/users/acme/events{/privacy}",
"received_events_url": "https://git.acme.org/api/v3/users/acme/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://git.acme.org/acme/monorobot_test",
"description": null,
"fork": false,
"url": "https://git.acme.org/api/v3/repos/acme/monorobot_test",
"forks_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/forks",
"keys_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/keys{/key_id}",
"collaborators_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/collaborators{/collaborator}",
"teams_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/teams",
"hooks_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/hooks",
"issue_events_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/issues/events{/number}",
"events_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/events",
"assignees_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/assignees{/user}",
"branches_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/branches{/branch}",
"tags_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/tags",
"blobs_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/git/blobs{/sha}",
"git_tags_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/git/tags{/sha}",
"git_refs_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/git/refs{/sha}",
"trees_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/git/trees{/sha}",
"statuses_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/statuses/{sha}",
"languages_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/languages",
"stargazers_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/stargazers",
"contributors_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/contributors",
"subscribers_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/subscribers",
"subscription_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/subscription",
"commits_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/commits{/sha}",
"git_commits_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/git/commits{/sha}",
"comments_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/comments{/number}",
"issue_comment_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/issues/comments{/number}",
"contents_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/contents/{+path}",
"compare_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/compare/{base}...{head}",
"merges_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/merges",
"archive_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/{archive_format}{/ref}",
"downloads_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/downloads",
"issues_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/issues{/number}",
"pulls_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/pulls{/number}",
"milestones_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/milestones{/number}",
"notifications_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/notifications{?since,all,participating}",
"labels_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/labels{/name}",
"releases_url": "https://git.acme.org/api/v3/repos/acme/monorobot_test/releases{/id}",
"deployments_url": "https://git.acme.org/api/v3/repos/acme/monorobot_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.acme.org/acme/monorobot_test.git",
"ssh_url": "[email protected]:acme/monorobot_test.git",
"clone_url": "https://git.acme.org/acme/monorobot_test.git",
"svn_url": "https://git.acme.org/acme/monorobot_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": "acme",
"id": 7,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc=",
"url": "https://git.acme.org/api/v3/orgs/acme",
"repos_url": "https://git.acme.org/api/v3/orgs/acme/repos",
"events_url": "https://git.acme.org/api/v3/orgs/acme/events",
"hooks_url": "https://git.acme.org/api/v3/orgs/acme/hooks",
"issues_url": "https://git.acme.org/api/v3/orgs/acme/issues",
"members_url": "https://git.acme.org/api/v3/orgs/acme/members{/member}",
"public_members_url": "https://git.acme.org/api/v3/orgs/acme/public_members{/member}",
"avatar_url": "https://git.acme.org/avatars/u/7?",
"description": null
},
"enterprise": {
"id": 1,
"slug": "acme-corp",
"name": "Acme Corp",
"node_id": "MDEwOkVudGVycHJpc2Ux",
"avatar_url": "https://git.acme.org/avatars/b/1?",
"description": null,
"website_url": null,
"html_url": "https://git.acme.org/enterprises/acme-corp",
"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.acme.org/avatars/u/3?",
"gravatar_id": "",
"url": "https://git.acme.org/api/v3/users/ip",
"html_url": "https://git.acme.org/ip",
"followers_url": "https://git.acme.org/api/v3/users/ip/followers",
"following_url": "https://git.acme.org/api/v3/users/ip/following{/other_user}",
"gists_url": "https://git.acme.org/api/v3/users/ip/gists{/gist_id}",
"starred_url": "https://git.acme.org/api/v3/users/ip/starred{/owner}{/repo}",
"subscriptions_url": "https://git.acme.org/api/v3/users/ip/subscriptions",
"organizations_url": "https://git.acme.org/api/v3/users/ip/orgs",
"repos_url": "https://git.acme.org/api/v3/users/ip/repos",
"events_url": "https://git.acme.org/api/v3/users/ip/events{/privacy}",
"received_events_url": "https://git.acme.org/api/v3/users/ip/received_events",
"type": "User",
"site_admin": true
}
}
Loading

0 comments on commit 1fa5f6e

Please sign in to comment.