-
Notifications
You must be signed in to change notification settings - Fork 471
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In 0.3.14, command assertions that wrap powershell can no longer assert against stdout/stderr successfully #651
In 0.3.14, command assertions that wrap powershell can no longer assert against stdout/stderr successfully #651
Conversation
In 0.3.14, my command assertions that used powershell.exe to run powershell started to fail, and I suspect the new cmd /c wrapping, so I'm adding an integration test first, then if that fails I'll try to make changes to allow it to pass - I'm expecting to want to make it possible to use powershell as the shell within command assertions to achieve that.
wrap a powershell - expect 1: | ||
exec: powershell -noprofile -noninteractive -command "(get-itemproperty -path 'HKLM:/SYSTEM/CurrentControlSet/Control/Lsa/').restrictanonymous" | ||
exit-status: 0 | ||
stdout: | ||
- 1 | ||
stderr: [] | ||
timeout: 10000 | ||
wrap a powershell - expect 0: | ||
exec: powershell -noprofile -noninteractive -command "(get-itemproperty -path 'HKLM:/SYSTEM/CurrentControlSet/Control/Lsa/').restrictanonymous" | ||
exit-status: 0 | ||
stdout: | ||
- 0 | ||
stderr: [] | ||
timeout: 10000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are two tests because I don't know how Travis secures their build machines; one of these should pass, though, based on 0.3.13
behaviour.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense :-)
I gave some thought to making the command either be powershell or cmd but did some basic testing and found I could invoke powershell from the cmd wrapping. Maybe we can revisit this if necessary. I think in this case, it is the way the quotes are processed. I removed the quotes: command:
Anonymous logins are disabled:
exit-status: 0
exec: powershell -noprofile -noninteractive -command (get-itemproperty -path 'HKLM:/SYSTEM/CurrentControlSet/Control/Lsa/').restrictanonymous
stdout:
- '1'
timeout: 10000 # in milliseconds
skip: false and it passed:
I had to remove some quotes from the commands in #633 as well. Maybe there is something we can do to process the quotes properly? |
@jsturtevant thank you! That allows me to work around this very handily. |
@@ -7,3 +7,17 @@ command: | |||
- hello world | |||
stderr: [] | |||
timeout: 10000 | |||
wrap a powershell - expect 1: | |||
exec: powershell -noprofile -noninteractive -command (get-itemproperty -path 'HKLM:/SYSTEM/CurrentControlSet/Control/Lsa/').restrictanonymous |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this command fails:
wrap a powershell - expect 1: stdout: patterns not found: [1]
Are both of these examples needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, definitely not; I added both because I have no idea what the expected value should be within Travis. Adding both was reconnaissance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
makes sense :-)
Always love more tests! LGTM |
Appreciate the discussion here and the added test coverage. Many thanks to both of you for the continued support of windows on goss. Given that this was non-intuitive initially for @petemounce is there an opportunity to improve the documentation here for goss windows users? |
Another question for you both. How stable is windows binary at this point? Should we consider renaming the "alpha" to "community" or is it (and Mac) not ready for that yet? |
In terms of stability, we haven't noticed anything obviously non-functional or non-performant. We've had 0.3.14 in production since a week after it was released, on Windows and macOS in addition to Linux. There is a change I may want to do around how Windows process priorities are handled - we discovered that goss doesn't inherit onto sub-processes the That's something we'll probably look at soonish, but not immediately. I don't think that needs to block renaming "alpha" to "community"; the integration-test coverage for both platforms is reasonably encompassing. |
re: docs - I'm not sure. I'm actually still not sure why this was a fix or a quoting issue, really. |
Cool, mostly asking because I'm trying to get v4 out by end of dec or early Jan. Hoping to rename mac and windows as part of that release. |
As discussed in goss-org#663 (comment); strip the -alpha naming, keep the messaging, keep the --use-alpha flag and env-var. This allows people to remove edge-cases from their installation, yet retains the clearly-set expectations of support being community-driven. Fixes goss-org#651.
As discussed in goss-org#663 (comment); strip the -alpha naming, keep the messaging, keep the --use-alpha flag and env-var. This allows people to remove edge-cases from their installation, yet retains the clearly-set expectations of support being community-driven. Fixes goss-org#651.
* Rename binaries to strip '-alpha' As discussed in #663 (comment); strip the -alpha naming, keep the messaging, keep the --use-alpha flag and env-var. This allows people to remove edge-cases from their installation, yet retains the clearly-set expectations of support being community-driven. Fixes #651. * set expectations for future-us re: macOS+Windows vs linux * fix doc
@aelsabbahy just wanted to let you know we are now using this in image-builder as part for cluster api: kubernetes-sigs/image-builder#563 Thanks for all your hard work! |
@jsturtevant that's great! Thanks for circling back and saying so, that's given me a warm fuzzy feeling :) |
* Migrate from go-ps to gopsutil for better process detection (#597) * Migrate from go-ps to gopsutil for better process detection * Remove debugging code * Mount (#601) * Add stale.yml config * Change stale.yml label * Add VfsOpts to mount * Use mountinfo filter * Fix build failures * Normalize seliux mount options for integration testing * Attempt to normalize tests across docker installs and fix osx test setup * Try different osx image * Rename binaries to strip '-alpha' (#671) * Rename binaries to strip '-alpha' As discussed in #663 (comment); strip the -alpha naming, keep the messaging, keep the --use-alpha flag and env-var. This allows people to remove edge-cases from their installation, yet retains the clearly-set expectations of support being community-driven. Fixes #651. * set expectations for future-us re: macOS+Windows vs linux * fix doc * F openrc runlevels (#668) * service: Add support for OpenRC runlevels * Omit empty runlevel * Update documentation * Update integration tests * Use consistent pattern for configu default values - Remove struct tag `default` value reflection * Make runLevels a testable attribute * empty commit to try to trigger travis * Update trusty to reflect precise changes Co-authored-by: Berney <berne.campbell@gmail.com> * POC/DRAFT: Add transforms (#576) * Add transforms * wip add transforms work * Add some examples to make sense of this * Handle floats/ints better * Convert validatecontails to gomega * wip * Add gjson and contain-substring * wip * Subclass all matchers adding String() * I don't evne know what this is.. should have checked it in back when I wrote it * Migrate GomegaMatcher -> GossMatcher * lots of changes + drop json-iterator * Move output related logic to outputs * Add include_raw flag * Add bench output format * Update have_patterns to check input. Add stubs to make Not matcher act as omegaMatcher * SetEscapeHTML(false) for semver constraint * Ensure have-Key_with_value works * remove have-key-with-value * Fix error compact output. Add oMegaMatcher stubs. Ensure matcher vs m consistent * Cleanup matchers * Cleanup TestResult struct and remove need for dyno * Update all deps * Update tranformer tests and add summary line to bench output format * Update readme * Conditionally print missing and empty values. Sanitize found and expected values for consistency * Check value is valid before checking IsNil() * Initial docs change * WIP fix for pretty print * Swap order on video vs blog for dgoss docs * Updated all tests except for semver * Fix all unit tests * Fix detection of when matcher is set * Update documentation * Update docs/manual.md Co-authored-by: Peter Mounce <pete@neverrunwithscissors.com> * Update docs/manual.md Co-authored-by: Peter Mounce <pete@neverrunwithscissors.com> * gjson: Validate json before doing gets * Make errors more clear * Remove unused field * Bump go version * Update doc * Fix regression with gomega errors * Fix #262 no need to add file size by default * Fix output formats * Use proper quoting for windows test * Add error checking for gjson path not found Co-authored-by: Peter Mounce <pete@neverrunwithscissors.com> * Fix mountinfo splitting when there's a quoted comma * Improve have_patterns error message * Add syntax checks for type casting * Rename file.contains to file.contents * ToString converter add suppert for []interface{} * Convert headers to lowercase. fixes #760 * Fix contains -> contents, lowercase headers and contain-element float64 * Enhance all resources to support key override closes #518, closes #742 * Sort output in documentation format closes #416 * Fix typo in contain_element message * Track start and end times per-test This also changes the way total time is calculated in the output summary. total time = endTime of last test - start time of first test * Cache test results in serve instead of output closes #612 * Use exit code 78 if test file is unparseable closes #317 * Full EVR for rpm and fix failing tests * more tests * Increase test coverage * Fixed numeric eq bug * Make output more consistent * Update dependencies * Fix some merge conflicts * Revert "Migrate from go-ps to gopsutil for better process detection (#597)" This reverts commit 85ce2c8. * Revert 1fe5571 change http.headers back to io.Reader * FIX: use filepath.Join() in order to be OS agnostic * FIX: only run matcher_tests on linux * FIX: replace failing www.microsoft.com test * FIX: trusty dockerfile merge regression * Run all tests (except failing prometheus) as part of CI. Seems they were not running * Remove bench output, add some comments * Changed: include_raw by default, provide exclude_raw as a format flag * Changed: go-funk -> lo * Changed: temp fix to deal with httpbin.org slowness. Need to move to offline testing to avoid flakiness * Locking down version in install.sh, to avoid RC being installed --------- Co-authored-by: Peter Mounce <petermounce@improbable.io> Co-authored-by: Berney <berne.campbell@gmail.com> Co-authored-by: Peter Mounce <pete@neverrunwithscissors.com>
Edit: Problem In Chair, Not In Computer on my part
see comment thread. Thanks @jsturtevant.
This is now a PR to add an integration test that illustrates how to assert via
command
usingpowershell
Original content of PR description:
Assertion that fails in
0.3.14
that passed in0.3.13
:0.3.13 passes
0.3.14 fails
(Note goss.exe being referenced via
./
rather than taking the 0.3.13 as on PATH)Checklist
make test-all
(UNIX) passes. CI will also test thisDescription of change
In 0.3.14, my command assertions that used powershell.exe to run powershell started to fail, and I suspect the new cmd /c wrapping, so I'm adding an integration test first. This also happens to be how I'm using goss to assert against the windows registry (note #616).
If this integration test fails I'll try to make changes to allow it to pass - I'm expecting to want to make it possible to use powershell as the shell within command assertions to achieve that.
cc @jsturtevant in case you'd like to take a stab at this?