Skip to content

Commit d120c49

Browse files
committed
Add test case for arm64 release asset.
1 parent 50b7ca5 commit d120c49

File tree

2 files changed

+164
-0
lines changed

2 files changed

+164
-0
lines changed

modules/runner-binaries-syncer/lambdas/runner-binaries-syncer/src/syncer/handler.test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { handle } from './handler';
22
import latestReleases from '../../test/resources/github-latest-releases.json';
33
import latestReleasesEmpty from '../../test/resources/github-latest-releases-empty.json';
44
import latestReleasesNoLinux from '../../test/resources/github-latest-releases-no-linux.json';
5+
import latestReleasesNoArm64 from '../../test/resources/github-latest-releases-no-arm64.json';
56

67
const mockOctokit = {
78
repos: {
@@ -151,3 +152,20 @@ describe('Invalid config', () => {
151152
await expect(handle()).rejects.toThrow(errorMessage);
152153
});
153154
});
155+
156+
describe('Synchronize action distribution for arm64.', () => {
157+
const errorMessage = 'Cannot find GitHub release asset.';
158+
beforeEach(() => {
159+
process.env.S3_BUCKET_NAME = bucketName;
160+
process.env.S3_OBJECT_KEY = bucketObjectKey;
161+
process.env.GITHUB_RUNNER_ARCHITECTURE = 'arm64';
162+
});
163+
164+
it('No linux arm64 asset.', async () => {
165+
mockOctokit.repos.getLatestRelease.mockImplementation(() => ({
166+
data: latestReleasesNoArm64.data,
167+
}));
168+
169+
await expect(handle()).rejects.toThrow(errorMessage);
170+
});
171+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
{
2+
"status": 200,
3+
"url": "https://api.github.com/repos/actions/runner/releases/latest",
4+
"data": {
5+
"tag_name": "v2.262.1",
6+
"name": "v2.262.1",
7+
"assets": [
8+
{
9+
"url": "https://api.github.com/repos/actions/runner/releases/assets/20667279",
10+
"id": 20667279,
11+
"node_id": "MDEyOlJlbGVhc2VBc3NldDIwNjY3Mjc5",
12+
"name": "actions-runner-linux-arm-2.262.1.tar.gz",
13+
"label": "",
14+
"uploader": {
15+
"login": "github-actions[bot]",
16+
"id": 41898282,
17+
"node_id": "MDM6Qm90NDE4OTgyODI=",
18+
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
19+
"gravatar_id": "",
20+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
21+
"html_url": "https://github.com/apps/github-actions",
22+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
23+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
24+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
25+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
26+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
27+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
28+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
29+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
30+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
31+
"type": "Bot",
32+
"site_admin": false
33+
},
34+
"content_type": "application/octet-stream",
35+
"state": "uploaded",
36+
"size": 56141391,
37+
"download_count": 89,
38+
"created_at": "2020-05-12T20:31:04Z",
39+
"updated_at": "2020-05-12T20:31:05Z",
40+
"browser_download_url": "https://github.com/actions/runner/releases/download/v2.262.1/actions-runner-linux-arm-2.262.1.tar.gz"
41+
},
42+
{
43+
"url": "https://api.github.com/repos/actions/runner/releases/assets/20667270",
44+
"id": 20667270,
45+
"node_id": "MDEyOlJlbGVhc2VBc3NldDIwNjY3Mjcw",
46+
"name": "actions-runner-linux-x64-2.262.1.tar.gz",
47+
"label": "",
48+
"uploader": {
49+
"login": "github-actions[bot]",
50+
"id": 41898282,
51+
"node_id": "MDM6Qm90NDE4OTgyODI=",
52+
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
53+
"gravatar_id": "",
54+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
55+
"html_url": "https://github.com/apps/github-actions",
56+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
57+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
58+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
59+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
60+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
61+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
62+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
63+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
64+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
65+
"type": "Bot",
66+
"site_admin": false
67+
},
68+
"content_type": "application/octet-stream",
69+
"state": "uploaded",
70+
"size": 75512630,
71+
"download_count": 4945,
72+
"created_at": "2020-05-12T20:30:45Z",
73+
"updated_at": "2020-05-12T20:30:53Z",
74+
"browser_download_url": "https://github.com/actions/runner/releases/download/v2.262.1/actions-runner-linux-x64-2.262.1.tar.gz"
75+
},
76+
{
77+
"url": "https://api.github.com/repos/actions/runner/releases/assets/20667275",
78+
"id": 20667275,
79+
"node_id": "MDEyOlJlbGVhc2VBc3NldDIwNjY3Mjc1",
80+
"name": "actions-runner-osx-x64-2.262.1.tar.gz",
81+
"label": "",
82+
"uploader": {
83+
"login": "github-actions[bot]",
84+
"id": 41898282,
85+
"node_id": "MDM6Qm90NDE4OTgyODI=",
86+
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
87+
"gravatar_id": "",
88+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
89+
"html_url": "https://github.com/apps/github-actions",
90+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
91+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
92+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
93+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
94+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
95+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
96+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
97+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
98+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
99+
"type": "Bot",
100+
"site_admin": false
101+
},
102+
"content_type": "application/octet-stream",
103+
"state": "uploaded",
104+
"size": 52602524,
105+
"download_count": 649,
106+
"created_at": "2020-05-12T20:30:53Z",
107+
"updated_at": "2020-05-12T20:31:03Z",
108+
"browser_download_url": "https://github.com/actions/runner/releases/download/v2.262.1/actions-runner-osx-x64-2.262.1.tar.gz"
109+
},
110+
{
111+
"url": "https://api.github.com/repos/actions/runner/releases/assets/20667267",
112+
"id": 20667267,
113+
"node_id": "MDEyOlJlbGVhc2VBc3NldDIwNjY3MjY3",
114+
"name": "actions-runner-win-x64-2.262.1.zip",
115+
"label": "",
116+
"uploader": {
117+
"login": "github-actions[bot]",
118+
"id": 41898282,
119+
"node_id": "MDM6Qm90NDE4OTgyODI=",
120+
"avatar_url": "https://avatars2.githubusercontent.com/in/15368?v=4",
121+
"gravatar_id": "",
122+
"url": "https://api.github.com/users/github-actions%5Bbot%5D",
123+
"html_url": "https://github.com/apps/github-actions",
124+
"followers_url": "https://api.github.com/users/github-actions%5Bbot%5D/followers",
125+
"following_url": "https://api.github.com/users/github-actions%5Bbot%5D/following{/other_user}",
126+
"gists_url": "https://api.github.com/users/github-actions%5Bbot%5D/gists{/gist_id}",
127+
"starred_url": "https://api.github.com/users/github-actions%5Bbot%5D/starred{/owner}{/repo}",
128+
"subscriptions_url": "https://api.github.com/users/github-actions%5Bbot%5D/subscriptions",
129+
"organizations_url": "https://api.github.com/users/github-actions%5Bbot%5D/orgs",
130+
"repos_url": "https://api.github.com/users/github-actions%5Bbot%5D/repos",
131+
"events_url": "https://api.github.com/users/github-actions%5Bbot%5D/events{/privacy}",
132+
"received_events_url": "https://api.github.com/users/github-actions%5Bbot%5D/received_events",
133+
"type": "Bot",
134+
"site_admin": false
135+
},
136+
"content_type": "application/octet-stream",
137+
"state": "uploaded",
138+
"size": 46812907,
139+
"download_count": 674,
140+
"created_at": "2020-05-12T20:30:42Z",
141+
"updated_at": "2020-05-12T20:30:44Z",
142+
"browser_download_url": "https://github.com/actions/runner/releases/download/v2.262.1/actions-runner-win-x64-2.262.1.zip"
143+
}
144+
]
145+
}
146+
}

0 commit comments

Comments
 (0)