report stdout/stderr on failure
This commit is contained in:
Родитель
f21ef819c1
Коммит
69291b8b76
|
@ -64,6 +64,19 @@ teardown(){
|
|||
echo "status_file=$status_file"; [[ "$status_file" = *'Enable succeeded: \n[stdout]\nHelloStdout\n\n[stderr]\nHelloStderr\n'* ]]
|
||||
}
|
||||
|
||||
@test "handler command: enable - captures stdout/stderr into .status on error" {
|
||||
mk_container sh -c "fake-waagent install && fake-waagent enable && wait-for-enable"
|
||||
push_settings '
|
||||
{
|
||||
"commandToExecute": "ls /does-not-exist"
|
||||
}' ''
|
||||
run start_container
|
||||
echo "$output"
|
||||
|
||||
status_file="$(container_read_file /var/lib/waagent/Extension/status/0.status)"
|
||||
echo "status_file=$status_file"; [[ "$status_file" = *'Enable failed: failed to execute command: command terminated with exit status=2\n[stdout]\n\n[stderr]\nls: cannot access'* ]]
|
||||
}
|
||||
|
||||
@test "handler command: enable - doesn't process the same sequence number again" {
|
||||
mk_container sh -c \
|
||||
"fake-waagent install && fake-waagent enable && wait-for-enable && fake-waagent enable && wait-for-enable"
|
||||
|
|
|
@ -60,7 +60,7 @@ func main() {
|
|||
msg, err := cmd.f(ctx, hEnv, seqNum)
|
||||
if err != nil {
|
||||
ctx.Log("event", "failed to handle", "error", err)
|
||||
reportStatus(ctx, hEnv, seqNum, status.StatusError, cmd, err.Error())
|
||||
reportStatus(ctx, hEnv, seqNum, status.StatusError, cmd, err.Error()+msg)
|
||||
os.Exit(1)
|
||||
}
|
||||
reportStatus(ctx, hEnv, seqNum, status.StatusSuccess, cmd, msg)
|
||||
|
|
Загрузка…
Ссылка в новой задаче