Skip to content

result.systemout is wrongly handled if it contains --- #847

@lowlighter

Description

@lowlighter

I have the following simple test case (which uses a custom executor)

    - name: ping vrack to vm
      type: docker-exec
      container_name: vrack-vm-on-trunk 
      command: ping -c 4 -w 3 {{ .vracktestip }}

Which dies because it tries to convert YAML

 		• ping vrack to vm FAIL
 		  Testcase "", step #3-0: unable to unmarshal: error converting YAML to JSON: yaml: line 3: found unexpected document indicator (41-vrack-config.yaml:34)
 		  Testcase "", step #3-0: At least one required assertion failed, skipping remaining steps (41-vrack-config.yaml:34)

I'm pretty sure this is because the output of ping command has --- (yaml document separator). If i send to /dev/null then it works again

{
 "result": {
  "systemout": "PING 192.168.11.1 (192.168.11.1) 56(84) bytes of data.\n\n--- 192.168.11.1 ping statistics ---\n3 packets transmitted, 0 received, 100% packet loss, time 2030ms",
  "code": "1",
  "timeseconds": 3.057590418
 }
}

Seems to comes from:

venom/types_executor.go

Lines 280 to 283 in d9db4cd

var outputResult interface{}
if err := yaml.Unmarshal([]byte(outputS), &outputResult); err != nil {
return nil, errors.Wrapf(err, "unable to unmarshal")
}

Possible to fix this ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions