spiegel_podman/test/e2e
Ed Santiago 547fff2703 e2e tests: use Should(Exit()) and ExitWithError()
e2e test failures are rife with messages like:

   Expected 1 to equal 0

These make me cry. They're anti-helpful, requiring the reader
to dive into the source code to figure out what those numbers
mean.

Solution: Go tests have a '.Should(Exit(NNN))' mechanism. I
don't know if it spits out a better diagnostic (I have no way
to run e2e tests on my laptop), but I have to fantasize that
it will, and given the state of our flakes I assume that at
least one test will fail and give me the opportunity to see
what the error message looks like.

THIS IS NOT REVIEWABLE CODE. There is no way for a human
to review it. Don't bother. Maybe look at a few random
ones for sanity. If you want to really review, here is
a reproducer of what I did:

   cd test/e2e
   ! positive assertions. The second is the same as the first,
   ! with the addition of (unnecessary) parentheses because
   ! some invocations were written that way. The third is BeZero().
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Equal\((\d+)\)\)/Expect($1).Should(Exit($2))/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(\(Equal\((\d+)\)\)\)/Expect($1).Should(Exit($2))/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(BeZero\(\)\)/Expect($1).Should(Exit(0))/' *_test.go

   ! Same as above, but handles three non-numeric exit codes
   ! in run_exit_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Equal\((\S+)\)\)/Expect($1).Should(Exit($2))/' *_test.go

   ! negative assertions. Difference is the spelling of 'To(Not)',
   ! 'ToNot', and 'NotTo'. I assume those are all the same.
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.To\(Not\(Equal\((0)\)\)\)/Expect($1).To(ExitWithError())/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.ToNot\(Equal\((0)\)\)/Expect($1).To(ExitWithError())/' *_test.go
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.NotTo\(Equal\((0)\)\)/Expect($1).To(ExitWithError())/' *_test.go
   ! negative, old use of BeZero()
   perl -pi -e 's/Expect\((\S+)\.ExitCode\(\)\)\.ToNot\(BeZero\(\)\)/Expect($1).Should(ExitWithError())/' *_test.go

Run those on a clean copy of main branch (at the same branch
point as my PR, of course), then diff against a checked-out
copy of my PR. There should be no differences. Then all you
have to review is that my replacements above are sane.

UPDATE: nope, that's not enough, you also need to add gomega/gexec
to the files that don't have it:

   perl -pi -e '$_ .= "$1/gexec\"\n" if m!^(.*/onsi/gomega)"!' $(grep -L gomega/gexec $(git log -1 --stat | awk '$1 ~ /test\/e2e\// { print $1}'))

UPDATE 2: hand-edit run_volume_test.go

UPDATE 3: sigh, add WaitWithDefaultTimeout() to a couple of places

UPDATE 4: skip a test due to bug #10935 (race condition)

Signed-off-by: Ed Santiago <santiago@redhat.com>
2021-07-15 05:06:33 -06:00
..
build Fix podman build --pull-never 2021-03-27 05:33:30 -04:00
cdi Add support for CDI device configuration 2021-04-20 09:18:52 -04:00
config Support log_tag defaults from containers.conf 2021-06-23 12:54:25 -04:00
hooks Add hooks support to podman 2018-04-05 14:13:49 +00:00
sign save image remove signatures 2020-10-21 10:00:08 -04:00
testdata migrate Podman to containers/common/libimage 2021-05-05 11:30:12 +02:00
attach_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
build_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
checkpoint_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
commit_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
common_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
config.go Add tests for volume plugins 2021-01-14 16:43:23 -05:00
config_amd64.go speed up CI handling of images 2021-04-07 15:40:29 -05:00
config_ppc64le.go use imagecaches for local tests 2019-05-29 15:12:05 -05:00
container_inspect_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
containers_conf_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
cp_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
create_staticip_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
create_staticmac_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
create_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
diff_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
events_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
exec_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
exists_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
export_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
generate_kube_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
generate_systemd_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
healthcheck_run_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
history_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
image_sign_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
images_test.go Fix image prune --filter cmd behavior 2021-06-08 15:18:00 +02:00
import_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
info_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
init_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
inspect_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
kill_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
libpod_suite_remote_test.go Document CONTAINERS_CONF/CONTAINERS_STORAGE_CONF Env variables 2021-03-10 06:34:47 -05:00
libpod_suite_test.go Document CONTAINERS_CONF/CONTAINERS_STORAGE_CONF Env variables 2021-03-10 06:34:47 -05:00
load_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
login_logout_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
logs_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
manifest_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
mount_rootless_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
mount_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
namespace_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
negative_test.go bump go module to v3 2021-02-22 09:03:51 +01:00
network_connect_disconnect_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
network_create_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
network_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pause_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
play_kube_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_create_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_infra_container_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_inspect_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_kill_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_pause_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_pod_namespaces_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_prune_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_ps_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_restart_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_rm_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_start_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_stats_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_stop_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pod_top_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
port_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
prune_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
ps_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
pull_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
push_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
rename_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
restart_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
rm_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
rmi_test.go speed up CI handling of images 2021-04-07 15:40:29 -05:00
run_apparmor_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_cgroup_parent_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_cleanup_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_cpu_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_device_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_dns_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_entrypoint_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_env_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_exit_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_memory_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_networking_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_ns_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_passwd_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_privileged_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_restart_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_seccomp_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_security_labels_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_selinux_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_signal_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_staticip_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_userns_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_volume_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
run_working_dir_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
runlabel_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
save_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
search_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
secret_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
start_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
stats_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
stop_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
system_connection_test.go Enhance system connection add URL input 2021-06-29 16:24:03 -07:00
system_df_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
system_reset_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
systemd_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
tag_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
toolbox_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
top_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
tree_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
trust_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
unshare_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
untag_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
version_test.go bump go module to v3 2021-02-22 09:03:51 +01:00
volume_create_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
volume_exists_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
volume_inspect_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
volume_ls_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
volume_plugin_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
volume_prune_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
volume_rm_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00
wait_test.go e2e tests: use Should(Exit()) and ExitWithError() 2021-07-15 05:06:33 -06:00