public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup
@ 2024-12-03 12:23 Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 1/4] auto-installer: tests: add tests for raid level case-insensitivity Christoph Heiss
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Christoph Heiss @ 2024-12-03 12:23 UTC (permalink / raw)
  To: pve-devel

First off, it defines all auto-installer "parse answer" tests in a
declaratively manner, such that each test actually represent a single
rust unit test. Improves developer UX a bit and makes better use of the
built-in facilities of `cargo test`.

Then it also introduces the `pretty_assertions` crate (as a
dev-dependency only, tho) for all object comparison - primarily the
answer file parsing/validation tests. This makes failures way easier to
observe and quickly reason about.

No functional changes in the entire series.

Christoph Heiss (4):
  auto-installer: tests: add tests for raid level case-insensitivity
  auto-installer: tests: create separate unit test for each answer file
  auto-installer: tests: add diff'ed assertions for answer parsing tests
  tui: use pretty_assertions for object equal asserts

 debian/control                                |  1 +
 proxmox-auto-installer/Cargo.toml             |  3 +
 proxmox-auto-installer/tests/parse-answer.rs  | 87 +++++++++++--------
 .../btrfs_raid_level_uppercase.json           | 23 +++++
 .../btrfs_raid_level_uppercase.toml           | 15 ++++
 .../{first-boot.json => first_boot.json}      |  0
 .../{first-boot.toml => first_boot.toml}      |  0
 .../zfs_raid_level_uppercase.json             | 30 +++++++
 .../zfs_raid_level_uppercase.toml             | 15 ++++
 proxmox-tui-installer/Cargo.toml              |  3 +
 proxmox-tui-installer/src/options.rs          |  8 +-
 11 files changed, 143 insertions(+), 42 deletions(-)
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.toml
 rename proxmox-auto-installer/tests/resources/parse_answer/{first-boot.json => first_boot.json} (100%)
 rename proxmox-auto-installer/tests/resources/parse_answer/{first-boot.toml => first_boot.toml} (100%)
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml

-- 
2.47.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 1/4] auto-installer: tests: add tests for raid level case-insensitivity
  2024-12-03 12:23 [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup Christoph Heiss
@ 2024-12-03 12:23 ` Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 2/4] auto-installer: tests: create separate unit test for each answer file Christoph Heiss
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2024-12-03 12:23 UTC (permalink / raw)
  To: pve-devel

This was fixed as a regression for ZFS and Btrfs in [0] and [1],
respectively - to ensure it won't happen again, add some tests as it
should be.

[0] a9e5f37 ("common: allow lowercase and uppercase zfs raid levels")
[1] 33d53b9 ("common: allow lowercase and uppercase btrfs raid levels")

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 .../btrfs_raid_level_uppercase.json           | 23 ++++++++++++++
 .../btrfs_raid_level_uppercase.toml           | 15 ++++++++++
 .../zfs_raid_level_uppercase.json             | 30 +++++++++++++++++++
 .../zfs_raid_level_uppercase.toml             | 15 ++++++++++
 4 files changed, 83 insertions(+)
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.toml
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
 create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml

diff --git a/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
new file mode 100644
index 0000000..0c5e9d0
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
@@ -0,0 +1,23 @@
+{
+  "autoreboot": 1,
+  "cidr": "192.168.1.114/24",
+  "country": "at",
+  "dns": "192.168.1.254",
+  "domain": "testinstall",
+  "disk_selection": {
+    "6": "6",
+    "7": "7"
+  },
+  "filesys": "btrfs (RAID1)",
+  "gateway": "192.168.1.1",
+  "hdsize": 223.57088470458984,
+  "existing_storage_auto_rename": 1,
+  "hostname": "pveauto",
+  "keymap": "de",
+  "mailto": "mail@no.invalid",
+  "mngmt_nic": "eno1",
+  "root_password": { "plain": "123456" },
+  "timezone": "Europe/Vienna",
+  "btrfs_opts": { "compress": "off" },
+  "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.toml b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.toml
new file mode 100644
index 0000000..17799af
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.toml
@@ -0,0 +1,15 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root_password = "123456"
+
+[network]
+source = "from-dhcp"
+
+[disk-setup]
+filesystem = "btrfs"
+disk_list = ["sda", "sdb"]
+btrfs.raid = "RAID1"
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
new file mode 100644
index 0000000..a8b182c
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
@@ -0,0 +1,30 @@
+{
+  "autoreboot": 1,
+  "cidr": "192.168.1.114/24",
+  "country": "at",
+  "dns": "192.168.1.254",
+  "domain": "testinstall",
+  "disk_selection": {
+    "6": "6",
+    "7": "7",
+    "8": "8"
+  },
+  "filesys": "zfs (RAIDZ-1)",
+  "gateway": "192.168.1.1",
+  "hdsize": 223.57088470458984,
+  "existing_storage_auto_rename": 1,
+  "hostname": "pveauto",
+  "keymap": "de",
+  "mailto": "mail@no.invalid",
+  "mngmt_nic": "eno1",
+  "root_password": { "plain": "123456" },
+  "timezone": "Europe/Vienna",
+  "zfs_opts": {
+    "arc_max": 2048,
+    "ashift": 12,
+    "checksum": "on",
+    "compress": "on",
+    "copies": 1
+  },
+  "first_boot": { "enabled": 0 }
+}
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml
new file mode 100644
index 0000000..b797b00
--- /dev/null
+++ b/proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml
@@ -0,0 +1,15 @@
+[global]
+keyboard = "de"
+country = "at"
+fqdn = "pveauto.testinstall"
+mailto = "mail@no.invalid"
+timezone = "Europe/Vienna"
+root_password = "123456"
+
+[network]
+source = "from-dhcp"
+
+[disk-setup]
+filesystem = "zfs"
+disk_list = ["sda", "sdb", "sdc"]
+zfs.raid = "RAIDZ-1"
-- 
2.47.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 2/4] auto-installer: tests: create separate unit test for each answer file
  2024-12-03 12:23 [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 1/4] auto-installer: tests: add tests for raid level case-insensitivity Christoph Heiss
@ 2024-12-03 12:23 ` Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 3/4] auto-installer: tests: add diff'ed assertions for answer parsing tests Christoph Heiss
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2024-12-03 12:23 UTC (permalink / raw)
  To: pve-devel

Defines all auto-installer "parse answer" tests in a declaratively
manner, such that each test actually represent a single rust unit test.

This improves the overall developer experience by having a proper,
separate test function for each answer parsing test - making better use
of the built-in facilities of `cargo test` at the same time.

Also means that a failing test won't cancel all other tests.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-auto-installer/tests/parse-answer.rs  | 83 +++++++++++--------
 .../{first-boot.json => first_boot.json}      |  0
 .../{first-boot.toml => first_boot.toml}      |  0
 3 files changed, 47 insertions(+), 36 deletions(-)
 rename proxmox-auto-installer/tests/resources/parse_answer/{first-boot.json => first_boot.json} (100%)
 rename proxmox-auto-installer/tests/resources/parse_answer/{first-boot.toml => first_boot.toml} (100%)

diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index 65f8c1e..f6450cf 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -19,7 +19,7 @@ fn get_test_resource_path() -> Result<PathBuf, String> {
 }
 
 fn get_answer(path: impl AsRef<Path>) -> Result<Answer, String> {
-    let answer_raw = std::fs::read_to_string(path).unwrap();
+    let answer_raw = fs::read_to_string(path).unwrap();
     let answer: answer::Answer = toml::from_str(&answer_raw)
         .map_err(|err| format!("error parsing answer.toml: {err}"))
         .unwrap();
@@ -27,7 +27,7 @@ fn get_answer(path: impl AsRef<Path>) -> Result<Answer, String> {
     Ok(answer)
 }
 
-pub fn setup_test_basic(path: impl AsRef<Path>) -> (SetupInfo, LocaleInfo, RuntimeInfo, UdevInfo) {
+fn setup_test_basic(path: impl AsRef<Path>) -> (SetupInfo, LocaleInfo, RuntimeInfo, UdevInfo) {
     let (installer_info, locale_info, mut runtime_info) =
         load_installer_setup_files(&path).unwrap();
 
@@ -46,40 +46,51 @@ pub fn setup_test_basic(path: impl AsRef<Path>) -> (SetupInfo, LocaleInfo, Runti
     (installer_info, locale_info, runtime_info, udev_info)
 }
 
-#[test]
-fn test_parse_answers() {
-    let path = get_test_resource_path().unwrap();
-    let (setup_info, locales, runtime_info, udev_info) = setup_test_basic(&path);
-    let mut tests_path = path;
-    tests_path.push("parse_answer");
-    let test_dir = fs::read_dir(tests_path.clone()).unwrap();
-
-    for file_entry in test_dir {
-        let file = file_entry.unwrap();
-        if !file.file_type().unwrap().is_file() || file.file_name() == "readme" {
-            continue;
-        }
-        let p = file.path();
-        let name = p.file_stem().unwrap().to_str().unwrap();
-        let extension = p.extension().unwrap().to_str().unwrap();
-        if extension == "toml" {
-            println!("Test: {name}");
-            let answer = get_answer(p.clone()).unwrap();
-            let config =
-                &parse_answer(&answer, &udev_info, &runtime_info, &locales, &setup_info).unwrap();
-            println!("Selected disks: {:#?}", &config.disk_selection);
-            let config_json = serde_json::to_string(config);
-            let config: Value = serde_json::from_str(config_json.unwrap().as_str()).unwrap();
-            let mut path = tests_path.clone();
-            path.push(format!("{name}.json"));
-            let compare_raw = std::fs::read_to_string(&path).unwrap();
-            let compare: Value = serde_json::from_str(&compare_raw).unwrap();
-            if config != compare {
-                panic!(
-                    "Test {} failed:\nleft:  {:#?}\nright: {:#?}\n",
-                    name, config, compare
-                );
-            }
+fn run_named_test(name: &str) {
+    let resource_path = get_test_resource_path().unwrap();
+    let (setup_info, locales, runtime_info, udev_info) = setup_test_basic(&resource_path);
+
+    let answer_path = resource_path.join(format!("parse_answer/{name}.toml"));
+
+    let answer = get_answer(&answer_path).unwrap();
+    let config = &parse_answer(&answer, &udev_info, &runtime_info, &locales, &setup_info).unwrap();
+
+    let config_json = serde_json::to_string(config);
+    let config: Value = serde_json::from_str(config_json.unwrap().as_str()).unwrap();
+
+    let json_path = resource_path.join(format!("parse_answer/{name}.json"));
+    let compare_raw = fs::read_to_string(&json_path).unwrap();
+    let compare: Value = serde_json::from_str(&compare_raw).unwrap();
+    assert_eq!(config, compare);
+}
+
+mod tests {
+    mod parse_answer {
+        use super::super::run_named_test;
+
+        macro_rules! declare_named_tests {
+            ($name:ident, $( $rest:ident ),* $(,)?) => { declare_named_tests!($name); declare_named_tests!($( $rest ),+); };
+            ($name:ident) => {
+                #[test]
+                fn $name() {
+                    run_named_test(&stringify!($name));
+                }
+            };
         }
+
+        declare_named_tests!(
+            btrfs,
+            btrfs_raid_level_uppercase,
+            disk_match,
+            disk_match_all,
+            disk_match_any,
+            first_boot,
+            hashed_root_password,
+            minimal,
+            nic_matching,
+            specific_nic,
+            zfs,
+            zfs_raid_level_uppercase,
+        );
     }
 }
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/first-boot.json b/proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
similarity index 100%
rename from proxmox-auto-installer/tests/resources/parse_answer/first-boot.json
rename to proxmox-auto-installer/tests/resources/parse_answer/first_boot.json
diff --git a/proxmox-auto-installer/tests/resources/parse_answer/first-boot.toml b/proxmox-auto-installer/tests/resources/parse_answer/first_boot.toml
similarity index 100%
rename from proxmox-auto-installer/tests/resources/parse_answer/first-boot.toml
rename to proxmox-auto-installer/tests/resources/parse_answer/first_boot.toml
-- 
2.47.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 3/4] auto-installer: tests: add diff'ed assertions for answer parsing tests
  2024-12-03 12:23 [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 1/4] auto-installer: tests: add tests for raid level case-insensitivity Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 2/4] auto-installer: tests: create separate unit test for each answer file Christoph Heiss
@ 2024-12-03 12:23 ` Christoph Heiss
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 4/4] tui: use pretty_assertions for object equal asserts Christoph Heiss
  2024-12-03 17:20 ` [pve-devel] applied-series: [PATCH installer 0/4] auto, tui: improve rust unit test setup Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2024-12-03 12:23 UTC (permalink / raw)
  To: pve-devel

Adds the `pretty_assertions` crate [0] as dev-dependency, which does
this very nicely. This makes failures way easier to observe and quickly
reason about.

See also [1] for the initial discussion about this.

[0] https://docs.rs/pretty_assertions
[1] https://lore.proxmox.com/pve-devel/a35eafb9-cbba-4d79-8535-d2bc7c5560ee@proxmox.com/

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 debian/control                               | 1 +
 proxmox-auto-installer/Cargo.toml            | 3 +++
 proxmox-auto-installer/tests/parse-answer.rs | 6 +++---
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/debian/control b/debian/control
index fd0f4df..ee1fc44 100644
--- a/debian/control
+++ b/debian/control
@@ -25,6 +25,7 @@ Build-Depends: cargo:native,
                librust-sha2-0.10-dev,
                librust-toml-0.8-dev,
                librust-ureq-2.10-dev,
+               librust-pretty-assertions-1.4-dev,
                libtest-mockmodule-perl,
                patchelf,
                perl,
diff --git a/proxmox-auto-installer/Cargo.toml b/proxmox-auto-installer/Cargo.toml
index 7e3d90c..d06478f 100644
--- a/proxmox-auto-installer/Cargo.toml
+++ b/proxmox-auto-installer/Cargo.toml
@@ -21,3 +21,6 @@ toml.workspace = true
 
 clap = { version = "4.0", features = ["derive"] }
 glob = "0.3"
+
+[dev-dependencies]
+pretty_assertions = "1.4"
diff --git a/proxmox-auto-installer/tests/parse-answer.rs b/proxmox-auto-installer/tests/parse-answer.rs
index f6450cf..68b3834 100644
--- a/proxmox-auto-installer/tests/parse-answer.rs
+++ b/proxmox-auto-installer/tests/parse-answer.rs
@@ -1,7 +1,6 @@
-use std::path::{Path, PathBuf};
-
 use serde_json::Value;
 use std::fs;
+use std::path::{Path, PathBuf};
 
 use proxmox_auto_installer::answer;
 use proxmox_auto_installer::answer::Answer;
@@ -61,7 +60,8 @@ fn run_named_test(name: &str) {
     let json_path = resource_path.join(format!("parse_answer/{name}.json"));
     let compare_raw = fs::read_to_string(&json_path).unwrap();
     let compare: Value = serde_json::from_str(&compare_raw).unwrap();
-    assert_eq!(config, compare);
+
+    pretty_assertions::assert_eq!(config, compare);
 }
 
 mod tests {
-- 
2.47.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] [PATCH installer 4/4] tui: use pretty_assertions for object equal asserts
  2024-12-03 12:23 [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup Christoph Heiss
                   ` (2 preceding siblings ...)
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 3/4] auto-installer: tests: add diff'ed assertions for answer parsing tests Christoph Heiss
@ 2024-12-03 12:23 ` Christoph Heiss
  2024-12-03 17:20 ` [pve-devel] applied-series: [PATCH installer 0/4] auto, tui: improve rust unit test setup Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Christoph Heiss @ 2024-12-03 12:23 UTC (permalink / raw)
  To: pve-devel

Using the previously introduced `pretty_assertions` crates for object
comparisons improves developer UX quite a bit, making failures easier to
observe and quickly reason about.

Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
---
 proxmox-tui-installer/Cargo.toml     | 3 +++
 proxmox-tui-installer/src/options.rs | 8 ++++----
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/proxmox-tui-installer/Cargo.toml b/proxmox-tui-installer/Cargo.toml
index 4b11576..3db7d73 100644
--- a/proxmox-tui-installer/Cargo.toml
+++ b/proxmox-tui-installer/Cargo.toml
@@ -14,3 +14,6 @@ serde_json.workspace = true
 regex.workspace = true
 
 cursive = { version = "0.21", default-features = false, features = ["crossterm-backend"] }
+
+[dev-dependencies]
+pretty_assertions = "1.4"
diff --git a/proxmox-tui-installer/src/options.rs b/proxmox-tui-installer/src/options.rs
index b14ecf7..e2116d2 100644
--- a/proxmox-tui-installer/src/options.rs
+++ b/proxmox-tui-installer/src/options.rs
@@ -144,7 +144,7 @@ mod tests {
             hostname: Some("foo".to_owned()),
         };
 
-        assert_eq!(
+        pretty_assertions::assert_eq!(
             NetworkOptions::defaults_from(&setup, &info),
             NetworkOptions {
                 ifname: "eth0".to_owned(),
@@ -156,7 +156,7 @@ mod tests {
         );
 
         info.hostname = None;
-        assert_eq!(
+        pretty_assertions::assert_eq!(
             NetworkOptions::defaults_from(&setup, &info),
             NetworkOptions {
                 ifname: "eth0".to_owned(),
@@ -168,7 +168,7 @@ mod tests {
         );
 
         info.dns.domain = None;
-        assert_eq!(
+        pretty_assertions::assert_eq!(
             NetworkOptions::defaults_from(&setup, &info),
             NetworkOptions {
                 ifname: "eth0".to_owned(),
@@ -180,7 +180,7 @@ mod tests {
         );
 
         info.hostname = Some("foo".to_owned());
-        assert_eq!(
+        pretty_assertions::assert_eq!(
             NetworkOptions::defaults_from(&setup, &info),
             NetworkOptions {
                 ifname: "eth0".to_owned(),
-- 
2.47.0



_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [pve-devel] applied-series:  [PATCH installer 0/4] auto, tui: improve rust unit test setup
  2024-12-03 12:23 [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup Christoph Heiss
                   ` (3 preceding siblings ...)
  2024-12-03 12:23 ` [pve-devel] [PATCH installer 4/4] tui: use pretty_assertions for object equal asserts Christoph Heiss
@ 2024-12-03 17:20 ` Thomas Lamprecht
  4 siblings, 0 replies; 6+ messages in thread
From: Thomas Lamprecht @ 2024-12-03 17:20 UTC (permalink / raw)
  To: Proxmox VE development discussion, Christoph Heiss

Am 03.12.24 um 13:23 schrieb Christoph Heiss:
> First off, it defines all auto-installer "parse answer" tests in a
> declaratively manner, such that each test actually represent a single
> rust unit test. Improves developer UX a bit and makes better use of the
> built-in facilities of `cargo test`.
> 
> Then it also introduces the `pretty_assertions` crate (as a
> dev-dependency only, tho) for all object comparison - primarily the
> answer file parsing/validation tests. This makes failures way easier to
> observe and quickly reason about.
> 
> No functional changes in the entire series.
> 
> Christoph Heiss (4):
>   auto-installer: tests: add tests for raid level case-insensitivity
>   auto-installer: tests: create separate unit test for each answer file
>   auto-installer: tests: add diff'ed assertions for answer parsing tests
>   tui: use pretty_assertions for object equal asserts
> 
>  debian/control                                |  1 +
>  proxmox-auto-installer/Cargo.toml             |  3 +
>  proxmox-auto-installer/tests/parse-answer.rs  | 87 +++++++++++--------
>  .../btrfs_raid_level_uppercase.json           | 23 +++++
>  .../btrfs_raid_level_uppercase.toml           | 15 ++++
>  .../{first-boot.json => first_boot.json}      |  0
>  .../{first-boot.toml => first_boot.toml}      |  0
>  .../zfs_raid_level_uppercase.json             | 30 +++++++
>  .../zfs_raid_level_uppercase.toml             | 15 ++++
>  proxmox-tui-installer/Cargo.toml              |  3 +
>  proxmox-tui-installer/src/options.rs          |  8 +-
>  11 files changed, 143 insertions(+), 42 deletions(-)
>  create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.json
>  create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/btrfs_raid_level_uppercase.toml
>  rename proxmox-auto-installer/tests/resources/parse_answer/{first-boot.json => first_boot.json} (100%)
>  rename proxmox-auto-installer/tests/resources/parse_answer/{first-boot.toml => first_boot.toml} (100%)
>  create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.json
>  create mode 100644 proxmox-auto-installer/tests/resources/parse_answer/zfs_raid_level_uppercase.toml
> 


applied series, thanks!


_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-03 17:21 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-03 12:23 [pve-devel] [PATCH installer 0/4] auto, tui: improve rust unit test setup Christoph Heiss
2024-12-03 12:23 ` [pve-devel] [PATCH installer 1/4] auto-installer: tests: add tests for raid level case-insensitivity Christoph Heiss
2024-12-03 12:23 ` [pve-devel] [PATCH installer 2/4] auto-installer: tests: create separate unit test for each answer file Christoph Heiss
2024-12-03 12:23 ` [pve-devel] [PATCH installer 3/4] auto-installer: tests: add diff'ed assertions for answer parsing tests Christoph Heiss
2024-12-03 12:23 ` [pve-devel] [PATCH installer 4/4] tui: use pretty_assertions for object equal asserts Christoph Heiss
2024-12-03 17:20 ` [pve-devel] applied-series: [PATCH installer 0/4] auto, tui: improve rust unit test setup Thomas Lamprecht

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal