Skip to content

Commit 15fa2a9

Browse files
caarlos0Copilot
andauthored
test: cover install across release eras (#555)
Add install tests pinned to versions that exercise every release era so we don't regress the graceful-skip path for releases that pre-date the cosign v3 sigstore bundle: - v0.182.0 pre-checksums-signing - v1.26.2 cosign v2 detached .sig only - v2.12.4 last release before sigstore bundles - v2.13.0 first release with sigstore bundle (minimum verifiable) - v2.15.3 recent release with sigstore bundle Plus an explicit verifyChecksum integration test that installs v2.12.4 with cosign in PATH to confirm the cosign step is skipped (not failed) when the sigstore bundle is absent. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent e24998b commit 15fa2a9

1 file changed

Lines changed: 35 additions & 0 deletions

File tree

__tests__/goreleaser.test.ts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,38 @@ describe('install', () => {
1616
expect(fs.existsSync(bin)).toBe(true);
1717
}, 100000);
1818

19+
// The following pinned versions exercise install across release eras to
20+
// guard against regressions in checksum handling and the cosign skip path:
21+
// - v0.182.0 : pre-checksums-signing era
22+
// - v1.26.2 : cosign v2 detached `.sig` only
23+
// - v2.12.4 : last release before sigstore bundles (cosign skipped)
24+
// - v2.13.0 : first release with cosign v3 sigstore bundle
25+
// - v2.15.3 : recent release with sigstore bundle
26+
it('acquires v0.182.0 (pre-signing) version of GoReleaser', async () => {
27+
const bin = await goreleaser.install('goreleaser', 'v0.182.0');
28+
expect(fs.existsSync(bin)).toBe(true);
29+
}, 100000);
30+
31+
it('acquires v1.26.2 (cosign v2 .sig) version of GoReleaser', async () => {
32+
const bin = await goreleaser.install('goreleaser', 'v1.26.2');
33+
expect(fs.existsSync(bin)).toBe(true);
34+
}, 100000);
35+
36+
it('acquires v2.12.4 (last pre-sigstore-bundle) version of GoReleaser', async () => {
37+
const bin = await goreleaser.install('goreleaser', 'v2.12.4');
38+
expect(fs.existsSync(bin)).toBe(true);
39+
}, 100000);
40+
1941
it('acquires v2.13.0 (minimum cosign-verifiable) version of GoReleaser', async () => {
2042
const bin = await goreleaser.install('goreleaser', 'v2.13.0');
2143
expect(fs.existsSync(bin)).toBe(true);
2244
}, 100000);
2345

46+
it('acquires v2.15.3 (recent sigstore-bundle) version of GoReleaser', async () => {
47+
const bin = await goreleaser.install('goreleaser', 'v2.15.3');
48+
expect(fs.existsSync(bin)).toBe(true);
49+
}, 100000);
50+
2451
it('acquires latest v2 version of GoReleaser Pro', async () => {
2552
const bin = await goreleaser.install('goreleaser-pro', '~> v2');
2653
expect(fs.existsSync(bin)).toBe(true);
@@ -112,6 +139,14 @@ describe('verifyChecksum', () => {
112139
expect(fs.existsSync(bin)).toBe(true);
113140
}, 120000);
114141

142+
it('installs a pre-v2.13 release (no sigstore bundle) without failing when cosign is present', async () => {
143+
// v2.12.x is the last release that did NOT publish checksums.txt.sigstore.json.
144+
// The action must still install it cleanly: checksum verified, cosign step skipped.
145+
await requireCosign();
146+
const bin = await goreleaser.install('goreleaser', 'v2.12.4');
147+
expect(fs.existsSync(bin)).toBe(true);
148+
}, 120000);
149+
115150
it('throws on checksum mismatch', async () => {
116151
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'gha-'));
117152
const archive = path.join(dir, 'fake.tar.gz');

0 commit comments

Comments
 (0)