From f73e933af5130a10d13e78a94b7411a4a4f7b67c Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Tue, 25 Oct 2022 10:01:43 +0100
Subject: [PATCH] Split the test-driver "run" command into "provision" and
 "test"

---
 test-driver | 43 +++++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 12 deletions(-)

diff --git a/test-driver b/test-driver
index 12e943b3..dcef19c1 100755
--- a/test-driver
+++ b/test-driver
@@ -92,9 +92,12 @@ Commands:
 
   cleanup    Cleanup the test environment (turn down VMs, etc)
 
-  run        Run the main float playbook, and the test suite, using
-             the playbooks specified by the remaining command-line
-             arguments
+  provision  Run the main float playbook
+
+  test       Run the test suite, using the playbooks specified by
+             the remaining command-line arguments
+
+  run        (deprecated) Run 'provision' and 'test'
 
 If DIR is specified, chdir there before running anything.
 
@@ -119,6 +122,20 @@ if [ $# -gt 0 ]; then
     shift
 fi
 
+do_provision() {
+    log Running main playbook
+    ${float_dir}/float run site.yml \
+        || die "failed to run the main playbook"
+}
+
+do_test() {
+    for playbook in "${float_dir}/test/integration-test.yml" "$@"; do
+        log Running test playbook ${playbook}
+        ${float_dir}/float run ${playbook} \
+            || die "test playbook failed"
+    done
+}
+
 case "$cmd" in
     init)
         run_init
@@ -134,16 +151,18 @@ case "$cmd" in
         run_cleanup
         ;;
 
+    provision)
+        do_provision
+        ;;
+
+    test)
+        do_test
+        ;;
+
+    # Legacy command to run both 'provision' and 'test' at once.
     run)
-        log Running main playbook
-        ${float_dir}/float run site.yml \
-            || die "failed to run the main playbook"
-
-        for playbook in "${float_dir}/test/integration-test.yml" "$@"; do
-            log Running test playbook ${playbook}
-            ${float_dir}/float run ${playbook} \
-                || die "test playbook failed"
-        done
+        do_provision
+        do_test
         ;;
 
     *)
-- 
GitLab