Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Nirina Malard
slapos
Commits
86721d27
Commit
86721d27
authored
May 18, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/erp5/test: test log rotation in neo partition
parent
71f1338d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
65 additions
and
1 deletion
+65
-1
software/erp5/test/test/test_erp5.py
software/erp5/test/test/test_erp5.py
+65
-1
No files found.
software/erp5/test/test/test_erp5.py
View file @
86721d27
...
...
@@ -34,6 +34,7 @@ import json
import
os
import
shutil
import
socket
import
sqlite3
import
ssl
import
subprocess
import
sys
...
...
@@ -48,7 +49,7 @@ import xmlrpc.client
import
urllib3
from
slapos.testing.utils
import
CrontabMixin
from
.
import
ERP5InstanceTestCase
,
setUpModule
,
matrix
,
default
from
.
import
ERP5InstanceTestCase
,
setUpModule
,
matrix
,
default
,
neo
setUpModule
# pyflakes
...
...
@@ -1004,3 +1005,66 @@ class TestCloudoooDefaultParameter(ZopeSkinsMixin, ERP5InstanceTestCase):
'portal_preferences/getPreferredDocumentConversionServerRetry'
),
verify
=
False
).
text
,
"2"
)
class
TestNEO
(
ZopeSkinsMixin
,
CrontabMixin
,
ERP5InstanceTestCase
):
"""Tests specific to neo storage
"""
__partition_reference__
=
'n'
__test_matrix__
=
matrix
((
neo
,))
def
_getCrontabCommand
(
self
,
crontab_name
):
# type: (str) -> str
"""Read a crontab and return the command that is executed.
overloaded to use crontab from neo partition
"""
with
open
(
os
.
path
.
join
(
self
.
getComputerPartitionPath
(
'neo-0'
),
'etc'
,
'cron.d'
,
crontab_name
,
))
as
f
:
crontab_spec
,
=
f
.
readlines
()
self
.
assertNotEqual
(
crontab_spec
[
0
],
'@'
,
crontab_spec
)
return
crontab_spec
.
split
(
None
,
5
)[
-
1
]
def
test_log_rotation
(
self
):
# first run to create state files
self
.
_executeCrontabAtDate
(
'logrotate'
,
'2000-01-01'
)
def
check_sqlite_log
(
path
):
with
self
.
subTest
(
path
),
contextlib
.
closing
(
sqlite3
.
connect
(
path
))
as
con
:
con
.
execute
(
'select * from log'
)
logfiles
=
(
'neoadmin.log'
,
'neomaster.log'
,
'neostorage-0.log'
)
for
f
in
logfiles
:
check_sqlite_log
(
os
.
path
.
join
(
self
.
getComputerPartitionPath
(
'neo-0'
),
'var'
,
'log'
,
f
))
self
.
_executeCrontabAtDate
(
'logrotate'
,
'2050-01-01'
)
for
f
in
logfiles
:
check_sqlite_log
(
os
.
path
.
join
(
self
.
getComputerPartitionPath
(
'neo-0'
),
'srv'
,
'backup'
,
'logrotate'
,
f'
{
f
}
-20500101'
))
self
.
_executeCrontabAtDate
(
'logrotate'
,
'2050-01-02'
)
requests
.
get
(
self
.
_getAuthenticatedZopeUrl
(
'/'
),
verify
=
False
).
raise_for_status
()
for
f
in
logfiles
:
check_sqlite_log
(
os
.
path
.
join
(
self
.
getComputerPartitionPath
(
'neo-0'
),
'var'
,
'log'
,
f
))
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