From 6b35e5e4a16ba6d0e6e55da9fe5e746929758f2e Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Tue, 11 Jul 2023 12:18:38 +1200 Subject: [PATCH] tidy up examples/ directory Move machine configs, sources, autoinstall files and dry-run configs into their own subdirectories. --- Makefile | 4 +- README.md | 4 +- examples/{ => answers}/answers-bond.yaml | 0 .../{ => answers}/answers-guided-lvm.yaml | 0 examples/{ => answers}/answers-imsm.yaml | 2 +- .../{ => answers}/answers-lvm-dmcrypt.yaml | 0 examples/{ => answers}/answers-lvm.yaml | 0 examples/{ => answers}/answers-preserve.yaml | 2 +- examples/{ => answers}/answers-raid-lvm.yaml | 0 examples/{ => answers}/answers-raid.yaml | 0 examples/{ => answers}/answers-serial.yaml | 0 examples/{ => answers}/answers-swap.yaml | 0 .../answers-system-setup-init.yaml | 0 .../answers-system-setup-reconf.yaml | 0 examples/{ => answers}/answers-tpm.yaml | 4 +- examples/{ => answers}/answers.yaml | 0 .../{ => autoinstall}/autoinstall-ad.yaml | 0 .../autoinstall-apt-legacy.yaml | 0 .../autoinstall-interactive.yaml | 0 .../autoinstall-invalid.yaml | 0 .../autoinstall-reset-only.yaml | 0 .../{ => autoinstall}/autoinstall-short.yaml | 0 .../autoinstall-system-setup-full.yaml | 0 .../autoinstall-system-setup-no-shutdown.yaml | 0 .../autoinstall-system-setup.yaml | 0 .../autoinstall-user-data.yaml | 0 examples/{ => autoinstall}/autoinstall.yaml | 0 .../curtin-events-curthooks.json | 0 .../curtin-events-extract.json | 0 .../curtin-events-fail.json | 0 .../curtin-events-initial.json | 0 .../curtin-events-partitioning.json | 0 .../dr-config-apt-local-mirror.yaml | 0 .../dr-config-magic-attach.yaml | 0 .../{ => dry-run-configs}/tpm-dr-config.yaml | 0 .../{ => machines}/existing-partitions.json | 0 examples/{ => machines}/imsm.json | 0 .../lp-1986676-missing-osprober.json | 0 examples/{ => machines}/lp1999173-raid1.json | 0 .../{ => machines}/many-nics-and-disks.json | 0 examples/{ => machines}/multipath.json | 0 examples/{ => machines}/mwhudson.json | 0 examples/{ => machines}/simple.json | 0 .../{ => machines}/threebuntu-on-msdos.json | 0 .../{ => machines}/ubuntu-and-free-space.json | 0 examples/{ => machines}/virtio.json | 0 .../{ => machines}/win10-along-ubuntu.json | 0 examples/{ => machines}/win10.json | 0 examples/{ => sources}/desktop-sources.yaml | 0 .../{ => sources}/install-sources-canary.yaml | 0 examples/{ => sources}/install-sources.yaml | 0 examples/{ => sources}/mixed-sources.yaml | 0 examples/{ => sources}/tpm-sources.yaml | 0 scripts/runtests.sh | 28 +-- subiquity/models/tests/test_source.py | 2 +- subiquity/server/curtin.py | 15 +- subiquity/server/tests/test_server.py | 4 +- subiquity/tests/api/test_api.py | 173 ++++++++++-------- subiquitycore/tests/test_prober.py | 2 +- 59 files changed, 127 insertions(+), 113 deletions(-) rename examples/{ => answers}/answers-bond.yaml (100%) rename examples/{ => answers}/answers-guided-lvm.yaml (100%) rename examples/{ => answers}/answers-imsm.yaml (94%) rename examples/{ => answers}/answers-lvm-dmcrypt.yaml (100%) rename examples/{ => answers}/answers-lvm.yaml (100%) rename examples/{ => answers}/answers-preserve.yaml (93%) rename examples/{ => answers}/answers-raid-lvm.yaml (100%) rename examples/{ => answers}/answers-raid.yaml (100%) rename examples/{ => answers}/answers-serial.yaml (100%) rename examples/{ => answers}/answers-swap.yaml (100%) rename examples/{ => answers}/answers-system-setup-init.yaml (100%) rename examples/{ => answers}/answers-system-setup-reconf.yaml (100%) rename examples/{ => answers}/answers-tpm.yaml (87%) rename examples/{ => answers}/answers.yaml (100%) rename examples/{ => autoinstall}/autoinstall-ad.yaml (100%) rename examples/{ => autoinstall}/autoinstall-apt-legacy.yaml (100%) rename examples/{ => autoinstall}/autoinstall-interactive.yaml (100%) rename examples/{ => autoinstall}/autoinstall-invalid.yaml (100%) rename examples/{ => autoinstall}/autoinstall-reset-only.yaml (100%) rename examples/{ => autoinstall}/autoinstall-short.yaml (100%) rename examples/{ => autoinstall}/autoinstall-system-setup-full.yaml (100%) rename examples/{ => autoinstall}/autoinstall-system-setup-no-shutdown.yaml (100%) rename examples/{ => autoinstall}/autoinstall-system-setup.yaml (100%) rename examples/{ => autoinstall}/autoinstall-user-data.yaml (100%) rename examples/{ => autoinstall}/autoinstall.yaml (100%) rename examples/{ => curtin-events}/curtin-events-curthooks.json (100%) rename examples/{ => curtin-events}/curtin-events-extract.json (100%) rename examples/{ => curtin-events}/curtin-events-fail.json (100%) rename examples/{ => curtin-events}/curtin-events-initial.json (100%) rename examples/{ => curtin-events}/curtin-events-partitioning.json (100%) rename examples/{ => dry-run-configs}/dr-config-apt-local-mirror.yaml (100%) rename examples/{ => dry-run-configs}/dr-config-magic-attach.yaml (100%) rename examples/{ => dry-run-configs}/tpm-dr-config.yaml (100%) rename examples/{ => machines}/existing-partitions.json (100%) rename examples/{ => machines}/imsm.json (100%) rename examples/{ => machines}/lp-1986676-missing-osprober.json (100%) rename examples/{ => machines}/lp1999173-raid1.json (100%) rename examples/{ => machines}/many-nics-and-disks.json (100%) rename examples/{ => machines}/multipath.json (100%) rename examples/{ => machines}/mwhudson.json (100%) rename examples/{ => machines}/simple.json (100%) rename examples/{ => machines}/threebuntu-on-msdos.json (100%) rename examples/{ => machines}/ubuntu-and-free-space.json (100%) rename examples/{ => machines}/virtio.json (100%) rename examples/{ => machines}/win10-along-ubuntu.json (100%) rename examples/{ => machines}/win10.json (100%) rename examples/{ => sources}/desktop-sources.yaml (100%) rename examples/{ => sources}/install-sources-canary.yaml (100%) rename examples/{ => sources}/install-sources.yaml (100%) rename examples/{ => sources}/mixed-sources.yaml (100%) rename examples/{ => sources}/tpm-sources.yaml (100%) diff --git a/Makefile b/Makefile index b63697ae..8303edc7 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ PYTHONSRC=$(NAME) PYTHONPATH=$(shell pwd):$(shell pwd)/probert:$(shell pwd)/curtin PROBERTDIR=./probert PROBERT_REPO=https://github.com/canonical/probert -DRYRUN?=--dry-run --bootloader uefi --machine-config examples/simple.json \ - --source-catalog examples/install-sources.yaml \ +DRYRUN?=--dry-run --bootloader uefi --machine-config examples/machines/simple.json \ + --source-catalog examples/sources/install-sources.yaml \ --postinst-hooks-dir examples/postinst.d/ SYSTEM_SETUP_DRYRUN?=--dry-run export PYTHONPATH diff --git a/README.md b/README.md index 20a2c9b9..8cad4bfc 100644 --- a/README.md +++ b/README.md @@ -42,10 +42,10 @@ backend configuration files to /tmp/subiquity-config-\* but it won't attempt to run any installer commands (which would fail without root privileges). Further, subiquity can load other machine profiles in case you want to test out the installer without having access to the machine. A few sample machine -profiles are available in the repository at ./examples/ and +profiles are available in the repository at ./examples/machines and can be loaded via the MACHINE make variable: -`make dryrun MACHINE=examples/simple.json` +`make dryrun MACHINE=examples/machines/simple.json` # Generating machine profiles Machine profiles are generated from the probert tool. To collect a machine profile: diff --git a/examples/answers-bond.yaml b/examples/answers/answers-bond.yaml similarity index 100% rename from examples/answers-bond.yaml rename to examples/answers/answers-bond.yaml diff --git a/examples/answers-guided-lvm.yaml b/examples/answers/answers-guided-lvm.yaml similarity index 100% rename from examples/answers-guided-lvm.yaml rename to examples/answers/answers-guided-lvm.yaml diff --git a/examples/answers-imsm.yaml b/examples/answers/answers-imsm.yaml similarity index 94% rename from examples/answers-imsm.yaml rename to examples/answers/answers-imsm.yaml index 50ba63ca..487fb3e5 100644 --- a/examples/answers-imsm.yaml +++ b/examples/answers/answers-imsm.yaml @@ -1,4 +1,4 @@ -#machine-config: examples/imsm.json +#machine-config: examples/machines/imsm.json Source: source: ubuntu-server Welcome: diff --git a/examples/answers-lvm-dmcrypt.yaml b/examples/answers/answers-lvm-dmcrypt.yaml similarity index 100% rename from examples/answers-lvm-dmcrypt.yaml rename to examples/answers/answers-lvm-dmcrypt.yaml diff --git a/examples/answers-lvm.yaml b/examples/answers/answers-lvm.yaml similarity index 100% rename from examples/answers-lvm.yaml rename to examples/answers/answers-lvm.yaml diff --git a/examples/answers-preserve.yaml b/examples/answers/answers-preserve.yaml similarity index 93% rename from examples/answers-preserve.yaml rename to examples/answers/answers-preserve.yaml index 46dbb88a..b64a7b35 100644 --- a/examples/answers-preserve.yaml +++ b/examples/answers/answers-preserve.yaml @@ -1,4 +1,4 @@ -#machine-config: examples/existing-partitions.json +#machine-config: examples/machines/existing-partitions.json Source: source: ubuntu-server Welcome: diff --git a/examples/answers-raid-lvm.yaml b/examples/answers/answers-raid-lvm.yaml similarity index 100% rename from examples/answers-raid-lvm.yaml rename to examples/answers/answers-raid-lvm.yaml diff --git a/examples/answers-raid.yaml b/examples/answers/answers-raid.yaml similarity index 100% rename from examples/answers-raid.yaml rename to examples/answers/answers-raid.yaml diff --git a/examples/answers-serial.yaml b/examples/answers/answers-serial.yaml similarity index 100% rename from examples/answers-serial.yaml rename to examples/answers/answers-serial.yaml diff --git a/examples/answers-swap.yaml b/examples/answers/answers-swap.yaml similarity index 100% rename from examples/answers-swap.yaml rename to examples/answers/answers-swap.yaml diff --git a/examples/answers-system-setup-init.yaml b/examples/answers/answers-system-setup-init.yaml similarity index 100% rename from examples/answers-system-setup-init.yaml rename to examples/answers/answers-system-setup-init.yaml diff --git a/examples/answers-system-setup-reconf.yaml b/examples/answers/answers-system-setup-reconf.yaml similarity index 100% rename from examples/answers-system-setup-reconf.yaml rename to examples/answers/answers-system-setup-reconf.yaml diff --git a/examples/answers-tpm.yaml b/examples/answers/answers-tpm.yaml similarity index 87% rename from examples/answers-tpm.yaml rename to examples/answers/answers-tpm.yaml index e68436c6..6a170c9d 100644 --- a/examples/answers-tpm.yaml +++ b/examples/answers/answers-tpm.yaml @@ -1,5 +1,5 @@ -#source-catalog: examples/tpm-sources.yaml -#dr-config: examples/tpm-dr-config.yaml +#source-catalog: examples/sources/tpm-sources.yaml +#dr-config: examples/dry-run-configs/tpm-dr-config.yaml Source: source: src-prefer-encrypted Serial: diff --git a/examples/answers.yaml b/examples/answers/answers.yaml similarity index 100% rename from examples/answers.yaml rename to examples/answers/answers.yaml diff --git a/examples/autoinstall-ad.yaml b/examples/autoinstall/autoinstall-ad.yaml similarity index 100% rename from examples/autoinstall-ad.yaml rename to examples/autoinstall/autoinstall-ad.yaml diff --git a/examples/autoinstall-apt-legacy.yaml b/examples/autoinstall/autoinstall-apt-legacy.yaml similarity index 100% rename from examples/autoinstall-apt-legacy.yaml rename to examples/autoinstall/autoinstall-apt-legacy.yaml diff --git a/examples/autoinstall-interactive.yaml b/examples/autoinstall/autoinstall-interactive.yaml similarity index 100% rename from examples/autoinstall-interactive.yaml rename to examples/autoinstall/autoinstall-interactive.yaml diff --git a/examples/autoinstall-invalid.yaml b/examples/autoinstall/autoinstall-invalid.yaml similarity index 100% rename from examples/autoinstall-invalid.yaml rename to examples/autoinstall/autoinstall-invalid.yaml diff --git a/examples/autoinstall-reset-only.yaml b/examples/autoinstall/autoinstall-reset-only.yaml similarity index 100% rename from examples/autoinstall-reset-only.yaml rename to examples/autoinstall/autoinstall-reset-only.yaml diff --git a/examples/autoinstall-short.yaml b/examples/autoinstall/autoinstall-short.yaml similarity index 100% rename from examples/autoinstall-short.yaml rename to examples/autoinstall/autoinstall-short.yaml diff --git a/examples/autoinstall-system-setup-full.yaml b/examples/autoinstall/autoinstall-system-setup-full.yaml similarity index 100% rename from examples/autoinstall-system-setup-full.yaml rename to examples/autoinstall/autoinstall-system-setup-full.yaml diff --git a/examples/autoinstall-system-setup-no-shutdown.yaml b/examples/autoinstall/autoinstall-system-setup-no-shutdown.yaml similarity index 100% rename from examples/autoinstall-system-setup-no-shutdown.yaml rename to examples/autoinstall/autoinstall-system-setup-no-shutdown.yaml diff --git a/examples/autoinstall-system-setup.yaml b/examples/autoinstall/autoinstall-system-setup.yaml similarity index 100% rename from examples/autoinstall-system-setup.yaml rename to examples/autoinstall/autoinstall-system-setup.yaml diff --git a/examples/autoinstall-user-data.yaml b/examples/autoinstall/autoinstall-user-data.yaml similarity index 100% rename from examples/autoinstall-user-data.yaml rename to examples/autoinstall/autoinstall-user-data.yaml diff --git a/examples/autoinstall.yaml b/examples/autoinstall/autoinstall.yaml similarity index 100% rename from examples/autoinstall.yaml rename to examples/autoinstall/autoinstall.yaml diff --git a/examples/curtin-events-curthooks.json b/examples/curtin-events/curtin-events-curthooks.json similarity index 100% rename from examples/curtin-events-curthooks.json rename to examples/curtin-events/curtin-events-curthooks.json diff --git a/examples/curtin-events-extract.json b/examples/curtin-events/curtin-events-extract.json similarity index 100% rename from examples/curtin-events-extract.json rename to examples/curtin-events/curtin-events-extract.json diff --git a/examples/curtin-events-fail.json b/examples/curtin-events/curtin-events-fail.json similarity index 100% rename from examples/curtin-events-fail.json rename to examples/curtin-events/curtin-events-fail.json diff --git a/examples/curtin-events-initial.json b/examples/curtin-events/curtin-events-initial.json similarity index 100% rename from examples/curtin-events-initial.json rename to examples/curtin-events/curtin-events-initial.json diff --git a/examples/curtin-events-partitioning.json b/examples/curtin-events/curtin-events-partitioning.json similarity index 100% rename from examples/curtin-events-partitioning.json rename to examples/curtin-events/curtin-events-partitioning.json diff --git a/examples/dr-config-apt-local-mirror.yaml b/examples/dry-run-configs/dr-config-apt-local-mirror.yaml similarity index 100% rename from examples/dr-config-apt-local-mirror.yaml rename to examples/dry-run-configs/dr-config-apt-local-mirror.yaml diff --git a/examples/dr-config-magic-attach.yaml b/examples/dry-run-configs/dr-config-magic-attach.yaml similarity index 100% rename from examples/dr-config-magic-attach.yaml rename to examples/dry-run-configs/dr-config-magic-attach.yaml diff --git a/examples/tpm-dr-config.yaml b/examples/dry-run-configs/tpm-dr-config.yaml similarity index 100% rename from examples/tpm-dr-config.yaml rename to examples/dry-run-configs/tpm-dr-config.yaml diff --git a/examples/existing-partitions.json b/examples/machines/existing-partitions.json similarity index 100% rename from examples/existing-partitions.json rename to examples/machines/existing-partitions.json diff --git a/examples/imsm.json b/examples/machines/imsm.json similarity index 100% rename from examples/imsm.json rename to examples/machines/imsm.json diff --git a/examples/lp-1986676-missing-osprober.json b/examples/machines/lp-1986676-missing-osprober.json similarity index 100% rename from examples/lp-1986676-missing-osprober.json rename to examples/machines/lp-1986676-missing-osprober.json diff --git a/examples/lp1999173-raid1.json b/examples/machines/lp1999173-raid1.json similarity index 100% rename from examples/lp1999173-raid1.json rename to examples/machines/lp1999173-raid1.json diff --git a/examples/many-nics-and-disks.json b/examples/machines/many-nics-and-disks.json similarity index 100% rename from examples/many-nics-and-disks.json rename to examples/machines/many-nics-and-disks.json diff --git a/examples/multipath.json b/examples/machines/multipath.json similarity index 100% rename from examples/multipath.json rename to examples/machines/multipath.json diff --git a/examples/mwhudson.json b/examples/machines/mwhudson.json similarity index 100% rename from examples/mwhudson.json rename to examples/machines/mwhudson.json diff --git a/examples/simple.json b/examples/machines/simple.json similarity index 100% rename from examples/simple.json rename to examples/machines/simple.json diff --git a/examples/threebuntu-on-msdos.json b/examples/machines/threebuntu-on-msdos.json similarity index 100% rename from examples/threebuntu-on-msdos.json rename to examples/machines/threebuntu-on-msdos.json diff --git a/examples/ubuntu-and-free-space.json b/examples/machines/ubuntu-and-free-space.json similarity index 100% rename from examples/ubuntu-and-free-space.json rename to examples/machines/ubuntu-and-free-space.json diff --git a/examples/virtio.json b/examples/machines/virtio.json similarity index 100% rename from examples/virtio.json rename to examples/machines/virtio.json diff --git a/examples/win10-along-ubuntu.json b/examples/machines/win10-along-ubuntu.json similarity index 100% rename from examples/win10-along-ubuntu.json rename to examples/machines/win10-along-ubuntu.json diff --git a/examples/win10.json b/examples/machines/win10.json similarity index 100% rename from examples/win10.json rename to examples/machines/win10.json diff --git a/examples/desktop-sources.yaml b/examples/sources/desktop-sources.yaml similarity index 100% rename from examples/desktop-sources.yaml rename to examples/sources/desktop-sources.yaml diff --git a/examples/install-sources-canary.yaml b/examples/sources/install-sources-canary.yaml similarity index 100% rename from examples/install-sources-canary.yaml rename to examples/sources/install-sources-canary.yaml diff --git a/examples/install-sources.yaml b/examples/sources/install-sources.yaml similarity index 100% rename from examples/install-sources.yaml rename to examples/sources/install-sources.yaml diff --git a/examples/mixed-sources.yaml b/examples/sources/mixed-sources.yaml similarity index 100% rename from examples/mixed-sources.yaml rename to examples/sources/mixed-sources.yaml diff --git a/examples/tpm-sources.yaml b/examples/sources/tpm-sources.yaml similarity index 100% rename from examples/tpm-sources.yaml rename to examples/sources/tpm-sources.yaml diff --git a/scripts/runtests.sh b/scripts/runtests.sh index 02f8e4aa..f409363d 100755 --- a/scripts/runtests.sh +++ b/scripts/runtests.sh @@ -163,16 +163,16 @@ tty=$(tty) || tty=/dev/console export SUBIQUITY_REPLAY_TIMESCALE=100 -for answers in examples/answers*.yaml; do +for answers in examples/answers/*.yaml; do if echo $answers|grep -vq system-setup; then config=$(sed -n 's/^#machine-config: \(.*\)/\1/p' $answers || true) catalog=$(sed -n 's/^#source-catalog: \(.*\)/\1/p' $answers || true) dr_config=$(sed -n 's/^#dr-config: \(.*\)/\1/p' "$answers" || true) if [ -z "$config" ]; then - config=examples/simple.json + config=examples/machines/simple.json fi if [ -z "$catalog" ]; then - catalog=examples/install-sources.yaml + catalog=examples/sources/install-sources.yaml fi serial=$(sed -n 's/^#serial/x/p' $answers || true) opts=() @@ -220,12 +220,12 @@ LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ --output-base "$tmpdir" \ - --machine-config examples/existing-partitions.json \ + --machine-config examples/machines/existing-partitions.json \ --bootloader bios \ - --autoinstall examples/autoinstall.yaml \ - --dry-run-config examples/dr-config-apt-local-mirror.yaml \ + --autoinstall examples/autoinstall/autoinstall.yaml \ + --dry-run-config examples/dry-run-configs/dr-config-apt-local-mirror.yaml \ --kernel-cmdline autoinstall \ - --source-catalog examples/install-sources.yaml + --source-catalog examples/sources/install-sources.yaml validate python3 scripts/check-yaml-fields.py $tmpdir/var/log/installer/subiquity-curtin-apt.conf \ apt.disable_components='[non-free, restricted]' \ @@ -254,10 +254,10 @@ LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ --output-base "$tmpdir" \ - --machine-config examples/simple.json \ - --autoinstall examples/autoinstall-user-data.yaml \ + --machine-config examples/machines/simple.json \ + --autoinstall examples/autoinstall/autoinstall-user-data.yaml \ --kernel-cmdline autoinstall \ - --source-catalog examples/install-sources.yaml + --source-catalog examples/sources/install-sources.yaml validate python3 scripts/check-yaml-fields.py "$tmpdir"/var/log/installer/autoinstall-user-data \ 'autoinstall.source.id="ubuntu-server-minimal"' @@ -268,10 +268,10 @@ LANG=C.UTF-8 timeout --foreground 60 \ python3 -m subiquity.cmd.tui \ --dry-run \ --output-base "$tmpdir" \ - --machine-config examples/simple.json \ - --autoinstall examples/autoinstall-reset-only.yaml \ + --machine-config examples/machines/simple.json \ + --autoinstall examples/autoinstall/autoinstall-reset-only.yaml \ --kernel-cmdline autoinstall \ - --source-catalog examples/install-sources.yaml + --source-catalog examples/sources/install-sources.yaml validate install reset-only # The OOBE doesn't exist in WSL < 20.04 @@ -299,7 +299,7 @@ if [ "${RELEASE%.*}" -ge 20 ]; then python3 -m system_setup.cmd.tui \ --dry-run \ --output-base "$tmpdir" \ - --autoinstall "examples/autoinstall-system-setup${mode}.yaml" + --autoinstall "examples/autoinstall/autoinstall-system-setup${mode}.yaml" validate "system_setup" "autoinstall${mode}" done diff --git a/subiquity/models/tests/test_source.py b/subiquity/models/tests/test_source.py index 17a65f94..2012c277 100644 --- a/subiquity/models/tests/test_source.py +++ b/subiquity/models/tests/test_source.py @@ -121,7 +121,7 @@ class TestSourceModel(unittest.TestCase): self.assertEqual(model.render(), {}) def test_canary(self): - with open('examples/install-sources-canary.yaml') as fp: + with open('examples/sources/install-sources-canary.yaml') as fp: model = SourceModel() model.load_from_file(fp) self.assertEqual(2, len(model.sources)) diff --git a/subiquity/server/curtin.py b/subiquity/server/curtin.py index 0807c900..6c3090cc 100644 --- a/subiquity/server/curtin.py +++ b/subiquity/server/curtin.py @@ -130,11 +130,11 @@ class _CurtinCommand: class _DryRunCurtinCommand(_CurtinCommand): stages_mapping = { - tuple(): "examples/curtin-events-initial.json", # no stage - ("partitioning",): "examples/curtin-events-partitioning.json", - ("extract",): "examples/curtin-events-extract.json", - ("curthooks",): "examples/curtin-events-curthooks.json", - ("swap",): "examples/curtin-events-curthooks.json", # hack + tuple(): "curtin-events-initial.json", # no stage + ("partitioning",): "curtin-events-partitioning.json", + ("extract",): "curtin-events-extract.json", + ("curthooks",): "curtin-events-curthooks.json", + ("swap",): "curtin-events-curthooks.json", # hack } def make_command(self, command, *args, config=None): @@ -161,9 +161,10 @@ class _DryRunCurtinCommand(_CurtinCommand): ] if config: cmd.extend(['--config', config]) + event_log_filename = self.stages_mapping[tuple(stages)] cmd.extend([ "--", - self.stages_mapping[tuple(stages)], + f"examples/curtin-events/{event_log_filename}", ]) return cmd else: @@ -174,7 +175,7 @@ class _FailingDryRunCurtinCommand(_DryRunCurtinCommand): stages_mapping = { **_DryRunCurtinCommand.stages_mapping, - **{("extract",): "examples/curtin-events-fail.json"} + **{("extract",): "curtin-events-fail.json"} } diff --git a/subiquity/server/tests/test_server.py b/subiquity/server/tests/test_server.py index 52c02823..e106e45b 100644 --- a/subiquity/server/tests/test_server.py +++ b/subiquity/server/tests/test_server.py @@ -37,7 +37,7 @@ class TestAutoinstallLoad(SubiTestCase): opts = Mock() opts.dry_run = True opts.output_base = self.tempdir - opts.machine_config = 'examples/simple.json' + opts.machine_config = 'examples/machines/simple.json' opts.kernel_cmdline = {} opts.autoinstall = None self.server = SubiquityServer(opts, None) @@ -164,7 +164,7 @@ class TestDefaultUser(SubiTestCase): opts = Mock() opts.dry_run = True opts.output_base = self.tmp_dir() - opts.machine_config = 'examples/simple.json' + opts.machine_config = 'examples/machines/simple.json' server = SubiquityServer(opts, None) server.cloud = Mock() server._user_has_password = Mock( diff --git a/subiquity/tests/api/test_api.py b/subiquity/tests/api/test_api.py index 8c00e352..34fa0ca7 100644 --- a/subiquity/tests/api/test_api.py +++ b/subiquity/tests/api/test_api.py @@ -302,13 +302,13 @@ async def connect_server(*args, **kwargs): class TestBitlocker(TestAPI): @timeout() async def test_has_bitlocker(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: resp = await inst.get('/storage/has_bitlocker') self.assertEqual(1, len(resp)) @timeout() async def test_not_bitlocker(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/storage/has_bitlocker') self.assertEqual(0, len(resp)) @@ -316,7 +316,7 @@ class TestBitlocker(TestAPI): class TestFlow(TestAPI): @timeout(2) async def test_serverish_flow(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: await inst.post('/locale', 'en_US.UTF-8') keyboard = { 'layout': 'us', @@ -369,7 +369,7 @@ class TestFlow(TestAPI): @timeout() async def test_v2_flow(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' orig_resp = await inst.get('/storage/v2') [sda] = match(orig_resp['disks'], id=disk_id) @@ -440,7 +440,7 @@ class TestFlow(TestAPI): class TestGuided(TestAPI): @timeout() async def test_guided_v2_reformat(self): - cfg = 'examples/win10-along-ubuntu.json' + cfg = 'examples/machines/win10-along-ubuntu.json' async with start_server(cfg) as inst: resp = await inst.get('/storage/v2/guided') [reformat] = match(resp['targets'], @@ -482,7 +482,7 @@ class TestGuided(TestAPI): @timeout() async def test_guided_v2_resize(self): - cfg = 'examples/win10-along-ubuntu.json' + cfg = 'examples/machines/win10-along-ubuntu.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: orig_resp = await inst.get('/storage/v2') @@ -524,7 +524,7 @@ class TestGuided(TestAPI): @timeout() async def test_guided_v2_use_gap(self): - cfg = self.machineConfig('examples/win10-along-ubuntu.json') + cfg = self.machineConfig('examples/machines/win10-along-ubuntu.json') with cfg.edit() as data: pt = data['storage']['blockdev']['/dev/sda']['partitiontable'] [node] = match(pt['partitions'], node='/dev/sda5') @@ -571,7 +571,7 @@ class TestGuided(TestAPI): @timeout() async def test_guided_v2_resize_logical(self): - cfg = 'examples/threebuntu-on-msdos.json' + cfg = 'examples/machines/threebuntu-on-msdos.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: resp = await inst.get('/storage/v2/guided') @@ -590,7 +590,7 @@ class TestGuided(TestAPI): class TestCore(TestAPI): @timeout() async def test_basic_core_boot(self): - cfg = self.machineConfig('examples/simple.json') + cfg = self.machineConfig('examples/machines/simple.json') with cfg.edit() as data: attrs = data['storage']['blockdev']['/dev/sda']['attrs'] attrs['size'] = str(25 << 30) @@ -598,8 +598,10 @@ class TestCore(TestAPI): bootloader='uefi', extra_args=[ '--storage-version', '2', - '--source-catalog', 'examples/install-sources-canary.yaml', - '--dry-run-config', 'examples/tpm-dr-config.yaml', + '--source-catalog', + 'examples/sources/install-sources-canary.yaml', + '--dry-run-config', + 'examples/dry-run-configs/tpm-dr-config.yaml', ] ) async with start_server(cfg, **kw) as inst: @@ -627,7 +629,7 @@ class TestCore(TestAPI): class TestAdd(TestAPI): @timeout() async def test_v2_add_boot_partition(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.post('/storage/v2') @@ -678,7 +680,7 @@ class TestAdd(TestAPI): @timeout() async def test_v2_deny_multiple_add_boot_partition(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' await inst.post('/storage/v2/add_boot_partition', disk_id=disk_id) with self.assertRaises(ClientResponseError): @@ -687,7 +689,8 @@ class TestAdd(TestAPI): @timeout() async def test_v2_deny_multiple_add_boot_partition_BIOS(self): - async with start_server('examples/simple.json', 'bios') as inst: + cfg = 'examples/machines/simple.json' + async with start_server(cfg, 'bios') as inst: disk_id = 'disk-sda' await inst.post('/storage/v2/add_boot_partition', disk_id=disk_id) with self.assertRaises(ClientResponseError): @@ -697,7 +700,7 @@ class TestAdd(TestAPI): @timeout() async def test_add_format_required(self): disk_id = 'disk-sda' - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: bad_partitions = [ {}, {'mount': '/'}, @@ -710,7 +713,7 @@ class TestAdd(TestAPI): @timeout() async def test_add_default_size_handling(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id=disk_id) @@ -731,7 +734,8 @@ class TestAdd(TestAPI): @timeout() async def test_v2_add_boot_BIOS(self): - async with start_server('examples/simple.json', 'bios') as inst: + cfg = 'examples/machines/simple.json' + async with start_server(cfg, 'bios') as inst: disk_id = 'disk-sda' resp = await inst.post('/storage/v2/add_boot_partition', disk_id=disk_id) @@ -742,7 +746,8 @@ class TestAdd(TestAPI): @timeout() async def test_v2_blank_is_not_boot(self): - async with start_server('examples/simple.json', 'bios') as inst: + cfg = 'examples/machines/simple.json' + async with start_server(cfg, 'bios') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id=disk_id) @@ -750,7 +755,8 @@ class TestAdd(TestAPI): @timeout() async def test_v2_multi_disk_multi_boot(self): - async with start_server('examples/many-nics-and-disks.json') as inst: + cfg = 'examples/machines/many-nics-and-disks.json' + async with start_server(cfg) as inst: resp = await inst.get('/storage/v2') [d1] = match(resp['disks'], id='disk-vda') [d2] = match(resp['disks'], id='disk-vdb') @@ -764,7 +770,7 @@ class TestAdd(TestAPI): class TestDelete(TestAPI): @timeout() async def test_v2_delete_without_reformat(self): - cfg = 'examples/win10.json' + cfg = 'examples/machines/win10.json' extra = ['--storage-version', '1'] async with start_server(cfg, extra_args=extra) as inst: data = { @@ -776,7 +782,7 @@ class TestDelete(TestAPI): @timeout() async def test_v2_delete_without_reformat_is_ok_with_sv2(self): - cfg = 'examples/win10.json' + cfg = 'examples/machines/win10.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: data = { @@ -787,7 +793,7 @@ class TestDelete(TestAPI): @timeout() async def test_v2_delete_with_reformat(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' resp = await inst.post('/storage/v2/reformat_disk', {'disk_id': disk_id}) @@ -810,7 +816,7 @@ class TestDelete(TestAPI): @timeout() async def test_delete_nonexistant(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' await inst.post('/storage/v2/reformat_disk', {'disk_id': disk_id}) data = { @@ -824,7 +830,7 @@ class TestDelete(TestAPI): class TestEdit(TestAPI): @timeout() async def test_edit_no_change_size(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') @@ -842,7 +848,7 @@ class TestEdit(TestAPI): @timeout() async def test_edit_no_change_grub(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' data = { 'disk_id': disk_id, @@ -856,7 +862,7 @@ class TestEdit(TestAPI): @timeout() async def test_edit_format(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' data = { 'disk_id': disk_id, @@ -874,7 +880,7 @@ class TestEdit(TestAPI): @timeout() async def test_edit_mount(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' data = { 'disk_id': disk_id, @@ -891,7 +897,7 @@ class TestEdit(TestAPI): @timeout() async def test_edit_format_and_mount(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' data = { 'disk_id': disk_id, @@ -911,7 +917,7 @@ class TestEdit(TestAPI): @timeout() async def test_v2_reuse(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [orig_sda] = match(resp['disks'], id=disk_id) @@ -947,7 +953,7 @@ class TestEdit(TestAPI): class TestReformat(TestAPI): @timeout() async def test_reformat_msdos(self): - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' async with start_server(cfg) as inst: data = { 'disk_id': 'disk-sda', @@ -961,21 +967,22 @@ class TestReformat(TestAPI): class TestPartitionTableTypes(TestAPI): @timeout() async def test_ptable_gpt(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id='disk-sda') self.assertEqual('gpt', sda['ptable']) @timeout() async def test_ptable_msdos(self): - async with start_server('examples/many-nics-and-disks.json') as inst: + cfg = 'examples/machines/many-nics-and-disks.json' + async with start_server(cfg) as inst: resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id='disk-sda') self.assertEqual('msdos', sda['ptable']) @timeout() async def test_ptable_none(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id='disk-sda') self.assertEqual(None, sda['ptable']) @@ -984,7 +991,7 @@ class TestPartitionTableTypes(TestAPI): class TestTodos(TestAPI): # server indicators of required client actions @timeout() async def test_todos_simple(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.post('/storage/v2/reformat_disk', {'disk_id': disk_id}) @@ -1007,7 +1014,7 @@ class TestTodos(TestAPI): # server indicators of required client actions @timeout() async def test_todos_manual(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.post('/storage/v2/reformat_disk', {'disk_id': disk_id}) @@ -1035,7 +1042,7 @@ class TestTodos(TestAPI): # server indicators of required client actions @timeout() async def test_todos_guided(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.post('/storage/v2/reformat_disk', {'disk_id': 'disk-sda'}) self.assertTrue(resp['need_root']) @@ -1056,7 +1063,7 @@ class TestTodos(TestAPI): # server indicators of required client actions class TestInfo(TestAPI): @timeout() async def test_path(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id=disk_id) @@ -1064,7 +1071,7 @@ class TestInfo(TestAPI): @timeout() async def test_model_and_vendor(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id=disk_id) @@ -1073,7 +1080,8 @@ class TestInfo(TestAPI): @timeout() async def test_no_vendor(self): - async with start_server('examples/many-nics-and-disks.json') as inst: + cfg = 'examples/machines/many-nics-and-disks.json' + async with start_server(cfg) as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id=disk_id) @@ -1084,7 +1092,7 @@ class TestInfo(TestAPI): class TestFree(TestAPI): @timeout() async def test_free_only(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: await inst.post('/meta/free_only', enable=True) components = await inst.get('/mirror/disable_components') components.sort() @@ -1092,7 +1100,7 @@ class TestFree(TestAPI): @timeout() async def test_not_free_only(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: comps = ['universe', 'multiverse'] await inst.post('/mirror/disable_components', comps) await inst.post('/meta/free_only', enable=False) @@ -1103,7 +1111,7 @@ class TestFree(TestAPI): class TestOSProbe(TestAPI): @timeout() async def test_win10(self): - async with start_server('examples/win10.json') as inst: + async with start_server('examples/machines/win10.json') as inst: resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id='disk-sda') [sda1] = match(sda['partitions'], number=1) @@ -1121,7 +1129,7 @@ class TestOSProbe(TestAPI): class TestPartitionTableEditing(TestAPI): @timeout() async def test_use_free_space_after_existing(self): - cfg = 'examples/ubuntu-and-free-space.json' + cfg = 'examples/machines/ubuntu-and-free-space.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: # Disk has 3 existing partitions and free space. Add one to end. @@ -1159,7 +1167,8 @@ class TestPartitionTableEditing(TestAPI): @timeout() async def test_resize(self): - cfg = self.machineConfig('examples/ubuntu-and-free-space.json') + cfg = self.machineConfig( + 'examples/machines/ubuntu-and-free-space.json') with cfg.edit() as data: blockdev = data['storage']['blockdev'] sizes = {k: int(v['attrs']['size']) for k, v in blockdev.items()} @@ -1221,7 +1230,7 @@ class TestPartitionTableEditing(TestAPI): @timeout() async def test_est_min_size(self): - cfg = self.machineConfig('examples/win10-along-ubuntu.json') + cfg = self.machineConfig('examples/machines/win10-along-ubuntu.json') with cfg.edit() as data: fs = data['storage']['filesystem'] fs['/dev/sda1']['ESTIMATED_MIN_SIZE'] = 0 @@ -1240,7 +1249,7 @@ class TestPartitionTableEditing(TestAPI): @timeout() async def test_v2_orig_config(self): - cfg = 'examples/win10-along-ubuntu.json' + cfg = 'examples/machines/win10-along-ubuntu.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: start_resp = await inst.get('/storage/v2') @@ -1262,7 +1271,7 @@ class TestPartitionTableEditing(TestAPI): class TestGap(TestAPI): @timeout() async def test_blank_disk_is_one_big_gap(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/storage/v2') [sda] = match(resp['disks'], id='disk-sda') gap = sda['partitions'][0] @@ -1272,7 +1281,7 @@ class TestGap(TestAPI): @timeout() async def test_gap_at_end(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/storage/v2') [sda] = resp['disks'] [gap] = match(sda['partitions'], _type='Gap') @@ -1295,7 +1304,7 @@ class TestGap(TestAPI): @timeout() async def SKIP_test_two_gaps(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.post('/storage/v2/add_boot_partition', disk_id=disk_id) @@ -1336,7 +1345,7 @@ class TestGap(TestAPI): class TestRegression(TestAPI): @timeout() async def test_edit_not_trigger_boot_device(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: disk_id = 'disk-sda' resp = await inst.get('/storage/v2') [sda] = resp['disks'] @@ -1364,7 +1373,7 @@ class TestRegression(TestAPI): @timeout() async def test_osprober_knames(self): - cfg = 'examples/lp-1986676-missing-osprober.json' + cfg = 'examples/machines/lp-1986676-missing-osprober.json' async with start_server(cfg) as inst: resp = await inst.get('/storage/v2') [nvme] = match(resp['disks'], id='disk-nvme0n1') @@ -1384,7 +1393,8 @@ class TestRegression(TestAPI): # The old way this worked was to use changes to the 'format' value to # decide if a wipe was happening or not, and now the client chooses so # explicitly. - async with start_server('examples/win10-along-ubuntu.json') as inst: + cfg = 'examples/machines/win10-along-ubuntu.json' + async with start_server(cfg) as inst: resp = await inst.get('/storage/v2') [d1] = resp['disks'] [p5] = match(d1['partitions'], number=5) @@ -1415,7 +1425,8 @@ class TestRegression(TestAPI): @timeout() async def test_edit_should_leave_other_values_alone(self): - async with start_server('examples/win10-along-ubuntu.json') as inst: + cfg = 'examples/machines/win10-along-ubuntu.json' + async with start_server(cfg) as inst: async def check_preserve(): v1resp = await inst.get('/storage') [c_p5] = match(v1resp['config'], number=5) @@ -1457,7 +1468,7 @@ class TestRegression(TestAPI): @timeout() async def test_no_change_edit(self): - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: resp = await inst.get('/storage/v2') @@ -1488,7 +1499,7 @@ class TestRegression(TestAPI): > Exception: Filesystem(fstype='swap', ...) is already mounted Make sure editing the partition is ok now. ''' - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: resp = await inst.get('/storage/v2') @@ -1518,7 +1529,7 @@ class TestRegression(TestAPI): '''We want to offer the same list of fstypes for Subiquity and U-D-I, but the list is different today. Verify that unformatted partitions may be created.''' - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: resp = await inst.get('/storage/v2') @@ -1544,7 +1555,7 @@ class TestRegression(TestAPI): logical partition was resized to allow creation of more partitions, but the 1MiB space was not left between the newly created partition and the physically last partition.''' - cfg = 'examples/threebuntu-on-msdos.json' + cfg = 'examples/machines/threebuntu-on-msdos.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: resp = await inst.get('/storage/v2/guided') @@ -1579,7 +1590,7 @@ class TestRegression(TestAPI): tries to edit the previously created partition. The edit operation would fail in earlier versions because the new partition would have been discarded. ''' - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: names = ['locale', 'keyboard', 'source', 'network', 'proxy', @@ -1618,7 +1629,7 @@ class TestCancel(TestAPI): @timeout() async def test_cancel_drivers(self): with patch.dict(os.environ, {'SUBIQUITY_DEBUG': 'has-drivers'}): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: await inst.post('/source', source_id="placeholder", search_drivers=True) # /drivers?wait=true is expected to block until APT is @@ -1642,8 +1653,8 @@ class TestCancel(TestAPI): class TestDrivers(TestAPI): async def _test_source(self, source_id, expected_driver): with patch.dict(os.environ, {'SUBIQUITY_DEBUG': 'has-drivers'}): - cfg = 'examples/simple.json' - extra = ['--source-catalog', 'examples/mixed-sources.yaml'] + cfg = 'examples/machines/simple.json' + extra = ['--source-catalog', 'examples/sources/mixed-sources.yaml'] async with start_server(cfg, extra_args=extra) as inst: await inst.post('/source', source_id=source_id, search_drivers=True) @@ -1671,7 +1682,7 @@ class TestDrivers(TestAPI): async def test_listing_ongoing(self): ''' Ensure that the list of drivers returned by /drivers is null while the list has not been retrieved. ''' - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/drivers', wait=False) self.assertIsNone(resp['drivers']) @@ -1688,14 +1699,14 @@ class TestOEM(TestAPI): async def test_listing_ongoing(self): ''' Ensure that the list of OEM metapackages returned by /oem is null while the list has not been retrieved. ''' - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/oem', wait=False) self.assertIsNone(resp['metapackages']) async def test_listing_empty(self): expected_pkgs = [] with patch.dict(os.environ, {'SUBIQUITY_DEBUG': 'no-drivers'}): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: await inst.post('/source', source_id='ubuntu-server') names = ['locale', 'keyboard', 'source', 'network', 'proxy', 'mirror', 'storage'] @@ -1710,8 +1721,8 @@ class TestOEM(TestAPI): async def _test_listing_certified(self, source_id: str, expected: List[str]): with patch.dict(os.environ, {'SUBIQUITY_DEBUG': 'has-drivers'}): - args = ['--source-catalog', 'examples/mixed-sources.yaml'] - config = 'examples/simple.json' + args = ['--source-catalog', 'examples/sources/mixed-sources.yaml'] + config = 'examples/machines/simple.json' async with start_server(config, extra_args=args) as inst: await inst.post('/source', source_id=source_id) names = ['locale', 'keyboard', 'source', 'network', 'proxy', @@ -1740,7 +1751,7 @@ class TestOEM(TestAPI): class TestSource(TestAPI): @timeout() async def test_optional_search_drivers(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: await inst.post('/source', source_id='ubuntu-server') resp = await inst.get('/source') self.assertFalse(resp['search_drivers']) @@ -1759,7 +1770,7 @@ class TestSource(TestAPI): class TestIdentityValidation(TestAPI): @timeout() async def test_username_validation(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: resp = await inst.get('/identity/validate_username', username='plugdev') self.assertEqual(resp, 'SYSTEM_RESERVED') @@ -1784,7 +1795,7 @@ class TestIdentityValidation(TestAPI): class TestManyPrimaries(TestAPI): @timeout() async def test_create_primaries(self): - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = ['--storage-version', '2'] async with start_server(cfg, extra_args=extra) as inst: resp = await inst.get('/storage/v2') @@ -1824,7 +1835,7 @@ class TestManyPrimaries(TestAPI): class TestKeyboard(TestAPI): @timeout() async def test_input_source(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: data = {'layout': 'fr', 'variant': 'latin9'} await inst.post('/keyboard/input_source', data, user='foo') @@ -1832,7 +1843,7 @@ class TestKeyboard(TestAPI): class TestUbuntuProContractSelection(TestAPI): @timeout() async def test_upcs_flow(self): - async with start_server('examples/simple.json') as inst: + async with start_server('examples/machines/simple.json') as inst: # Wait should fail if no initiate first. with self.assertRaises(Exception): await inst.get('/ubuntu_pro/contract_selection/wait') @@ -1860,10 +1871,10 @@ class TestUbuntuProContractSelection(TestAPI): class TestAutoinstallServer(TestAPI): @timeout(2) async def test_make_view_requests(self): - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = [ - '--autoinstall', 'examples/autoinstall-short.yaml', - '--source-catalog', 'examples/install-sources.yaml', + '--autoinstall', 'examples/autoinstall/autoinstall-short.yaml', + '--source-catalog', 'examples/sources/install-sources.yaml', ] async with start_server(cfg, extra_args=extra, set_first_source=False) as inst: @@ -1889,7 +1900,7 @@ class TestAutoinstallServer(TestAPI): @timeout() async def test_interactive(self): - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' with tempfile.NamedTemporaryFile(mode='w') as tf: tf.write(''' version: 1 @@ -1911,7 +1922,8 @@ class TestAutoinstallServer(TestAPI): class TestWSLSetupOptions(TestAPI): @timeout() async def test_wslsetupoptions(self): - async with start_system_setup_server('examples/simple.json') as inst: + cfg = 'examples/machines/simple.json' + async with start_system_setup_server(cfg) as inst: await inst.post('/meta/client_variant', variant='wsl_setup') payload = {'install_language_support_packages': False} @@ -1929,7 +1941,8 @@ class TestActiveDirectory(TestAPI): async def test_ad(self): # Few tests to assert that the controller is properly wired. # Exhaustive validation test cases are in the unit tests. - async with start_server('examples/simple.json') as instance: + cfg = 'examples/machines/simple.json' + async with start_server(cfg) as instance: endpoint = '/active_directory' ad_dict = await instance.get(endpoint) # Starts with the detected domain. @@ -2024,10 +2037,10 @@ class TestActiveDirectory(TestAPI): @timeout() async def test_ad_autoinstall(self): - cfg = 'examples/simple.json' + cfg = 'examples/machines/simple.json' extra = [ - '--autoinstall', 'examples/autoinstall-ad.yaml', - '--source-catalog', 'examples/mixed-sources.yaml', + '--autoinstall', 'examples/autoinstall/autoinstall-ad.yaml', + '--source-catalog', 'examples/sources/mixed-sources.yaml', '--kernel-cmdline', 'autoinstall', ] try: diff --git a/subiquitycore/tests/test_prober.py b/subiquitycore/tests/test_prober.py index 01883c86..fbaf89cc 100644 --- a/subiquitycore/tests/test_prober.py +++ b/subiquitycore/tests/test_prober.py @@ -20,7 +20,7 @@ from subiquitycore.prober import Prober class TestProber(SubiTestCase): async def test_none_and_defaults_equal(self): - with open('examples/simple.json', 'r') as fp: + with open('examples/machines/simple.json', 'r') as fp: prober = Prober(machine_config=fp, debug_flags=()) none_storage = await prober.get_storage(probe_types=None) defaults_storage = await prober.get_storage(probe_types={'defaults'})