venom icon indicating copy to clipboard operation
venom copied to clipboard

`result.systemout` is wrongly handled if it contains `---`

Open lowlighter opened this issue 5 months ago • 2 comments

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: https://github.com/ovh/venom/blob/d9db4cde2bb6c797df387eeae86ac2ee2dbe695c/types_executor.go#L280-L283

Possible to fix this ?

lowlighter avatar May 02 '25 21:05 lowlighter