File tree Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Expand file tree Collapse file tree 4 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 9
9
# Backend filesystem of the exported shares
10
10
backend : glusterfs
11
11
12
+ # Additional information which may be used by tests here
13
+ # some tests may be skipped if the required config option is not set
14
+ extra :
15
+ # The supplementary group to be used by test_permissions
16
+ supplementary_group : test_sg
17
+
18
+
12
19
# shares: List of dict of exported shares
13
20
shares :
14
21
# share export1
Original file line number Diff line number Diff line change @@ -62,3 +62,16 @@ def test_generate_exported_shares():
62
62
arr .append ((share ["server" ], share ["name" ]))
63
63
assert len (arr ) == 1
64
64
assert ("server_name" , "export2" ) in arr
65
+
66
+
67
+ def test_get_extra_configuration ():
68
+ testinfo = testhelper .read_yaml ("test-info1.yml" )
69
+ sg = testhelper .get_extra_configuration (testinfo , "supplementary_group" )
70
+ assert sg == "test_sg" , "Could not read extra configuration"
71
+ other = testhelper .get_extra_configuration (testinfo , "other" )
72
+ assert other is None , "Incorrectly read other from extra configuration"
73
+
74
+ # test-info2.yml does not have extra section
75
+ testinfo = testhelper .read_yaml ("test-info2.yml" )
76
+ sg = testhelper .get_extra_configuration (testinfo , "supplementary_group" )
77
+ assert sg is None , "Could not read extra configuration"
Original file line number Diff line number Diff line change 9
9
# Backend filesystem of the exported shares
10
10
backend: glusterfs
11
11
12
+ # Additional information which may be used by tests here
13
+ # some tests may be skipped if the required config option is not set
14
+ extra:
15
+ # The supplementary group to be used by test_supplementary_group
16
+ supplementary_group: sg
17
+
12
18
# shares: List of dict of exported shares
13
19
shares:
14
20
# share export1
Original file line number Diff line number Diff line change @@ -192,3 +192,18 @@ def get_exported_shares(test_info: dict) -> typing.List[str]:
192
192
if not is_premounted_share (share ):
193
193
arr .append (share ["name" ])
194
194
return arr
195
+
196
+
197
+ def get_extra_configuration (test_info : dict , extra_var : str ) -> typing .Any :
198
+ """Return value of config set in extra section
199
+
200
+ Parameters:
201
+ test_info: Dict containing the parsed yaml file
202
+ extra_var: string containing extra config value required
203
+ Returns:
204
+ value set for the extra_var in the extra section
205
+ """
206
+ extra = test_info .get ("extra" )
207
+ if extra is None :
208
+ return None
209
+ return extra .get (extra_var )
You can’t perform that action at this time.
0 commit comments