Skip to content

Commit 5e0f716

Browse files
mvo5achilleas-k
authored andcommitted
test: use randomized password for test VMs
This commit uses a randomized password for the test user in the test VM.
1 parent 6bddfa5 commit 5e0f716

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

test/test_build_disk.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
import os
33
import pathlib
44
import platform
5+
import random
56
import re
67
import shutil
8+
import string
79
import subprocess
810
import tempfile
911
import uuid
@@ -256,7 +258,9 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload, gpg_
256258
image_types = request.param.image.split("+")
257259

258260
username = "test"
259-
password = "password"
261+
# use 18 char random password
262+
password = "".join(
263+
random.choices(string.ascii_uppercase + string.digits, k=18))
260264
kargs = "systemd.journald.forward_to_console=1"
261265

262266
container_ref = tc.container_ref
@@ -375,10 +379,13 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload, gpg_
375379
}
376380
testutil.maybe_create_filesystem_customizations(cfg, tc)
377381
testutil.maybe_create_disk_customizations(cfg, tc)
378-
print(f"config for {output_path} {tc=}: {cfg=}")
379382

380383
config_json_path = output_path / "config.json"
381384
config_json_path.write_text(json.dumps(cfg), encoding="utf-8")
385+
# mask pw
386+
for user in cfg["customizations"]["user"]:
387+
user["password"] = "***"
388+
print(f"config for {output_path} {tc=}: {cfg=}")
382389

383390
cursor = testutil.journal_cursor()
384391

0 commit comments

Comments
 (0)