Skip to content

Commit dd15544

Browse files
cfergeaupraveenkumar
authored andcommitted
start_test: Add fallback when shell cannot be detected
Running `make check` as part of `rpmbuild` inside a container causes shell.GetShell("") to fail, and thus `start_test` fails as well. This commit adds an OS dependant fallback when the shell cannot be detected while running the test case.
1 parent 6956b8f commit dd15544

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

cmd/crc/cmd/start_test.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,15 @@ func TestRenderActionPlainSuccess(t *testing.T) {
3434
},
3535
}, out, ""))
3636

37+
var userShell string
3738
userShell, err := shell.GetShell("")
39+
if err != nil {
40+
if runtime.GOOS == "windows" {
41+
userShell, err = shell.GetShell("cmd")
42+
} else {
43+
userShell, err = shell.GetShell("bash")
44+
}
45+
}
3846
assert.NoError(t, err)
3947
assert.Equal(t, expectedTemplate(userShell), out.String())
4048
}

0 commit comments

Comments
 (0)