Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
slapos.core
Commits
0267d789
Commit
0267d789
authored
Aug 12, 2021
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Plain Diff
test/test_collect: fix some timezone dependent tests
See merge request
nexedi/slapos.core!326
parents
86ce8b8e
72c1088b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
slapos/tests/test_collect.py
slapos/tests/test_collect.py
+5
-6
No files found.
slapos/tests/test_collect.py
View file @
0267d789
...
...
@@ -42,7 +42,6 @@ import slapos.slap
import
psutil
import
sqlite3
import
subprocess
from
time
import
strftime
from
slapos.collect
import
entity
,
snapshot
,
db
,
reporter
from
slapos.cli.entry
import
SlapOSApp
from
six.moves.configparser
import
ConfigParser
...
...
@@ -247,7 +246,7 @@ class TestCollectDatabase(unittest.TestCase):
self
.
assertEqual
(
len
(
database
.
_getGarbageCollectionDateList
(
0
)),
0
)
self
.
assertEqual
(
database
.
_getGarbageCollectionDateList
(
1
),
[
strftime
(
"%Y-%m-%d"
)])
[
datetime
.
utcnow
().
strftime
(
"%Y-%m-%d"
)])
def
test_garbage
(
self
):
...
...
@@ -378,9 +377,9 @@ class TestCollectReport(unittest.TestCase):
self
.
assertEqual
([
i
for
i
in
csv
.
reader
(
csv_file
)],
csv_path_dict
[
f_path
])
def
test_system_json_report
(
self
):
database
=
self
.
getPopulatedDB
(
strftime
(
"%Y-%m-%d"
),
amount
=
2
)
database
=
self
.
getPopulatedDB
(
datetime
.
utcnow
().
strftime
(
"%Y-%m-%d"
),
amount
=
2
)
reporter
.
SystemJSONReporterDumper
(
database
).
dump
(
self
.
instance_root
)
date_to_test
=
strftime
(
"%Y-%m-%d"
)
date_to_test
=
datetime
.
utcnow
().
strftime
(
"%Y-%m-%d"
)
json_path_dict
=
{
'%s/system_memory_used.json'
%
self
.
instance_root
:
'[ { "entry": 0.09765625, "time": "%s TIME" }]'
%
date_to_test
,
...
...
@@ -418,9 +417,9 @@ class TestCollectReport(unittest.TestCase):
def
test_system_csv_report
(
self
):
database
=
self
.
getPopulatedDB
(
strftime
(
"%Y-%m-%d"
),
amount
=
2
)
database
=
self
.
getPopulatedDB
(
datetime
.
utcnow
().
strftime
(
"%Y-%m-%d"
),
amount
=
2
)
reporter
.
SystemCSVReporterDumper
(
database
).
dump
(
self
.
instance_root
)
date_for_test
=
strftime
(
"%Y-%m-%d"
)
date_for_test
=
datetime
.
utcnow
().
strftime
(
"%Y-%m-%d"
)
csv_path_dict
=
{
'%s/system_memory_used.csv'
%
self
.
instance_root
:
[[
'time'
,
'entry'
],
[
'%s TIME'
%
date_for_test
,
'0.09765625'
]],
'%s/system_cpu_percent.csv'
%
self
.
instance_root
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment