Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.toolbox
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
Guillaume Hervier
slapos.toolbox
Commits
ba4b3b4c
Commit
ba4b3b4c
authored
Feb 16, 2018
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
check_computer_memory: refactor getFreeMemory to fit code behavior
parent
bd09f20e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
slapos/promise/check_computer_memory/__init__.py
slapos/promise/check_computer_memory/__init__.py
+2
-2
slapos/test/promise/test_check_computer_memory.py
slapos/test/promise/test_check_computer_memory.py
+3
-3
No files found.
slapos/promise/check_computer_memory/__init__.py
View file @
ba4b3b4c
...
...
@@ -14,7 +14,7 @@ import datetime
from
slapos.collect.db
import
Database
def
get
FreeMemory
(
database
,
time
,
date
):
def
get
MemoryInfo
(
database
,
time
,
date
):
mem
=
{}
database
=
Database
(
database
)
...
...
@@ -55,7 +55,7 @@ def main():
db_path
=
args
.
collectordb
if
db_path
.
endswith
(
"collector.db"
):
db_path
=
db_path
[:
-
len
(
"collector.db"
)]
memory
,
error
=
get
FreeMemory
(
db_path
,
currenttime
,
currentdate
)
memory
,
error
=
get
MemoryInfo
(
db_path
,
currenttime
,
currentdate
)
if
error
:
print
error
return
0
...
...
slapos/test/promise/test_check_computer_memory.py
View file @
ba4b3b4c
...
...
@@ -30,7 +30,7 @@ import os
import
sqlite3
from
slapos.test.promise
import
data
from
slapos.promise.check_computer_memory
import
get
FreeMemory
from
slapos.promise.check_computer_memory
import
get
MemoryInfo
total_memory_fetch_failure_message
=
"couldn't fetch total memory, collectordb is empty?"
...
...
@@ -50,12 +50,12 @@ class TestComputerMemory(unittest.TestCase):
def
test_check_memory
(
self
):
self
.
assertEquals
(({
'total'
:
33705312256.0
,
'used'
:
33139023872.0
,
'free'
:
566288384.0
},
""
),
get
FreeMemory
(
'/tmp'
,
'00:02'
,
'2017-09-15'
))
get
MemoryInfo
(
'/tmp'
,
'00:02'
,
'2017-09-15'
))
def
test_check_memory_with_unavailable_dates
(
self
):
self
.
assertEquals
(
(
None
,
total_memory_fetch_failure_message
),
get
FreeMemory
(
'/tmp'
,
'18:00'
,
'2017-09-14'
),
get
MemoryInfo
(
'/tmp'
,
'18:00'
,
'2017-09-14'
),
)
def
tearDown
(
self
):
...
...
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