test: Add tests for hostAgentSearchCandidates parameter variants
Tests all code paths: strict mode (both params), platform only, and no params (generic paths).
This commit is contained in:
parent
7407447bbf
commit
02419827b6
1 changed files with 40 additions and 0 deletions
|
|
@ -804,3 +804,43 @@ func TestCapturePublicURLFromRequest_NilInputs(t *testing.T) {
|
|||
r.capturePublicURLFromRequest(req)
|
||||
})
|
||||
}
|
||||
|
||||
func TestHostAgentSearchCandidates(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
platform string
|
||||
arch string
|
||||
wantLen int // expected number of search paths
|
||||
}{
|
||||
{
|
||||
name: "strict mode with both params",
|
||||
platform: "linux",
|
||||
arch: "amd64",
|
||||
wantLen: 3, // 3 paths with platform-arch suffix
|
||||
},
|
||||
{
|
||||
name: "platform only, no arch",
|
||||
platform: "linux",
|
||||
arch: "",
|
||||
wantLen: 3, // 3 paths with platform suffix only
|
||||
},
|
||||
{
|
||||
name: "no params returns generic paths",
|
||||
platform: "",
|
||||
arch: "",
|
||||
wantLen: 3, // 3 generic paths
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
paths := hostAgentSearchCandidates(tt.platform, tt.arch)
|
||||
if len(paths) != tt.wantLen {
|
||||
t.Errorf("hostAgentSearchCandidates(%q, %q) returned %d paths, want %d",
|
||||
tt.platform, tt.arch, len(paths), tt.wantLen)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue