Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caucase
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
caucase
Commits
9502555b
Commit
9502555b
authored
Jun 25, 2020
by
Vincent Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
caucase.test,shell/caucase.sh: Run caucase.sh from python test suite.
So caucase.sh gets some regular exercise.
parent
57de1342
Pipeline
#10142
failed with stage
in 0 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
2 deletions
+75
-2
caucase/test.py
caucase/test.py
+56
-0
shell/caucase.sh
shell/caucase.sh
+19
-2
No files found.
caucase/test.py
View file @
9502555b
...
...
@@ -27,6 +27,9 @@ Test suite
from
__future__
import
absolute_import
from
Cookie
import
SimpleCookie
import
datetime
# pylint: disable=no-name-in-module, import-error
from
distutils.spawn
import
find_executable
# pylint: enable=no-name-in-module, import-error
import
errno
import
functools
import
glob
...
...
@@ -41,6 +44,7 @@ import shutil
import
socket
import
sqlite3
import
ssl
import
subprocess
import
sys
import
tempfile
import
threading
...
...
@@ -3039,5 +3043,57 @@ if getattr(CaucaseTest, 'assertItemsEqual', None) is None: # pragma: no cover
CaucaseTest
.
assertItemsEqual
=
CaucaseTest
.
assertCountEqual
# pylint: enable=no-member
_caucase_root
=
os
.
path
.
normpath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
os
.
path
.
pardir
),
)
_caucase_sh_path
=
find_executable
(
'caucase.sh'
,
path
=
os
.
path
.
join
(
_caucase_root
,
'shell'
,
)
+
os
.
path
.
pathsep
+
os
.
getenv
(
'PATH'
,
''
),
)
def
_runCaucaseSh
(
*
args
):
command
=
(
_caucase_sh_path
,
)
+
args
with
open
(
os
.
devnull
,
'rb'
)
as
devnull
:
process
=
subprocess
.
Popen
(
command
,
stdin
=
devnull
,
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
close_fds
=
True
,
env
=
{
'CAUCASE_PYTHON'
:
sys
.
executable
,
'PYTHONPATH'
:
_caucase_root
,
},
)
stdout
,
_
=
process
.
communicate
()
status
=
process
.
wait
()
return
status
,
command
,
stdout
@
unittest
.
skipIf
(
_caucase_sh_path
is
None
or
_runCaucaseSh
(
'--help'
)[
0
],
'caucase.sh not found or missing dependency'
,
)
class
CaucaseShellTest
(
unittest
.
TestCase
):
"""
Test caucase.sh .
"""
def
_run
(
self
,
*
args
):
status
,
command
,
stdout
=
_runCaucaseSh
(
*
args
)
self
.
assertEqual
(
status
,
0
,
'Process %r exited with status %s, dumping output:
\
n
%s'
%
(
command
,
status
,
stdout
,
)
)
def
test_test
(
self
):
"""
Run caucase.sh's embedded testsuite.
"""
self
.
_run
(
'--test'
)
if
__name__
==
'__main__'
:
# pragma: no cover
unittest
.
main
()
shell/caucase.sh
View file @
9502555b
...
...
@@ -1120,10 +1120,14 @@ EOF
status
\
tmp_dir
\
caucased_dir
\
caucased_type
\
caucased_pid
echo
'Automated testing...'
if
command
-v
caucased
>
/dev/null
;
then
:
caucased_type
=
"path"
elif
[
"x
$CAUCASE_PYTHON
"
!=
"x"
]
&&
[
-x
"
$CAUCASE_PYTHON
"
]
;
then
# Used when ran from python caucase.test
caucased_type
=
"environment"
else
echo
'caucased not found in PATH, cannot run tests'
>
&2
return
1
...
...
@@ -1138,7 +1142,20 @@ EOF
return
1
fi
echo
'Starting caucased...'
case
"
$caucased_type
"
in
path
)
caucased
--netloc
"
$netloc
"
>
/dev/null 2> /dev/null &
;;
environment
)
"
$CAUCASE_PYTHON
"
\
-c
'from caucase.http import main; main()'
\
--netloc
"
$netloc
"
>
/dev/null 2> /dev/null &
;;
*
)
echo
"Unhandled caucased_type
$caucased_type
"
return
1
;;
esac
caucased_pid
=
"
$!
"
# shellcheck disable=SC2064
trap
"kill
\"
$caucased_pid
\"
; wait; rm -rf
\"
$tmp_dir
\"
"
EXIT
...
...
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