summaryrefslogtreecommitdiff
path: root/subplot
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2020-10-10 10:12:44 +0300
committerLars Wirzenius <liw@liw.fi>2020-10-10 10:16:25 +0300
commit8be4a57cdb3851f127f1d91c56921d7ad58f36d6 (patch)
treebd63a903246399c58257454a2644ecafdde11d26 /subplot
parentb2552e839c18a6831e258dc13f90e55643cfaa34 (diff)
downloaddebian-ansible-8be4a57cdb3851f127f1d91c56921d7ad58f36d6.tar.gz
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.
Diffstat (limited to 'subplot')
-rw-r--r--subplot/subplot.py21
1 files changed, 15 insertions, 6 deletions
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}")