Configuration en variables + tests unitaires BATS

- Conversion config hardcodée en variables (CLUSTER_NODES)
- Détection nœud distant data-driven (extensible à 3+ nœuds)
- Tests unitaires BATS avec mocks complets (32 tests)
- CI/CD Forgejo avec shellcheck et validation syntaxe
- Mode test pour sourcing sans exécution du main
This commit is contained in:
Tellsanguis 2025-12-29 12:29:46 +01:00
parent de4b630399
commit dfa5078b47
8 changed files with 908 additions and 15 deletions

9
tests/fixtures/zfs_list_snapshots.txt vendored Normal file
View file

@ -0,0 +1,9 @@
NAME USED AVAIL REFER MOUNTPOINT
zpool1 5.12T 2.55T 192K /zpool1
zpool1/data-nfs-share 4.89T 2.55T 4.89T /zpool1/data-nfs-share
zpool1/data-nfs-share@autosnap_2024-12-29_14:00:00 128M - 4.89T -
zpool1/data-nfs-share@autosnap_2024-12-29_14:15:00 256M - 4.89T -
zpool1/data-nfs-share@autosnap_2024-12-29_14:30:00 64M - 4.89T -
zpool1/pbs-backups 230G 2.55T 230G /zpool1/pbs-backups
zpool1/pbs-backups@autosnap_2024-12-29_14:00:00 10M - 230G -
zpool1/pbs-backups@autosnap_2024-12-29_14:15:00 15M - 230G -

View file

@ -0,0 +1,15 @@
pool: zpool1
state: DEGRADED
status: One or more devices has been removed by the administrator.
Sufficient replicas exist for the pool to continue functioning in a
degraded state.
action: Online the device using 'zpool online' or replace the device with
'zpool replace'.
scan: scrub repaired 0B in 0 days 02:15:32 with 0 errors on Sun Dec 15 02:39:32 2024
config:
NAME STATE READ WRITE CKSUM
zpool1 DEGRADED 0 0 0
/dev/disk/by-id/wwn-0x5000cca2dfe2e414 UNAVAIL 0 0 0
errors: No known data errors

10
tests/fixtures/zpool_status_healthy.txt vendored Normal file
View file

@ -0,0 +1,10 @@
pool: zpool1
state: ONLINE
scan: scrub repaired 0B in 0 days 02:15:32 with 0 errors on Sun Dec 15 02:39:32 2024
config:
NAME STATE READ WRITE CKSUM
zpool1 ONLINE 0 0 0
/dev/disk/by-id/wwn-0x5000cca2dfe2e414 ONLINE 0 0 0
errors: No known data errors