From b4006ba31dc2774de6f1466848eff39f68399b1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Tue, 13 Mar 2018 14:55:43 +0100
Subject: [PATCH] Added recommended size for partitions test.

---
 tests/test_partitions.py | 28 ++++++++++++++++++----------
 1 file changed, 18 insertions(+), 10 deletions(-)

diff --git a/tests/test_partitions.py b/tests/test_partitions.py
index 00c5c27f..d7f0fc22 100755
--- a/tests/test_partitions.py
+++ b/tests/test_partitions.py
@@ -28,24 +28,28 @@ paths = [
     {
         'mount_point': '/',
         'recommended_types': ('ext4',),
-        'min_size_gbytes': 14,
+        'min_size_gbytes': 9,
+        'reco_size_gbytes': 14,
         'min_available_gbytes': 4,
     },
     {
         'mount_point': '/home/msuser/msinstance',
-        'recommended_types': ('ext4', 'nfs', 'nfsv4'),
-        'min_size_gbytes': 300,
-        'min_available_gbytes': 15,
+        'recommended_types': ('ext4', 'nfs', 'nfs4'),
+        'min_size_gbytes': 5,
+        'reco_size_gbytes': 300,
+        'min_available_gbytes': 5,
     },
     {
         'mount_point': '/home/skyreach',
-        'recommended_types': ('ext4', 'nfs', 'nfsv4'),
-        'min_size_gbytes': 19,
-        'min_available_gbytes': 5,
+        'recommended_types': ('ext4', 'nfs', 'nfs4'),
+        'min_size_gbytes': 5,
+        'reco_size_gbytes': 9,
+        'min_available_gbytes': 2,
     },
     {
         'type': 'swap',
         'min_size_gbytes': 1,
+        'reco_size_gbytes': 2,
     },
 ]
 
@@ -129,9 +133,13 @@ def check_path(p):
         name = 'swap'
         psize = get_swap_gbytes()
 
-    if psize and psize < p['min_size_gbytes']:
-        print('Partition of %s is smaller than the minimum required size %s(%s GB < %s GB)%s.' % (name, RED, psize, p['min_size_gbytes'], DEF))
-        error = True
+    if psize:
+        if psize < p['min_size_gbytes']:
+            print('Partition of %s is smaller than the minimum required size %s(%s GB < %s GB)%s.' % (name, RED, psize, p['min_size_gbytes'], DEF))
+            error = True
+        elif psize < p['reco_size_gbytes']:
+            print('Partition of %s is smaller than the recommended size %s(%s GB < %s GB)%s.' % (name, YELLOW, psize, p['reco_size_gbytes'], DEF))
+            warning = True
 
 for p in paths:
     check_path(p)
-- 
GitLab