-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_data.py
More file actions
172 lines (157 loc) · 4.02 KB
/
test_data.py
File metadata and controls
172 lines (157 loc) · 4.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
SUB_DF_OUTPUT = """
Filesystem 1K-blocks Used Available Use% Mounted on
dev 3446604 0 3446604 0% /dev
run 3455152 1320 3453832 1% /run
/dev/sda4 194354092 41257996 143153764 23% /
tmpfs 3455152 199556 3255596 6% /dev/shm
tmpfs 3455152 0 3455152 0% /sys/fs/cgroup
tmpfs 3455152 51320 3403832 2% /tmp
tmpfs 691028 44 690984 1% /run/user/1000
"""
EXPECTED_BaseExecutor_OK = {
1: {
"Filesystem": "dev",
"1K-blocks": "3446604",
"Used": "0",
"Available": "3446604",
"Use%": "0%",
"Mounted on": "/dev"
},
2: {
"Filesystem": "run",
"1K-blocks": "3455152",
"Used": "1320",
"Available": "3453832",
"Use%": "1%",
"Mounted on": "/run"
},
3: {
"Filesystem": "/dev/sda4",
"1K-blocks": "194354092",
"Used": "41257996",
"Available": "143153764",
"Use%": "23%",
"Mounted on": "/"
},
4: {
"Filesystem": "tmpfs",
"1K-blocks": "3455152",
"Used": "199556",
"Available": "3255596",
"Use%": "6%",
"Mounted on": "/dev/shm"
},
5: {
"Filesystem": "tmpfs",
"1K-blocks": "3455152",
"Used": "0",
"Available": "3455152",
"Use%": "0%",
"Mounted on": "/sys/fs/cgroup"
},
6: {
"Filesystem": "tmpfs",
"1K-blocks": "3455152",
"Used": "51320",
"Available": "3403832",
"Use%": "2%",
"Mounted on": "/tmp"
},
7: {
"Filesystem": "tmpfs",
"1K-blocks": "691028",
"Used": "44",
"Available": "690984",
"Use%": "1%",
"Mounted on": "/run/user/1000"
}
}
SUB_DF_I_OUTPUT = """
Filesystem Inodes IUsed IFree IUse% Mounted on
dev 861651 528 861123 1% /dev
run 863788 797 862991 1% /run
/dev/sda4 12410880 402194 12008686 4% /
"""
EXPECTED_INODEPARSER = {
1: {
"Filesystem": "dev",
"Inodes": "861651",
"IUsed": "528",
"IFree": "861123",
"IUse%": "1%",
"Mounted on": "/dev"
},
2: {
"Filesystem": "run",
"Inodes": "863788",
"IUsed": "797",
"IFree": "862991",
"IUse%": "1%",
"Mounted on": "/run"
},
3: {
"Filesystem": "/dev/sda4",
"Inodes": "12410880",
"IUsed": "402194",
"IFree": "12008686",
"IUse%": "4%",
"Mounted on": "/"
}}
SUB_DF_H_OUTPUT = """
Filesystem Size Used Avail Use% Mounted on
dev 3.3G 0 3.3G 0% /dev
run 3.3G 1.3M 3.3G 1% /run
/dev/sda4 186G 40G 137G 23% /
"""
EXPECTED_HUMAN_OK = {
1: {
"Filesystem": "dev",
"Size": "3.3G",
"Used": "0",
"Avail": "3.3G",
"Use%": "0%",
"Mounted on": "/dev"
},
2: {
"Filesystem": "run",
"Size": "3.3G",
"Used": "1.3M",
"Avail": "3.3G",
"Use%": "1%",
"Mounted on": "/run"
},
3: {
"Filesystem": "/dev/sda4",
"Size": "186G",
"Used": "40G",
"Avail": "137G",
"Use%": "23%",
"Mounted on": "/"
}}
TEST_RESULT_OUTPUT = {"1":
{'Available': '832672', 'Use%': '20%',
'Used': '205664', '1K-blocks': '1038336',
'Filesystem': '/dev/sda1', 'Mounted on': '/boot'}}
TEST_RESULT_EXPECTED = """{
"status": "success",
"error": "",
"result": {
"1": {
"Available": "832672",
"Use%": "20%",
"Used": "205664",
"1K-blocks": "1038336",
"Filesystem": "/dev/sda1",
"Mounted on": "/boot"
}
}
}"""
TEST_RESULT_EXP_ERROR = """{
"status": "failure",
"error": "Error",
"result": null
}"""
RETURN_CODE_ERROR = 1
RETURN_CODE_OK = 0
ERROR_MESSAGE_OK = ""
ERROR_MESSAGE_IF_ERROR = 'Error'