Skip to content

Commit a3c586c

Browse files
Dumbrisclaude
andcommitted
test(distribution): make install-channel and installer tests OS-independent
TestResolveInstallChannel_Precedence used literal '/' marker keys while the resolver joins with the OS separator, and the installer contract compared CRLF text on Windows checkouts. Both failed only on windows-latest. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
1 parent a8ed540 commit a3c586c

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

‎cmd/release-gate/distribution_workflow_test.go‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ func TestWindowsPackagesWorkflowInvariants(t *testing.T) {
181181

182182
// The Inno script must stay silent-safe and own its channel marker (FR-014).
183183
func TestInstallerChannelMarkerContract(t *testing.T) {
184-
iss := repoFile(t, "scripts", "installer.iss")
184+
// Windows checkouts may convert line endings (.gitattributes); compare LF-normalised.
185+
iss := strings.ReplaceAll(repoFile(t, "scripts", "installer.iss"), "\r\n", "\n")
185186
for _, want := range []string{
186187
"{param:CHANNEL|}", // winget switch
187188
"'winget'", // only this token is ever written

‎internal/telemetry/install_channel_test.go‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package telemetry
22

33
import (
44
"os"
5+
"path/filepath"
56
"strings"
67
"testing"
78
"time"
@@ -84,8 +85,10 @@ func TestInstallChannelEnum_IsClosedAndComplete(t *testing.T) {
8485
}
8586

8687
func TestResolveInstallChannel_Precedence(t *testing.T) {
87-
const exeMarker = "/opt/app/install-channel"
88-
const dataMarker = "/data/install-channel"
88+
// Built with filepath.Join: the resolver joins with the OS separator, so
89+
// literal "/" keys would never match on Windows.
90+
exeMarker := filepath.Join("/opt/app", "install-channel")
91+
dataMarker := filepath.Join("/data", "install-channel")
8992
tests := []struct {
9093
name string
9194
f fakeChannelDeps

‎internal/telemetry/payload_install_channel_test.go‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package telemetry
22

33
import (
44
"encoding/json"
5+
"path/filepath"
56
"strings"
67
"testing"
78
)
@@ -78,8 +79,8 @@ func TestResolveInstallChannel_HostileValuesNeverEscape(t *testing.T) {
7879
dataDir: "/data",
7980
detected: "../../etc/passwd",
8081
files: map[string]string{
81-
"/opt/app/install-channel": `C:\Users\secret`,
82-
"/data/install-channel": strings.Repeat("A", 4096),
82+
filepath.Join("/opt/app", "install-channel"): `C:\Users\secret`,
83+
filepath.Join("/data", "install-channel"): strings.Repeat("A", 4096),
8384
},
8485
}
8586
got := resolveInstallChannel(f.deps())

0 commit comments

Comments
 (0)