From c5391d0f07990e0a6e65e9d3cd1efaf399edaf24 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Wed, 3 Mar 2021 06:06:38 +0200 Subject: test: make path to Debian cloud image be configurable --- subplot/vmadm.py | 14 ++++++++++++++ subplot/vmadm.yaml | 3 +++ vmadm.md | 3 ++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/subplot/vmadm.py b/subplot/vmadm.py index 48737a3..2daa81c 100644 --- a/subplot/vmadm.py +++ b/subplot/vmadm.py @@ -1,5 +1,6 @@ import logging import os +import shutil import yaml @@ -21,6 +22,19 @@ def install_vmadm(ctx): os.mkdir("expected") +def ensure_base_image(ctx): + assert_eq = globals()["assert_eq"] + assert_ne = globals()["assert_ne"] + + base = os.environ.get("BASE_IMAGE", "") + _, ext = os.path.splitext(base) + + assert_ne(base, "") + assert_eq(ext, ".qcow2") + + shutil.copy(base, "base.qcow2") + + def invoke_cloud_init(ctx, filename=None, dirname=None): runcmd_run = globals()["runcmd_run"] runcmd_exit_code_is_zero = globals()["runcmd_exit_code_is_zero"] diff --git a/subplot/vmadm.yaml b/subplot/vmadm.yaml index 374391b..a8810ae 100644 --- a/subplot/vmadm.yaml +++ b/subplot/vmadm.yaml @@ -1,6 +1,9 @@ - given: "an installed vmadm" function: install_vmadm +- given: "a Debian 10 OpenStack cloud image" + function: ensure_base_image + - when: "I invoke vmadm cloud-init {filename} {dirname}" function: invoke_cloud_init diff --git a/vmadm.md b/vmadm.md index 9d05b2a..8881a0a 100644 --- a/vmadm.md +++ b/vmadm.md @@ -6,7 +6,7 @@ This section has some data files used by scenarios. name: smoke ssh_key_files: - .ssh/id_rsa.pub -base: /home/liw/tmp/debian-10-openstack-amd64.qcow2 +base: base.qcow2 image: smoke.qcow2 image_size_gib: 5 memory_mib: 2048 @@ -122,6 +122,7 @@ can be addressed by name. ~~~scenario given an installed vmadm +given a Debian 10 OpenStack cloud image given file smoke.yaml given file .ssh/id_rsa from ssh_key given file .ssh/id_rsa.pub from ssh_key_pub -- cgit v1.2.1