Commit Graph

37 Commits

Author SHA1 Message Date
Lukas Wagner
79a02b0e48 tests: remove vzdump_notification test
With the upcoming changes in how we send notifications, this one
really becomes pretty annoying to keep working. The location where
templates are looked up are defined in the proxmox_notify crate, so
there is no easy way to mock this for testing.
The test itself seemed not super valuable, mainly testing if
the backup logs are shortened if they ware too long - so they are just
removed.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
2024-06-03 14:16:35 +02:00
Fiona Ebner
464449239e Revert "tests: update expected replication log output"
This reverts commit 3a259c22e6.

There was an oversight with recent replication fixes that led to
attempting to remove snapshots that do not exist (in more scenarios).
While not an issue with real consequences, it's confusing to users.
This has since been fixed by pve-guest-common commit "replication:
snapshot cleanup: only attempt to remove snapshots that exist".

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2024-04-18 10:18:06 +02:00
Thomas Lamprecht
3a259c22e6 tests: update expected replication log output
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-04-17 21:16:02 +02:00
Lukas Wagner
a63ecef5a3 test: fix vzdump notification test
The signature of the PVE::Notify functions have changed, this commit
adapts the mocked functions so that the tests work again.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-11-17 16:20:03 +01:00
Wolfgang Bumiller
3571d98b5f fix mocking in notification tests
PVE::Notify::send_notification is now private (the mocking was for the
old api)

'cfs_read_file' gets exported into PVE::Notify before it gets mocked,
so it needs to be mocked inside PVE::Notify, not PVE::Cluster.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-08-16 11:58:22 +02:00
Lukas Wagner
d8e4ddb4ff test: rename mail_test.pl to vzdump_notification_test.pl
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-16 11:10:11 +02:00
Lukas Wagner
c4afde55f2 vzdump: send notifications via new notification module
... instead of using sendmail directly.

If the new 'notification-target' parameter is set,
we send the notification to this endpoint or group.
If 'mailto' is set, we add a temporary endpoint and a
temporary group containg both targets.

This commit also refactors the old 'sendmail' sub heavily:
  - Use template-based notification text instead of endless
    string concatenations
  - Removing the old plaintext/HTML table rendering in favor of
    the new template/property-based approach offered by the
    `proxmox-notify` crate.
  - Rename `sendmail` sub to `send_notification`
  - Breaking out some of the code into helper subs, hopefully
    reducing the spaghetti factor a bit

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-08-16 11:10:10 +02:00
Lukas Wagner
41275bae64 test: fix names of .PHONY targets
They need to have the same name as the target.
Took the opportunity to move the .PHONY right next to the target recipe,
so that mistakes like these are hopefully easier caught.

Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-07-24 15:58:11 +02:00
Thomas Lamprecht
89c0452d6e fix replication fail count tests & bump libpve-guest-common-perl b-d
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-27 18:53:27 +02:00
Dominik Csapak
8a6681900a fix tests in 'vzdump_new_test.pl'
commmit
b241deb7 ("close #3476: vzdump: add job-init hook")

introduces a 'cfs_update' in VZDump->new(), which overwrites our
carefully prepared storage/vm config which can break the tests

to prevent this, mock 'cfs_update' to do nothing, since we never
want to load the 'real' configs during tests anyway

fixes commit b241deb731

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2022-01-28 09:45:53 +01:00
Fabian Ebner
4af70154fd test: replication: remove mocking for obsolete volume_snapshot_list
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-11-09 11:33:16 +01:00
Fabian Ebner
3847fb5ec0 test: replication: mock volume_snapshot_info
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-11-09 11:33:16 +01:00
Fabian Ebner
0a7bd2d204 test: replication: avoid implicit return for volume_snapshot
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-11-09 11:33:16 +01:00
Fabian Ebner
1b06f7bc4e test: vzdump: adapt to new default
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-06-09 10:08:58 +02:00
Thomas Lamprecht
d7a63207a3 ceph: osd_belongs_to_node: only check tree-entries of type host, refactor
We want to check explicitly for type host, so filter for that first
and create a hash map for easier usage afterwards.

Drop the error when there's no tree, as either RADOS error'd on bad
command already, or there really is no tree (but RADOS worked OK), in
which case we simply return that the OSD did not belong to this node.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-04-20 18:06:07 +02:00
Dominic Jäger
e12c5dbf22 Add tests for OSD-belongs-to-node helper
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2021-04-20 16:42:12 +02:00
Fabian Ebner
52116f8b45 test: vzdump: rename vzdump_new_retention_test.pl to vzdump_new_test.pl
as it now also includes tests for new() with non-retention options.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
2021-02-19 16:34:32 +01:00
Fabian Ebner
99f125bc51 test: vzdump: add tests for mailto
Re-use the existing code, by allowing special kinds of 'tests' that just set
the options that are tested for.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Reviewed-By: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-02-19 16:33:43 +01:00
Thomas Lamprecht
492d4039a6 test: allow running replication tests in parallel
running multiple workers reduces built time from >3s to ~0.6s here.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-02 18:00:47 +01:00
Thomas Lamprecht
d59f1fa868 test: replication: cleanup use statements
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-02 17:59:51 +01:00
Thomas Lamprecht
41303e9779 test: buildsys: allow to execute vzdump tests in parallel
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-02 16:19:34 +01:00
Thomas Lamprecht
13f8e3b073 test: buildsys: rework target names, prefix with test
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2020-12-02 16:18:41 +01:00
Fabian Ebner
acc963c3e5 vzdump: defaults: correctly parse prune-backups and convert maxfiles
Also simplify handling in new(), now that we never have maxfiles there anymore.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-12-02 13:15:52 +01:00
Fabian Ebner
550d8e71e6 test: add tests for retention parameters for vzdump's new()
To get a more complete picture, instead of mocking storage_config,
PVE::Cluster's get_config is mocked. This ensures that the prune-backups
validation and the maxfiles conversion are also called.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-12-02 13:15:52 +01:00
Fabian Ebner
7f87414894 backup: include IDs for non-existent guests
Like this, there will be a backup task (within the big worker task)
for such IDs, which will then visibly (i.e. also visible in the
notification mail) fail with, e.g.:
unable to find VM '123'

In get_included_guests, the key '' was chosen for the orphaned IDs,
because it cannot possibly denote a nodename.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-10-22 16:29:26 +02:00
Fabian Ebner
83b2191464 remove outdated comment
Commit df5875b41e moved the
all/exclude logic into the single method

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2020-10-22 16:29:26 +02:00
Fabian Grünbichler
6a545c326c test: fix mail_test for non-root user
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-08-13 12:54:51 +02:00
Aaron Lauterer
5d807cf56d vzdump: test: adapt and add more tests that are possible now
Now, with the logic for `all` and `exclude` in the same single method,
additional tests for these cases are possible.

Adapt to hash return value of `get_included_guests`.

Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-06-17 15:16:06 +02:00
Aaron Lauterer
54df211432 vzdump: test: add first tests to the guest include logic
Signed-off-by: Aaron Lauterer <a.lauterer@proxmox.com>
2020-06-08 15:54:42 +02:00
Fabian Grünbichler
58d46211e5 test: s/expeted/expected
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-04-10 10:34:13 +02:00
Dominic Jäger
8b449830dd replication test: Add log rate and transport type
pve-guest-common got a new log line [0] for rate and transport type of a
replication. This line must be added to the replication tests.

[0] e90f586aab5caad4d4c5e18711316e8dc5225c07

Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2020-04-10 10:31:47 +02:00
Thomas Lamprecht
cd3b6b0177 allow to run some tests in parallel
the replication test are not yet ready for that, but the others can
be run in parallel

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-19 15:02:50 +01:00
Thomas Lamprecht
f1ea8ca4f1 followup: cleanup/refactor mail test
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2019-11-19 15:02:50 +01:00
Dominic Jäger
ce84a9506d Fix #352: Limit the length of backup logs for mails
When creating a backup the log part can make the mail too big to be
transferred. To ensure delivery, two measures are taken:
1. Always omit the status lines
2. Omit the whole log part if a mail becomes (too) big

Additionally, add a check for missing log files.

Co-developed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Dominic Jäger <d.jaeger@proxmox.com>
2019-11-19 15:02:50 +01:00
Fabian Grünbichler
33cd5dfefe test: also mock cfs_read_file
needed for tests to work without a functional running pmxcfs instance.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:25:35 +01:00
Fabian Grünbichler
fe57e096cc test: mock PVE::SSHInfo module
since it is now used for getting a cluster node's migration IP address.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-11-18 12:25:35 +01:00
Thomas Lamprecht
73ed0af158 cleanup: move bin/test to toplevel
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-20 13:04:51 +02:00