Skip to content

Commit

Permalink
Merge pull request #1737 from yasin-herken/demo
Browse files Browse the repository at this point in the history
Added startup failure to the Conclusion enum class and added test acc…
  • Loading branch information
bitwiseman authored Nov 11, 2023
2 parents 17af7e6 + f65a121 commit 3d3e905
Show file tree
Hide file tree
Showing 8 changed files with 1,180 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/org/kohsuke/github/GHWorkflowRun.java
Original file line number Diff line number Diff line change
Expand Up @@ -548,6 +548,8 @@ public static enum Conclusion {
STALE,
/** The timed out. */
TIMED_OUT,
/** Start up fail */
STARTUP_FAILURE,
/** The unknown. */
UNKNOWN;

Expand Down
22 changes: 22 additions & 0 deletions src/test/java/org/kohsuke/github/GHWorkflowRunTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,28 @@ public void testApproval() throws IOException {
assertThat(workflowRun.getConclusion(), is(Conclusion.SUCCESS));
}

/**
* Test start up failure conclusion.
*
* @throws IOException
* Signals that an I/O exception has occurred.
*/

@Test
public void testStartupFailureConclusion() throws IOException {
snapshotNotAllowed();

GHWorkflow ghWorkflow = repo.getWorkflow("startup-failure-workflow.yml");

List<GHWorkflowRun> ghWorkflowRunList = ghWorkflow.listRuns().toList();

List<GHWorkflowRun> list = ghWorkflowRunList.stream()
.filter(ghWorkflowRun -> ghWorkflowRun.getConclusion().equals(Conclusion.STARTUP_FAILURE))
.collect(Collectors.toList());

assertThat(list.get(0).getConclusion(), is(Conclusion.STARTUP_FAILURE));
}

private void await(String alias, Function<GHRepository, Boolean> condition) throws IOException {
if (!mockGitHub.isUseProxy()) {
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
{
"id": 348674220,
"node_id": "MDEwOlJlcG9zaXRvcnkzNDg2NzQyMjA=",
"name": "GHWorkflowRunTest",
"full_name": "hub4j-test-org/GHWorkflowRunTest",
"private": false,
"owner": {
"login": "hub4j-test-org",
"id": 7544739,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hub4j-test-org",
"html_url": "https://github.com/hub4j-test-org",
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
"type": "Organization",
"site_admin": false
},
"html_url": "https://github.com/hub4j-test-org/GHWorkflowRunTest",
"description": "Repository used by GHWorkflowRunTest",
"fork": false,
"url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest",
"forks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/forks",
"keys_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/keys{/key_id}",
"collaborators_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/collaborators{/collaborator}",
"teams_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/teams",
"hooks_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/hooks",
"issue_events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/events{/number}",
"events_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/events",
"assignees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/assignees{/user}",
"branches_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/branches{/branch}",
"tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/tags",
"blobs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/blobs{/sha}",
"git_tags_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/tags{/sha}",
"git_refs_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/refs{/sha}",
"trees_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/trees{/sha}",
"statuses_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/statuses/{sha}",
"languages_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/languages",
"stargazers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/stargazers",
"contributors_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contributors",
"subscribers_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscribers",
"subscription_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/subscription",
"commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/commits{/sha}",
"git_commits_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/git/commits{/sha}",
"comments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/comments{/number}",
"issue_comment_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues/comments{/number}",
"contents_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/contents/{+path}",
"compare_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/compare/{base}...{head}",
"merges_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/merges",
"archive_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/{archive_format}{/ref}",
"downloads_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/downloads",
"issues_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/issues{/number}",
"pulls_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/pulls{/number}",
"milestones_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/milestones{/number}",
"notifications_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/notifications{?since,all,participating}",
"labels_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/labels{/name}",
"releases_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/releases{/id}",
"deployments_url": "https://api.github.com/repos/hub4j-test-org/GHWorkflowRunTest/deployments",
"created_at": "2021-03-17T10:50:49Z",
"updated_at": "2023-11-08T21:14:03Z",
"pushed_at": "2023-11-08T21:53:11Z",
"git_url": "git://github.com/hub4j-test-org/GHWorkflowRunTest.git",
"ssh_url": "[email protected]:hub4j-test-org/GHWorkflowRunTest.git",
"clone_url": "https://github.com/hub4j-test-org/GHWorkflowRunTest.git",
"svn_url": "https://github.com/hub4j-test-org/GHWorkflowRunTest",
"homepage": null,
"size": 12,
"stargazers_count": 0,
"watchers_count": 0,
"language": null,
"has_issues": true,
"has_projects": true,
"has_downloads": true,
"has_wiki": true,
"has_pages": false,
"has_discussions": false,
"forks_count": 1,
"mirror_url": null,
"archived": false,
"disabled": false,
"open_issues_count": 7,
"license": null,
"allow_forking": true,
"is_template": false,
"web_commit_signoff_required": false,
"topics": [],
"visibility": "public",
"forks": 1,
"open_issues": 7,
"watchers": 0,
"default_branch": "main",
"temp_clone_token": null,
"organization": {
"login": "hub4j-test-org",
"id": 7544739,
"node_id": "MDEyOk9yZ2FuaXphdGlvbjc1NDQ3Mzk=",
"avatar_url": "https://avatars.githubusercontent.com/u/7544739?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/hub4j-test-org",
"html_url": "https://github.com/hub4j-test-org",
"followers_url": "https://api.github.com/users/hub4j-test-org/followers",
"following_url": "https://api.github.com/users/hub4j-test-org/following{/other_user}",
"gists_url": "https://api.github.com/users/hub4j-test-org/gists{/gist_id}",
"starred_url": "https://api.github.com/users/hub4j-test-org/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/hub4j-test-org/subscriptions",
"organizations_url": "https://api.github.com/users/hub4j-test-org/orgs",
"repos_url": "https://api.github.com/users/hub4j-test-org/repos",
"events_url": "https://api.github.com/users/hub4j-test-org/events{/privacy}",
"received_events_url": "https://api.github.com/users/hub4j-test-org/received_events",
"type": "Organization",
"site_admin": false
},
"network_count": 1,
"subscribers_count": 10
}
Loading

0 comments on commit 3d3e905

Please sign in to comment.