Closed kameshsampath closed 4 years ago
That's because it goes to stderr
instead.
Addendum: java -version 2>/dev/null
should print nothing.
@elliotweiser - if that goes to stderr
then my condition of stderr: [] should fail as well right? any workaorund .. redirecting it to stdout?
No it should not. That []
is a list of patterns to search for. Technically, it has found all patterns in that list, or rather none of them failed 😉 . When I've tested for java -version
in my docker images, I switch the output check to be in stderr
instead and leave stdout
empty (i.e. []
). That is the normal behavior.
ah! ha! i see now when I swapped stdout with stderr i see its working :) thanks.. btw is there way to see the logs of goss while running -v10
kind of stuff ?
Not sure I follow you. I have no idea what -v10
is.
Not sure I follow you. I have no idea what -v10 is. I mean to say if there is any verbose logging that we can turn on during test runs - to debug test failures, it was very strange until now that I knew java -verison is redirecting to stderr
Currently there isn't. One work around is to use tee
to capture output into a file.
Aha I get it. -v10
== -vvvvvvvvvvv
(maximum verbosity!)
Personally, I thought the choice to send that output to stderr was kind of silly, or at least atypical.
You can play with the different types of --format
options, but I don't think that would have told you what was wrong in this case.
For next time, if you're confused by the results you're getting from stdout vs stderr in these tests, try breaking it apart so you can see exactly which lines go where. Just running java -version
on the command line and seeing the output doesn't tell you all that much.
java -version 1> java_version_stdout.txt
(empty file)java -version 2> java_version_stderr.txt
(shows the strings you're looking for)This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Hi,
I wrote a very simple dgoss test to test the JDK version of the docker image I have built.
from my container
java -version
returnsI am trying to have simple command check
goss.yml
The package test passes with version while the java -version fails saying its not able to find the string 1.8.0_144, as noticed from the java command above the 1.8.0_144 is available as part of stdout.
test.sh