mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2024-06-06 07:29:39 +00:00
fix test
This commit is contained in:
parent
0b3c3a4299
commit
e506db203f
|
@ -12,16 +12,14 @@ const (
|
|||
)
|
||||
|
||||
func TestGenerateContainerConf(t *testing.T) {
|
||||
gotEnv, gotEntry, gotCmd := GenerateContainerConf([]string{"echo hello world"}, "windows")
|
||||
gotEnv, gotEntry := GenerateContainerConf([]string{"echo hello world"}, "windows")
|
||||
assert.Equal(t, windowsScriptBase64, gotEnv["CI_SCRIPT"])
|
||||
assert.Equal(t, "c:\\root", gotEnv["HOME"])
|
||||
assert.Equal(t, "powershell.exe", gotEnv["SHELL"])
|
||||
assert.Equal(t, []string{"powershell", "-noprofile", "-noninteractive", "-command"}, gotEntry)
|
||||
assert.Equal(t, "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Env:CI_SCRIPT)) | iex", gotCmd)
|
||||
gotEnv, gotEntry, gotCmd = GenerateContainerConf([]string{"echo hello world"}, "linux")
|
||||
assert.Equal(t, []string{"powershell", "-noprofile", "-noninteractive", "-command", "[System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Env:CI_SCRIPT)) | iex"}, gotEntry)
|
||||
gotEnv, gotEntry = GenerateContainerConf([]string{"echo hello world"}, "linux")
|
||||
assert.Equal(t, posixScriptBase64, gotEnv["CI_SCRIPT"])
|
||||
assert.Equal(t, "/root", gotEnv["HOME"])
|
||||
assert.Equal(t, "/bin/sh", gotEnv["SHELL"])
|
||||
assert.Equal(t, []string{"/bin/sh", "-c"}, gotEntry)
|
||||
assert.Equal(t, "echo $CI_SCRIPT | base64 -d | /bin/sh -e", gotCmd)
|
||||
assert.Equal(t, []string{"/bin/sh", "-c", "echo $CI_SCRIPT | base64 -d | /bin/sh -e"}, gotEntry)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue