Skip to content

Commit 6f32584

Browse files
committed
test(selfupdate): make executable-bit assertion Unix-only
Windows file modes don't carry a Unix executable bit, so the TestDownloadVerifyExtract perm check failed on windows-latest CI. The runner only ever self-updates on systemd-Linux; guard the assertion with runtime.GOOS so the (still meaningful) download/verify/extract coverage runs on every platform while the Unix-only bit check is skipped on Windows.
1 parent 926d311 commit 6f32584

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

selfupdate/update_test.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"net/http/httptest"
1212
"os"
1313
"path/filepath"
14+
"runtime"
1415
"testing"
1516

1617
"github.com/flashcatcloud/flashduty-runner/protocol"
@@ -71,9 +72,13 @@ func TestDownloadVerifyExtract(t *testing.T) {
7172
if string(got) != string(binBytes) {
7273
t.Fatal("extracted bytes mismatch")
7374
}
74-
fi, _ := os.Stat(dest)
75-
if fi.Mode().Perm()&0o100 == 0 {
76-
t.Fatal("expected executable bit")
75+
// Windows file modes don't carry a Unix executable bit, and the runner only
76+
// ever self-updates on systemd-Linux — so this is a Unix-only assertion.
77+
if runtime.GOOS != "windows" {
78+
fi, _ := os.Stat(dest)
79+
if fi.Mode().Perm()&0o100 == 0 {
80+
t.Fatal("expected executable bit")
81+
}
7782
}
7883

7984
// bad checksum

0 commit comments

Comments
 (0)