Skip to content

Commit 3e84832

Browse files
committed
test: fix timestamp format validation in ProcfsReport tests
1 parent 67b2220 commit 3e84832

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/unit/report/test_procfs_report.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def test_create_procfs_report_from_csv_with_one_lines_create_an_procfs_report():
9696
assert isinstance(report, ProcfsReport)
9797

9898

99-
def test_create_procfs_report_from_csv_with_bad_timestamp_format_raise_BadInputData():
99+
def test_create_procfs_report_from_csv_with_good_timestamp_format():
100100
csv_lines = [("procfs",
101101
{
102102
"timestamp": "2021-09-14T123737.669237",
@@ -113,6 +113,26 @@ def test_create_procfs_report_from_csv_with_bad_timestamp_format_raise_BadInputD
113113
}
114114
)
115115
]
116+
report = ProcfsReport.from_csv_lines(csv_lines)
117+
assert isinstance(report, ProcfsReport)
118+
119+
def test_create_procfs_report_from_csv_with_good_timestamp_format_raise_BadInputData():
120+
csv_lines = [("procfs",
121+
{
122+
"timestamp": "2021-09-14T1234737.669237",
123+
"sensor": "formula_group",
124+
"target": ["firefox_cgroup", "emacs_cgroup",
125+
"zsh_cgroup", "mongo_cgroup"],
126+
"usage": {
127+
"firefox_cgroup": 8.36,
128+
"emacs_cgroup": 5.52,
129+
"zsh_cgroup": 0.01,
130+
"mongo_cgroup": 0.64,
131+
},
132+
"global_cpu_usage": 27.600000000000012,
133+
}
134+
)
135+
]
116136
with pytest.raises(BadInputData):
117137
_ = ProcfsReport.from_csv_lines(csv_lines)
118138

0 commit comments

Comments
 (0)