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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Xiaowu Zhang
slapos
Commits
cd018b6f
Commit
cd018b6f
authored
Nov 15, 2018
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5/test: another workaround for too deep paths
parent
cd36f15a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
software/erp5/test/test/test_erp5.py
software/erp5/test/test/test_erp5.py
+2
-0
software/erp5/test/utils.py
software/erp5/test/utils.py
+14
-4
No files found.
software/erp5/test/test/test_erp5.py
View file @
cd018b6f
...
@@ -92,11 +92,13 @@ class TestPublishedURLIsReachableMixin(object):
...
@@ -92,11 +92,13 @@ class TestPublishedURLIsReachableMixin(object):
class
TestDefaultParameters
(
ERP5TestCase
,
TestPublishedURLIsReachableMixin
):
class
TestDefaultParameters
(
ERP5TestCase
,
TestPublishedURLIsReachableMixin
):
"""Test ERP5 can be instanciated with no parameters
"""Test ERP5 can be instanciated with no parameters
"""
"""
__partition_reference__
=
'defp'
class
TestDisableTestRunner
(
ERP5TestCase
,
TestPublishedURLIsReachableMixin
):
class
TestDisableTestRunner
(
ERP5TestCase
,
TestPublishedURLIsReachableMixin
):
"""Test ERP5 can be instanciated without test runner.
"""Test ERP5 can be instanciated without test runner.
"""
"""
__partition_reference__
=
'distr'
@
classmethod
@
classmethod
def
getInstanceParameterDict
(
cls
):
def
getInstanceParameterDict
(
cls
):
return
{
'_'
:
json
.
dumps
({
'test-runner'
:
{
'enabled'
:
False
}})}
return
{
'_'
:
json
.
dumps
({
'test-runner'
:
{
'enabled'
:
False
}})}
...
...
software/erp5/test/utils.py
View file @
cd018b6f
...
@@ -61,15 +61,25 @@ class SlapOSInstanceTestCase(unittest.TestCase):
...
@@ -61,15 +61,25 @@ class SlapOSInstanceTestCase(unittest.TestCase):
on the class.
on the class.
All tests from the test class will run with the same instance.
All tests from the test class will run with the same instance.
The following class attributes are available:
The following class attributes are available:
* `computer_partition`: the `slapos.core.XXX` computer partition instance.
* `computer_partition`: the `slapos.core.XXX` computer partition instance.
* `computer_partition_root_path`: the path of the instance root directory,
* `computer_partition_root_path`: the path of the instance root directory,
A note about paths:
SlapOS itself and some services running in SlapOS uses unix sockets and (sometimes very)
deep path, which does not play very well together. To workaround this, users can
set SLAPOS_TEST_WORKING_DIR enivonment variable to the path of a short enough directory
and local slapos will be in this directory.
The partitions references will be named after the unittest class name, which can also lead
to long paths. For this, unit test classes can define a __partition_reference__ attribute
which will be used as partition reference. The trick is then to use a shorter
__partition_reference__
See https://lab.nexedi.com/kirr/slapns for the solution to all these problems.
"""
"""
# Methods to be defined by subclasses.
# Methods to be defined by subclasses.
@
classmethod
@
classmethod
def
getSoftwareURLList
(
cls
):
def
getSoftwareURLList
(
cls
):
...
@@ -182,7 +192,7 @@ class SlapOSInstanceTestCase(unittest.TestCase):
...
@@ -182,7 +192,7 @@ class SlapOSInstanceTestCase(unittest.TestCase):
"log_directory"
:
cls
.
working_directory
,
"log_directory"
:
cls
.
working_directory
,
"computer_id"
:
'slapos.test'
,
# XXX
"computer_id"
:
'slapos.test'
,
# XXX
'proxy_database'
:
os
.
path
.
join
(
cls
.
working_directory
,
'proxy.db'
),
'proxy_database'
:
os
.
path
.
join
(
cls
.
working_directory
,
'proxy.db'
),
'partition_reference'
:
cls
.
__name__
,
'partition_reference'
:
getattr
(
cls
,
'__partition_reference__'
,
cls
.
__name__
)
,
# "proper" slapos command must be in $PATH
# "proper" slapos command must be in $PATH
'slapos_binary'
:
'slapos'
,
'slapos_binary'
:
'slapos'
,
}
}
...
...
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