0

I have a inspec test as shown below

describe command('mvn -version) do
  its('exit_status') {should eq 0 }
end

on running the test case is failing as exit status after running the command on the machine is coming 127. But I can confirm that maven is installed on the machine and when I test exit status manually on the machine , it's 0

coderanger
  • 52,400
  • 4
  • 52
  • 75
thinkingmonster
  • 5,063
  • 8
  • 35
  • 57
  • Try adding tests for the `stdout` and `stderr`, you can just check `eq ''`. That will show you the command output, which will probably tell you more about why it is failing. Might be a missing `$JAVA_HOME` or similar since InSpec commands don't get some shell init variables. – coderanger Feb 05 '18 at 10:50
  • I used stderr at least come to identify the error it was due to command not found. But I can run the command on the machine and maven is also added to the path doi need to provide absolute paths. – thinkingmonster Feb 05 '18 at 11:06
  • Depends on how your environment variables are set, but abs paths for anything not in /usr/bin or similar would probably be wise :) – coderanger Feb 05 '18 at 11:37
  • thanks my issue is resolved now.Used absolute paths. – thinkingmonster Feb 06 '18 at 02:55

0 Answers0