Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
enstore
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexander Moibenko
enstore
Commits
492e2537
Commit
492e2537
authored
1 year ago
by
Dennis Box
Browse files
Options
Downloads
Patches
Plain Diff
some tests fail because github runs tests as root. Try this fix
parent
7ef75402
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.github/workflows/pylint-enstore-py-docker.yml
+1
-0
1 addition, 0 deletions
.github/workflows/pylint-enstore-py-docker.yml
src/log_client.py
+147
-135
147 additions, 135 deletions
src/log_client.py
src/tests/test_log_client.py
+18
-12
18 additions, 12 deletions
src/tests/test_log_client.py
with
166 additions
and
147 deletions
.github/workflows/pylint-enstore-py-docker.yml
+
1
−
0
View file @
492e2537
...
...
@@ -14,6 +14,7 @@ jobs:
-
uses
:
actions/checkout@v2
-
name
:
run unittests with pytest
run
:
|
su enstore
source /data/setup-enstore
cd /__w/enstore/enstore
export PYTHONPATH=`pwd`:`pwd`/src:`pwd`/HTMLgen:`pwd`/PyGreSQL:$PYTHONPATH
...
...
This diff is collapsed.
Click to expand it.
src/log_client.py
+
147
−
135
View file @
492e2537
This diff is collapsed.
Click to expand it.
src/tests/test_log_client.py
+
18
−
12
View file @
492e2537
import
unittest
import
os
import
mock
import
StringIO
import
threading
import
mock
import
e_errors
import
enstore_functions
import
log_client
import
udp_client
import
mock_csc
"""
Test the log_client module
The log_client module is used to send log messages to the log server.
Author: Dennis Box
Date: 2023-07-10
"""
class
TestLoggerClient
(
unittest
.
TestCase
):
def
setUp
(
self
):
...
...
@@ -114,13 +117,16 @@ class TestTCPLoggerClient(unittest.TestCase):
class
TestMisc
(
unittest
.
TestCase
):
def
test_genMsgType
(
self
):
# test the gentMsgType function
# test_lines was derived from the log_client.py file with the
# following command:
# grep 'if string.find.*lowLine' ../log_client.py | sed -e 's/^.*Line, //g' -e 's/\(".*"\)\(.*\)/\1/'| sort | tr "\n" ","
# sometimes members in test_lines are repeated, the same input line
# is handled by different if statements
"""
test the gentMsgType function which formats
the message type for the log server
the list test_lines was derived from the log_client.py file with the
following command:
grep
'
if string.find.*lowLine
'
../log_client.py | sed -e
'
s/^.*Line, //g
'
-e
'
s/\(
"
.*
"
\)\(.*\)/
\1
/
'
| sort | tr
"
\n
"
"
,
"
sometimes members in test_lines are repeated, the same input line
is handled by different if statements
"""
test_lines
=
[
"
mover
"
,
"
vol
"
,
"
(re)
"
,
"
added to mover list
"
,
"
log server
"
,
"
log_server
"
,
"
backup
"
,
"
bad
"
,
"
badmount
"
,
"
busy_vols
"
,
"
busy_vols
"
,
"
cantrestart
"
,
...
...
@@ -163,7 +169,7 @@ class TestMisc(unittest.TestCase):
udp_client
.
UDPClient
.
send_no_wait
=
sent_msg
os
.
environ
[
'
ENSTORE_CONFIG_PORT
'
]
=
'
7777
'
os
.
environ
[
'
ENSTORE_CONFIG_HOST
'
]
=
'
127.0.0.1
'
with
mock
.
patch
(
'
sys.stderr
'
,
new
=
StringIO
.
StringIO
())
as
std_err
:
with
mock
.
patch
(
'
sys.stderr
'
,
new
=
StringIO
.
StringIO
()):
log_client
.
logthis
()
formatted_str
=
"
%06d enstore I LOGIT HELLO
"
%
os
.
getpid
()
param_1
=
{
'
message
'
:
formatted_str
,
'
work
'
:
'
log_message
'
}
...
...
@@ -196,7 +202,7 @@ class TestLoggerClientInterface(unittest.TestCase):
self
.
assertEqual
(
4
,
len
(
self
.
lci
.
valid_dictionaries
()))
def
test_do_work
(
self
):
with
mock
.
patch
(
'
sys.stderr
'
,
new
=
StringIO
.
StringIO
())
as
std_err
:
with
mock
.
patch
(
'
sys.stderr
'
,
new
=
StringIO
.
StringIO
()):
with
mock
.
patch
(
'
sys.stdout
'
,
new
=
StringIO
.
StringIO
())
as
std_out
:
with
mock
.
patch
(
"
sys.exit
"
)
as
exit_mock
:
with
mock
.
patch
(
'
generic_client.GenericClient.check_ticket
'
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment