Commit Graph

25 Commits

Author SHA1 Message Date
Thomas Lamprecht
188eb9c374 tests: preset RBD fsid to avoid unavailable rados command
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-28 18:20:52 +02:00
Thomas Lamprecht
5620282fbd cfg2cmd: add btrfs-store and test for cache mode
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-06-24 18:42:55 +02:00
Thomas Lamprecht
ce11958aab tests: do not use for-loop for globs
they are rather inefficient for this

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:32:31 +02:00
Thomas Lamprecht
808a65b522 fix some FH close
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-10-19 15:30:53 +02:00
Thomas Lamprecht
3eb2f3eb56 followup cleanup
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 10:44:00 +02:00
Thomas Lamprecht
1e27bda1aa tests: cfg2cmd: check also warnings
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 10:38:27 +02:00
Thomas Lamprecht
90d96715f8 tests: cfg2cmd: get testname earlier
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-08-21 10:38:08 +02:00
Fabian Grünbichler
121e340094 cfg2cmd test: hardcode/mock bridge MTU
otherwise the netdev test reads the MTU value from the test host's vmbr0
bridge, or fails if no such bridge exists.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-06-17 10:39:47 +02:00
Stefan Reiter
5bc084707b cfg2cmd: add test cases for custom CPU models
Requires a mock CPU-model config, which is given as a raw string to also
test parsing capabilities. Also tests defaulting behaviour.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
Reviewed-By: Fabian Ebner <f.ebner@proxmox.com>
Tested-By: Fabian Ebner <f.ebner@proxmox.com>
2020-04-07 17:27:58 +02:00
Stefan Reiter
ac0077cc33 Use 'QEMU version' -> '+pve-version' mapping for machine types
The previously introduced approach can fail for pinned versions when a
new QEMU release is introduced. The saner approach is to use a mapping
that gives one pve-version for each QEMU release.

Fortunately, the old system has not been bumped yet, so we can still
change it without too much effort.

QEMU versions without a mapping are assumed to be pve0, 4.1 is mapped to
pve1 since thats what we had as our default previously.

Pinned machine versions (i.e. pc-i440fx-4.1) are always assumed to be
pve0, for specific pve-versions they'd have to be pinned as well (i.e.
pc-i440fx-4.1+pve1).

The new logic also makes the pve-version dynamic, and starts VMs with
the lowest possible 'feature-level', i.e. if a feature is only available
with 4.1+pve2, but the VM isn't using it, we still start it with
4.1+pve0.

We die if we don't support a version that is requested from us. This
allows us to use the pve-version as live-migration blocks (i.e. bumping
the version and then live-migrating a VM which uses the new feature (so
is running with the bumped version) to an outdated node will present the
user with a helpful error message and fail instead of silently modifying
the config and only failing *after* the migration).

$version_guard is introduced in config_to_command to use for features
that need to check pve-version, it automatically handles selecting the
newest necessary pve-version for the VM.

Tests have to be adjusted, since all of them now resolve to pve0 instead
of pve1. EXPECT_ERROR matching is changed to use 'eq' instead of regex
to allow special characters in error messages.

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2020-02-12 10:32:57 +01:00
Thomas Lamprecht
a546da0319 cfg2cmd: allow to test for expected error messages
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-10 11:08:33 +01:00
Thomas Lamprecht
38277afcd4 qemu-server: make nodename mock-able for tests
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-12-10 11:08:33 +01:00
Stefan Reiter
6db4c69e1d cfg2cmd: test runs_at_least_qemu_version and version_cmp explicitly
Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:42:49 +01:00
Stefan Reiter
8b26544e50 cfg2cmd: minor cleanup
We never shipped a 4.1.0 QEMU, so it makes more sense to test as 4.1.1

Signed-off-by: Stefan Reiter <s.reiter@proxmox.com>
2019-12-09 11:42:49 +01:00
Dominik Csapak
0360faadc7 cfg2cmd test: add tests for multifunction devices
by mocking the lspci call

the mocked lspci code is basically the same as the real one,
only difference is the source of the devices and
there is no verbose flag

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2019-12-09 11:30:14 +01:00
Thomas Lamprecht
69f4bd3434 test: cfg2cmd: do NOT sort expected/actual commands
In general it matters where a command line options is positioned
inside a QEMU command, so we want to actually also check the order in
the cfg2cmd test

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-10-09 08:08:24 +02:00
Thomas Lamprecht
ff9e7dc1bb cfg2cmd: mock SPICE/VNC port allocation methods
to make them independent of environment, else other running VMs or
quickly sequential test runs may result in false negative test
results, as the port differed.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-09-21 13:41:09 +02:00
Thomas Lamprecht
987e7ab4e4 test: config2command: fallback to hardcoded version
especially useful when bootstrapping, where  pve-qemu-kvm may not yet
be build

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-05-22 18:37:04 +02:00
Thomas Lamprecht
db70021bcf config2command test: mock kernel_has_vhost_net
just return true for now, the use is guarded by an 'is_native($arch)'
check anyway.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-20 10:44:15 +01:00
Thomas Lamprecht
e1bdc0debc config2command test: diff: use /proc/self/fd
/dev/fd works only through some compatibility hacks in some shells,
use the correct one for Linux: /proc/self/fd/*

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-20 10:38:09 +01:00
Thomas Lamprecht
66c539947a config2command test: mock kvm_version too
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-20 10:27:21 +01:00
Thomas Lamprecht
8256220068 t/cfg2cmd: ensure tests can pass again
the change to use a real diff to check tests, with it's nicer output
for failing cases, failed to ensure that the test system knew if a
case passed - earlier done indirectly by 'is_deeply', thus add a
manual 'pass' call if the tes was OK.
Further, the firs test failing aborted everything, which isn't to
nice, normally it's much more convenient if all test get run and one
can view at the results of all of them. So put the diff in an eval
and fail/note the test manually.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-11 10:45:03 +01:00
Wolfgang Bumiller
3dc780c643 t/cfg2cmd: replace is_deeply with diff
(The diff() sub is copied from our pve-common's network
interfaces test scripts)

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-11 10:44:04 +01:00
Wolfgang Bumiller
a774013569 t/cfg2cmd: mock iscsi initiator name
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Acked-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-12-11 10:44:04 +01:00
Thomas Lamprecht
7b963e5762 add config to command tests
To have a better safety net for not introducing regressions and also
some functional checks as the QEMU command defines the layout
behavior of the VM.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-12-11 10:44:04 +01:00