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
Labels
Merge Requests
104
Merge Requests
104
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
7830efb5
Commit
7830efb5
authored
Mar 26, 2019
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
re6stnet/test: use slapos.testing
parent
031284b0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
381 deletions
+41
-381
software/re6stnet/test/setup.py
software/re6stnet/test/setup.py
+17
-17
software/re6stnet/test/test.py
software/re6stnet/test/test.py
+24
-42
software/re6stnet/test/utils.py
software/re6stnet/test/utils.py
+0
-322
No files found.
software/re6stnet/test/setup.py
View file @
7830efb5
...
@@ -25,30 +25,30 @@
...
@@ -25,30 +25,30 @@
#
#
##############################################################################
##############################################################################
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
import
glob
import
os
version
=
'0.0.1.dev0'
version
=
'0.0.1.dev0'
name
=
'slapos.test.re6stnet'
name
=
'slapos.test.re6stnet'
long_description
=
open
(
"README.md"
).
read
()
with
open
(
"README.md"
)
as
f
:
long_description
=
f
.
read
()
setup
(
name
=
name
,
setup
(
version
=
version
,
name
=
name
,
description
=
"Test for SlapOS' Re6stnet"
,
version
=
version
,
long_description
=
long_description
,
description
=
"Test for SlapOS' Re6stnet"
,
long_description_content_type
=
'text/markdown'
,
long_description
=
long_description
,
maintainer
=
"Nexedi"
,
long_description_content_type
=
'text/markdown'
,
maintainer_email
=
"info@nexedi.com"
,
maintainer
=
"Nexedi"
,
url
=
"https://lab.nexedi.com/nexedi/slapos"
,
maintainer_email
=
"info@nexedi.com"
,
packages
=
find_packages
(),
url
=
"https://lab.nexedi.com/nexedi/slapos"
,
install_requires
=
[
packages
=
find_packages
(),
install_requires
=
[
'slapos.core'
,
'slapos.core'
,
'slapos.cookbook'
,
'slapos.cookbook'
,
'slapos.libnetworkcache'
,
'slapos.libnetworkcache'
,
'erp5.util'
,
'erp5.util'
,
'supervisor'
,
'supervisor'
,
'psutil'
,
'psutil'
,
],
],
zip_safe
=
True
,
zip_safe
=
True
,
test_suite
=
'test'
,
test_suite
=
'test'
,
)
)
software/re6stnet/test/test.py
View file @
7830efb5
...
@@ -26,60 +26,39 @@
...
@@ -26,60 +26,39 @@
##############################################################################
##############################################################################
import
os
import
os
import
shutil
import
urlparse
import
tempfile
import
requests
import
requests
import
socket
import
StringIO
import
subprocess
import
json
import
json
import
utils
from
slapos.recipe.librecipe
import
generateHashFromFiles
from
slapos.recipe.librecipe
import
generateHashFromFiles
from
slapos.testing.testcase
import
makeModuleSetUpAndTestCaseClass
SLAPOS_TEST_IPV4
=
os
.
environ
[
'SLAPOS_TEST_IPV4'
]
setUpModule
,
Re6stnetTestCase
=
makeModuleSetUpAndTestCaseClass
(
SLAPOS_TEST_IPV6
=
os
.
environ
[
'SLAPOS_TEST_IPV6'
]
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)))
# for development: debugging logs and install Ctrl+C handler
if
os
.
environ
.
get
(
'SLAPOS_TEST_DEBUG'
):
import
logging
logging
.
basicConfig
(
level
=
logging
.
DEBUG
)
import
unittest
unittest
.
installHandler
()
class
Re6stnetTestCase
(
utils
.
SlapOSInstanceTestCase
):
def
setUp
(
self
):
import
logging
utils
.
SlapOSInstanceTestCase
.
setUp
(
self
)
self
.
logger
=
logging
.
getLogger
(
__name__
)
@
classmethod
def
getSoftwareURLList
(
cls
):
return
(
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'software.cfg'
)),
)
class
TestRe6stnetRegistry
(
Re6stnetTestCase
):
class
TestRe6stnetRegistry
(
Re6stnetTestCase
):
def
test_listen
(
self
):
def
test_listen
(
self
):
connection_parameters
=
self
.
computer_partition
.
getConnectionParameterDict
()
connection_parameters
=
self
.
computer_partition
.
getConnectionParameterDict
()
registry_url
=
connection_parameters
[
're6stry-local-url'
]
registry_url
=
connection_parameters
[
're6stry-local-url'
]
_
=
requests
.
get
(
registry_url
)
_
=
requests
.
get
(
registry_url
)
class
TestPortRedirection
(
Re6stnetTestCase
):
class
TestPortRedirection
(
Re6stnetTestCase
):
def
test_portredir_config
(
self
):
def
test_portredir_config
(
self
):
portredir_config_path
=
os
.
path
.
join
(
self
.
computer_partition_root_path
,
'.slapos-port-redirect'
)
portredir_config_path
=
os
.
path
.
join
(
self
.
computer_partition_root_path
,
'.slapos-port-redirect'
)
with
open
(
portredir_config_path
)
as
f
:
with
open
(
portredir_config_path
)
as
f
:
portredir_config
=
json
.
load
(
f
)
portredir_config
=
json
.
load
(
f
)
self
.
assertDictContainsSubset
({
self
.
assertDictContainsSubset
(
'srcPort'
:
9201
,
{
'destPort'
:
9201
,
'srcPort'
:
9201
,
},
portredir_config
[
0
])
'destPort'
:
9201
,
},
portredir_config
[
0
])
class
ServicesTestCase
(
Re6stnetTestCase
):
class
ServicesTestCase
(
Re6stnetTestCase
):
...
@@ -89,18 +68,21 @@ class ServicesTestCase(Re6stnetTestCase):
...
@@ -89,18 +68,21 @@ class ServicesTestCase(Re6stnetTestCase):
def
test_hashes
(
self
):
def
test_hashes
(
self
):
hash_files
=
[
hash_files
=
[
'software_release/buildout.cfg'
,
'software_release/buildout.cfg'
,
]
]
expected_process_names
=
[
expected_process_names
=
[
'httpd-{hash}-on-watch'
,
'httpd-{hash}-on-watch'
,
]
]
supervisor
=
self
.
getSupervisorRPCServer
().
supervisor
with
self
.
slap
.
instance_supervisor_rpc
as
supervisor
:
process_names
=
[
process
[
'name'
]
process_names
=
[
for
process
in
supervisor
.
getAllProcessInfo
()]
process
[
'name'
]
for
process
in
supervisor
.
getAllProcessInfo
()
]
hash_files
=
[
os
.
path
.
join
(
self
.
computer_partition_root_path
,
path
)
hash_files
=
[
for
path
in
hash_files
]
os
.
path
.
join
(
self
.
computer_partition_root_path
,
path
)
for
path
in
hash_files
]
for
name
in
expected_process_names
:
for
name
in
expected_process_names
:
h
=
generateHashFromFiles
(
hash_files
)
h
=
generateHashFromFiles
(
hash_files
)
...
...
software/re6stnet/test/utils.py
deleted
100644 → 0
View file @
031284b0
This diff is collapsed.
Click to expand it.
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