-
Notifications
You must be signed in to change notification settings - Fork 44
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
Missing assert_stderr
and similar assertions
#42
Comments
Since this is a relatively recent addition to bats-core, I would be cautious to add a feature that relies on a recent addition. We would need some kind of guard to avoid breaking suites by using the wrong bats version. I also dislike the amount of code duplication that entails. Would prefixing |
I think the proposed workaround is very spot on and indeed works nicely and unblocks here. |
@jbriales @martin-schulze-vireso I'd like to revisit this. I agree there is a viable workaround. However, normally bats tests tend to look very clean and elegant and the workaround is Code duplication could be avoided by implementing this as a flag, say WDYT? |
I agree on I'm not sure about the impl details, but if we went for extending, I'd find having |
I'd Vote for this as well. The existing flag parser in assert_output Just assumes flags it does not know to be the test expectation. This means you will get a somewhat misleading error message in older versions. |
Yeah, |
Because it would refer to a check in a specific line vs checking against the full output, I'd say |
|
Sounds like there is agreement that this should be done (and even how it should be done). Perhaps it could be reopened? :-) |
This needs a directory that's going to be present on the host operating system across various configurations of all supported distributions, such as the hosts running the CI, but not inside the Toolbx containers. It looks like /etc/kernel is present on both Debian and Fedora, but absent from the fedora-toolbox images. On a Debian 10 server, it's owned by several packages: $ dpkg-query --search /etc/kernel dkms, systemd, grub2-common, initramfs-tools, apt: /etc/kernel ... while on Fedora 36 Workstation: $ rpm --file --query /etc/kernel systemd-udev-250.8-1.fc36.x86_64 Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the lines array. [1] bats-core/bats-assert#42 containers#1153
This needs a directory that's going to be present on the host operating system across various configurations of all supported distributions, such as the hosts running the CI, but not inside the Toolbx containers. It looks like /etc/kernel is present on both Debian and Fedora, but absent from the fedora-toolbox images. On a Debian 10 server, it's owned by several packages: $ dpkg-query --search /etc/kernel dkms, systemd, grub2-common, initramfs-tools, apt: /etc/kernel ... while on Fedora 36 Workstation: $ rpm --file --query /etc/kernel systemd-udev-250.8-1.fc36.x86_64 Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1153
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1160
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1195
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1195
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1386
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1386
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1386
Another case against With |
Is someone working on this? |
Currently, there's no way to get assert_line to use the stderr_lines array [1]. This is worked around by assigning stderr_lines to the 'lines' array. [1] bats-core/bats-assert#42 containers#1595
Same here there was a commit but was closed as the author could not work on it |
The
run
command inbats-core
has the ability to keep stderr-related output into separate variables:as per https://bats-core.readthedocs.io/en/latest/writing-tests.html#run-test-other-commands
Should we have assertion helpers that apply to stderr only?
The text was updated successfully, but these errors were encountered: