Skip to content

Commit d85681c

Browse files
committed
fix: test asset file name
1 parent f8d34a1 commit d85681c

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//go:build darwin
2+
3+
package agent
4+
5+
const testAssetFileName = "agent.mac-os.bin"
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//go:build linux
2+
3+
package agent
4+
5+
const testAssetFileName = "agent.linux.bin"

internal/agent/updater_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ func TestCheck_Success(t *testing.T) {
3939
release := Release{
4040
Id: 1,
4141
TagName: "v2.0.0",
42-
Assets: []Asset{{Id: 1, Name: "agent.win.exe", Url: "http://example.com"}},
42+
Assets: []Asset{{Id: 1, Name: testAssetFileName, Url: "http://example.com"}},
4343
}
4444

4545
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -523,7 +523,7 @@ func TestRun_FullUpdateFlow(t *testing.T) {
523523
// Serve the release check endpoint
524524
release := Release{
525525
TagName: "v99.0.0",
526-
Assets: []Asset{{Id: 1, Name: "agent.win.exe", Url: "PLACEHOLDER"}},
526+
Assets: []Asset{{Id: 1, Name: testAssetFileName, Url: "PLACEHOLDER"}},
527527
}
528528

529529
// Serve the binary download endpoint
@@ -588,7 +588,7 @@ func TestRun_DownloadError(t *testing.T) {
588588
// Use an unreachable URL so the HTTP request fails
589589
release := Release{
590590
TagName: "v99.0.0",
591-
Assets: []Asset{{Id: 1, Name: "agent.win.exe", Url: "http://invalid.invalid.invalid"}},
591+
Assets: []Asset{{Id: 1, Name: testAssetFileName, Url: "http://invalid.invalid.invalid"}},
592592
}
593593

594594
releaseServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
@@ -619,7 +619,7 @@ func TestRun_UpdateCommandError(t *testing.T) {
619619

620620
release := Release{
621621
TagName: "v99.0.0",
622-
Assets: []Asset{{Id: 1, Name: "agent.win.exe", Url: downloadServer.URL}},
622+
Assets: []Asset{{Id: 1, Name: testAssetFileName, Url: downloadServer.URL}},
623623
}
624624

625625
releaseServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//go:build windows
2+
3+
package agent
4+
5+
const testAssetFileName = "agent.win.exe"

0 commit comments

Comments
 (0)