From 8be4a57cdb3851f127f1d91c56921d7ad58f36d6 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sat, 10 Oct 2020 10:12:44 +0300 Subject: test: make test configurable Create test.cfg in the source tree for this. Currently, ./check does that with hardcoded values. I may change that later if need be, but this is simple for now. --- subplot/subplot.py | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'subplot') diff --git a/subplot/subplot.py b/subplot/subplot.py index c9c3cdc..1570d27 100644 --- a/subplot/subplot.py +++ b/subplot/subplot.py @@ -11,14 +11,23 @@ def create_vm(ctx): QemuSystem = globals()["QemuSystem"] srcdir = globals()["srcdir"] - name = "debian-ansible-test" - base_image = "/home/liw/tmp/debian-10-openstack-amd64.qcow2" + MiB = 1024 ** 2 GiB = 1024 ** 3 - disk_size = 10 * GiB + + cfg = yaml.safe_load(open(os.path.join(srcdir, "test.cfg"))) + name = cfg["name"] + base_image = cfg["base_image"] + username = cfg["username"] + cpus = cfg["cpus"] + memory = cfg["memory"] * MiB + + # We use a hard-coded test key that we have in the source tree. pubkey = open(os.path.join(srcdir, "ssh", "id.pub")).read().strip() - memory = 1 * GiB - cpus = 2 - username = "debian" + + # We hard code the disk image size, since we don't expect scenarios to have + # any specific size needs, and also, the qcow2 image format is only as big + # as the data put into the disk, so we can choose a size that fits all. + disk_size = 10 * GiB logging.info("starting a VM using qemu-system") logging.info(f" name : {name}") -- cgit v1.2.1