Skip to content

Commit

Permalink
run tests under macos-arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
creativeprojects committed Mar 19, 2024
1 parent 03cb6bc commit cc1ba52
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 5 deletions.
10 changes: 5 additions & 5 deletions detect_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func TestDetectReleaseWithVersionPrefix(t *testing.T) {
skipRateLimitExceeded(t, err)
require.NoError(t, err)
assert.True(t, ok, "Failed to detect latest")
assert.NotNil(t, r, "No release returned")
require.NotNil(t, r, "No release returned")
if r.LessThan("0.10.0") {
t.Error("Incorrect version:", r.Version())
}
Expand Down Expand Up @@ -84,7 +84,7 @@ func TestDetectVersionExisting(t *testing.T) {
skipRateLimitExceeded(t, err)
require.NoError(t, err)
assert.Truef(t, ok, "Failed to detect %s", testVersion)
assert.NotNil(t, r, "No release returned")
require.NotNil(t, r, "No release returned")
assert.Greater(t, r.ValidationAssetID, int64(-1))
})
}
Expand Down Expand Up @@ -154,7 +154,7 @@ func TestDetectPrerelease(t *testing.T) {
Prerelease: testFixture.prerelease,
})
r, ok, err := updater.DetectLatest(context.Background(), RepositorySlug{owner: "owner", repo: "repo"})
assert.NotNil(t, r)
require.NotNil(t, r)
assert.True(t, ok)
assert.NoError(t, err)

Expand All @@ -181,7 +181,7 @@ func TestDetectReleasesForVariousArchives(t *testing.T) {

assert.NoError(t, err, "fetch failed")
assert.True(t, ok, "not found")
assert.NotNil(t, r, "release not detected")
require.NotNil(t, r, "release not detected")
assert.Truef(t, r.Equal("1.2.3"), "incorrect release: expected 1.2.3 but got %v", r.Version())

url := fmt.Sprintf("https://github.com/%s/releases/tag/%s1.2.3", tc.slug, tc.prefix)
Expand Down Expand Up @@ -803,7 +803,7 @@ func TestBuildMultistepValidationChain(t *testing.T) {
})

release, found, err := updater.DetectVersion(context.Background(), testGithubRepository, testVersion)
assert.True(t, found)
require.True(t, found)
assert.NoError(t, err)
assert.Equal(t, 2, len(release.ValidationChain))
assert.Equal(t, "checksums.txt", release.ValidationChain[0].ValidationAssetName)
Expand Down
42 changes: 42 additions & 0 deletions mockdata_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
url: "resticprofile_0.1.0_windows_amd64.zip",
size: len(zipData),
},
&GitHubAsset{
id: 31,
name: "resticprofile_0.1.0_darwin_arm64.tar.gz",
url: "resticprofile_0.1.0_darwin_arm64.tar.gz",
size: len(gzData),
},
},
},
&GitHubRelease{
Expand Down Expand Up @@ -76,6 +82,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
url: "resticprofile_0.10.0_windows_amd64.zip",
size: len(zipData),
},
&GitHubAsset{
id: 32,
name: "resticprofile_0.10.0_darwin_arm64.tar.gz",
url: "resticprofile_0.10.0_darwin_arm64.tar.gz",
size: len(gzData),
},
},
},
&GitHubRelease{
Expand Down Expand Up @@ -104,6 +116,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
url: "resticprofile_1.0.0-rc_windows_amd64.zip",
size: len(zipData),
},
&GitHubAsset{
id: 33,
name: "resticprofile_1.0.0-rc_darwin_arm64.tar.gz",
url: "resticprofile_1.0.0-rc_darwin_arm64.tar.gz",
size: len(gzData),
},
},
},
&GitHubRelease{
Expand Down Expand Up @@ -132,6 +150,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
url: "resticprofile_1.0.0_windows_amd64.zip",
size: len(zipData),
},
&GitHubAsset{
id: 34,
name: "resticprofile_1.0.0_darwin_arm64.tar.gz",
url: "resticprofile_1.0.0_darwin_arm64.tar.gz",
size: len(gzData),
},
},
},
&GitHubRelease{
Expand Down Expand Up @@ -160,6 +184,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
url: "resticprofile_2.0.0-beta_windows_amd64.zip",
size: len(zipData),
},
&GitHubAsset{
id: 35,
name: "resticprofile_2.0.0-beta_darwin_arm64.tar.gz",
url: "resticprofile_2.0.0-beta_darwin_arm64.tar.gz",
size: len(gzData),
},
},
},
&GitHubRelease{
Expand Down Expand Up @@ -188,6 +218,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
url: "resticprofile_2.0.0_windows_amd64.zip",
size: len(zipData),
},
&GitHubAsset{
id: 36,
name: "resticprofile_2.0.0_darwin_arm64.tar.gz",
url: "resticprofile_2.0.0_darwin_arm64.tar.gz",
size: len(gzData),
},
},
},
}
Expand All @@ -211,6 +247,12 @@ func mockSourceRepository(t *testing.T) *MockSource {
24: gzData,
25: gzData,
26: zipData,
31: gzData,
32: gzData,
33: gzData,
34: gzData,
35: gzData,
36: gzData,
}

// generates checksum files automatically
Expand Down
7 changes: 7 additions & 0 deletions update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,12 @@ func TestBrokenBinaryUpdate(t *testing.T) {
},
&GitHubAsset{
id: 3,
name: "invalid_v2.0.0_darwin_arm64.tar.gz",
url: "invalid_v2.0.0_darwin_arm64.tar.gz",
size: len("invalid content"),
},
&GitHubAsset{
id: 4,
name: "invalid_v2.0.0_windows_amd64.zip",
url: "invalid_v2.0.0_windows_amd64.zip",
size: len("invalid content"),
Expand All @@ -166,6 +172,7 @@ func TestBrokenBinaryUpdate(t *testing.T) {
1: []byte("invalid content"),
2: []byte("invalid content"),
3: []byte("invalid content"),
4: []byte("invalid content"),
})

updater, err := NewUpdater(Config{Source: source})
Expand Down

0 comments on commit cc1ba52

Please sign in to comment.