goss-org / goss

Quick and Easy server testing/validation
https://goss.rocks
Apache License 2.0
5.58k stars 470 forks source link

Command exec - multiple command in a single yaml file #798

Closed Raghuchn closed 1 year ago

Raghuchn commented 1 year ago

Hi,

I am trying to execute multiple commands(goss) in a single yaml file, but not successful in it.

When validate, i get only the output for "python" and not for "datetimectl"

#################################################### Output:

Command: version: exit-status: matches expectation: [0] Command: version: stdout: matches expectation: [Python 3.8.13]

#######################################################

Can someone suggest what am i doing wrong here.

command:
  version:
    exit-status: 0
    exec: timedatectl
    stdout:
     - "NTP service: active"
    stderr: []
    exec: python --version
    stdout:
     - "Python 3.8.13"
    stderr: []

Thanks in Advance!!

ripienaar commented 1 year ago

You need to make 2 command blocks for this

command:
  python --version:
    stdout:
    - 'Python 3.8.13'
  timedatectl:
    exit-status: 0
    stdout:
    - 'NTP service: active'
Raghuchn commented 1 year ago
command:
  python --version:
    stdout:
    - 'Python 3.8.13'
  timedatectl:
    exit-status: 0
    stdout:
    - 'NTP service: active'

It works now. Thanks you for the quick response. Really appreciate it!!!

Raghuchn commented 1 year ago

It works now. Thanks you for the quick response. Really appreciate it!!!