summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2020-05-12 06:52:27 +0000
committerintrigeri <intrigeri@boum.org>2020-05-12 07:05:16 +0000
commit5394aba2f1e05ec3c8e91e2315f4d62889836c2c (patch)
tree45b258fb1de3d859fa40e079e5083afa0c43a022
parent1fac79ef7c84f95d69693724df8b5f7b56b47201 (diff)
Test suite: add an option to keep Chutney data, but no snapshots, between runs
With an already-bootstrapped data directory, Chutney bootstraps in seconds, while that takes a few minutes when boostrapping from scratch. I've found myself having to debug test steps that lead to snapshots, so I could not use --keep-snapshots. And then, the duration of my feedback loop was hugely dominated by Chutney bootstrapping from scratch. After locally hacking ensure_chutney_is_running for a while to work around this, to make it short circuits, since the tests I was working on don't even use Tor, I figured it would be better to have an option to keep the Chutney data between runs, even when one cannot use --keep-snapshots. For backwards compatibility, --keep-snapshots implies --keep-chutney.
-rw-r--r--features/step_definitions/chutney.rb7
-rw-r--r--features/support/config.rb1
-rwxr-xr-xrun_test_suite12
3 files changed, 15 insertions, 5 deletions
diff --git a/features/step_definitions/chutney.rb b/features/step_definitions/chutney.rb
index f918979..0591c13 100644
--- a/features/step_definitions/chutney.rb
+++ b/features/step_definitions/chutney.rb
@@ -51,12 +51,13 @@ def ensure_chutney_is_running
# Nothing to kill
end
- if KEEP_SNAPSHOTS
+ if KEEP_CHUTNEY
begin
chutney_cmd.call('start')
rescue Test::Unit::AssertionFailedError
if File.directory?(env['CHUTNEY_DATA_DIR'])
- raise 'You are running with --keep-snapshots but Chutney failed ' \
+ raise 'You are running with --keep-snapshots or --keep-chutney, ' \
+ 'but Chutney failed ' \
'to start with its current data directory. To recover you ' \
"likely want to delete '#{env['CHUTNEY_DATA_DIR']}' and " \
'all test suite snapshots and then start over.'
@@ -77,7 +78,7 @@ def ensure_chutney_is_running
at_exit do
chutney_cmd.call('stop')
- chutney_data_dir_cleanup.call unless KEEP_SNAPSHOTS
+ chutney_data_dir_cleanup.call unless KEEP_CHUTNEY
end
# We have to sanity check that all nodes are running because
diff --git a/features/support/config.rb b/features/support/config.rb
index d4af0a6..bd16452 100644
--- a/features/support/config.rb
+++ b/features/support/config.rb
@@ -40,6 +40,7 @@ ENV['TMPDIR'] = $config['TMPDIR']
DEBUG_LOG_PSEUDO_FIFO = "#{$config['TMPDIR']}/debug_log_pseudo_fifo".freeze
DISPLAY = ENV['DISPLAY']
GIT_DIR = ENV['PWD']
+KEEP_CHUTNEY = !ENV['KEEP_CHUTNEY'].nil?
KEEP_SNAPSHOTS = !ENV['KEEP_SNAPSHOTS'].nil?
LIVE_USER = cmd_helper(
'. config/chroot_local-includes/etc/live/config.d/username.conf; ' \
diff --git a/run_test_suite b/run_test_suite
index 2bb1bcb..002d464 100755
--- a/run_test_suite
+++ b/run_test_suite
@@ -87,9 +87,12 @@ Options for '@product' features:
that allows to update the image. If run from a graphical
environment, any found candidate image will be displayed
in a pop-up.
+ --keep-chutney Don't ever clean Chutney data directory.
+ This can be a big time saver when debugging steps
+ when --keep-snapshots is not an option.
--keep-snapshots Don't ever delete any snapshots (including ones marked as
temporary). This can be a big time saver when debugging new
- features.
+ features. Implies --keep-chutney.
--tmpdir Directory where various temporary files are written
during a test, e.g. VM snapshots and memory dumps,
failure screenshots, pcap files and disk images
@@ -208,11 +211,12 @@ VNC_VIEWER=
VNC_SERVER=
INTERACTIVE_DEBUGGING=
IMAGE_BUMPING_MODE=
+KEEP_CHUTNEY=
KEEP_SNAPSHOTS=
TAILS_ISO=
OLD_TAILS_ISO=
-LONGOPTS="allow-non-root,artifacts-base-uri:,view,vnc-server-only,capture,capture-all,help,tmpdir:,keep-snapshots,iso:,old-iso:,interactive-debugging,image-bumping-mode"
+LONGOPTS="allow-non-root,artifacts-base-uri:,view,vnc-server-only,capture,capture-all,help,tmpdir:,keep-chutney,keep-snapshots,iso:,old-iso:,interactive-debugging,image-bumping-mode"
OPTS=$(getopt -o "" --longoptions $LONGOPTS -n "${NAME}" -- "$@")
eval set -- "$OPTS"
while [ $# -gt 0 ]; do
@@ -247,7 +251,11 @@ while [ $# -gt 0 ]; do
--image-bumping-mode)
export IMAGE_BUMPING_MODE="yes"
;;
+ --keep-chutney)
+ export KEEP_CHUTNEY="yes"
+ ;;
--keep-snapshots)
+ export KEEP_CHUTNEY="yes"
export KEEP_SNAPSHOTS="yes"
;;
--tmpdir)