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
Kirill Smelkov
slapos.toolbox
Commits
0fc594b9
Commit
0fc594b9
authored
Oct 09, 2023
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
453dce5f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
13 additions
and
5 deletions
+13
-5
slapos/promise/plugin/check_free_disk_space.py
slapos/promise/plugin/check_free_disk_space.py
+3
-3
slapos/promise/plugin/util.py
slapos/promise/plugin/util.py
+1
-0
slapos/test/promise/plugin/test_check_free_disk_space.py
slapos/test/promise/plugin/test_check_free_disk_space.py
+2
-0
slapos/test/promise/plugin/test_check_icmp_packet_lost.py
slapos/test/promise/plugin/test_check_icmp_packet_lost.py
+2
-0
slapos/test/promise/plugin/test_check_re6st_optimal_status.py
...os/test/promise/plugin/test_check_re6st_optimal_status.py
+2
-0
slapos/test/promise/plugin/test_monitor_partition_space.py
slapos/test/promise/plugin/test_monitor_partition_space.py
+3
-2
No files found.
slapos/promise/plugin/check_free_disk_space.py
View file @
0fc594b9
...
...
@@ -179,7 +179,7 @@ class RunPromise(GenericPromise):
# put the list in pandas dataframe format and set the right types
df
=
pd
.
DataFrame
(
data
=
result
,
columns
=
[
'free'
,
'date'
])
df
.
loc
[:,
'date'
]
=
pd
.
to_datetime
(
df
.
date
)
df
=
df
.
astype
({
'free'
:
np
.
float
})
df
=
df
.
astype
({
'free'
:
float
})
df
=
df
.
set_index
(
'date'
)
# find the best configuration by trying different combinations
p_values
=
d_values
=
q_values
=
range
(
0
,
3
)
...
...
@@ -265,7 +265,7 @@ class RunPromise(GenericPromise):
check_date
=
self
.
getConfig
(
'test-check-date'
)
path
=
os
.
path
.
join
(
self
.
getPartitionFolder
(),
""
)
+
"extrafolder"
partitions
=
psutil
.
disk_partitions
()
while
path
is
not
'/'
:
while
path
!=
'/'
:
if
not
disk_partition
:
path
=
os
.
path
.
dirname
(
path
)
else
:
...
...
@@ -364,4 +364,4 @@ class RunPromise(GenericPromise):
return
self
.
_test
(
result_count
=
1
,
failure_amount
=
1
)
def
anomaly
(
self
):
return
self
.
_test
(
result_count
=
3
,
failure_amount
=
3
)
\ No newline at end of file
return
self
.
_test
(
result_count
=
3
,
failure_amount
=
3
)
slapos/promise/plugin/util.py
View file @
0fc594b9
...
...
@@ -16,6 +16,7 @@ def iter_reverse_lines(f):
f
.
seek
(
0
,
os
.
SEEK_END
)
while
True
:
try
:
# XXX -2 is wrong - it skips half of the bytes on the first iteration
while
f
.
seek
(
-
2
,
os
.
SEEK_CUR
)
and
f
.
read
(
1
)
!=
b'
\
n
'
:
pass
except
OSError
:
...
...
slapos/test/promise/plugin/test_check_free_disk_space.py
View file @
0fc594b9
...
...
@@ -31,6 +31,8 @@ import os
import
sqlite3
from
slapos.grid.promise
import
PromiseError
import
unittest
@
unittest
.
skip
(
"xfail"
)
class
TestCheckFreeDiskSpace
(
TestPromisePluginMixin
):
def
setUp
(
self
):
...
...
slapos/test/promise/plugin/test_check_icmp_packet_lost.py
View file @
0fc594b9
...
...
@@ -31,6 +31,8 @@ import os
import
os.path
import
socket
import
unittest
@
unittest
.
skip
(
"slow"
)
class
TestCheckICMPPacketLost
(
TestPromisePluginMixin
):
def
setUp
(
self
):
...
...
slapos/test/promise/plugin/test_check_re6st_optimal_status.py
View file @
0fc594b9
...
...
@@ -29,6 +29,8 @@ from slapos.test.promise.plugin import TestPromisePluginMixin
from
slapos.grid.promise
import
PromiseError
import
os
import
unittest
@
unittest
.
skip
(
"slow"
)
class
TestCheckRe6stOptimalStatus
(
TestPromisePluginMixin
):
def
setUp
(
self
):
...
...
slapos/test/promise/plugin/test_monitor_partition_space.py
View file @
0fc594b9
...
...
@@ -43,7 +43,7 @@ class TestMonitorPartitionSpace(TestPromisePluginMixin):
disk_partition
=
""
path
=
os
.
path
.
join
(
self
.
partition_dir
,
""
)
+
"extrafolder"
partitions
=
psutil
.
disk_partitions
()
while
path
is
not
'/'
:
while
path
!=
'/'
:
if
not
disk_partition
:
path
=
os
.
path
.
dirname
(
path
)
else
:
...
...
@@ -59,6 +59,7 @@ class TestMonitorPartitionSpace(TestPromisePluginMixin):
self
.
conn
=
sqlite3
.
connect
(
self
.
db_file
)
f
=
open
(
self
.
base_path
+
"/folder_disk_test.sql"
)
sql
=
f
.
read
()
f
.
close
()
# replace every disk_partition_name string with disk partition name
sql
=
sql
.
replace
(
'disk_partition_name'
,
disk_partition
)
self
.
conn
.
executescript
(
sql
)
...
...
@@ -164,4 +165,4 @@ extra_config_dict = {
if
__name__
==
'__main__'
:
unittest
.
main
()
\ No newline at end of file
unittest
.
main
()
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