Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
slapos.core
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
Lisa Casino
slapos.core
Commits
f054122a
Commit
f054122a
authored
Nov 23, 2017
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
slapos_configurator: Fix/Update Configurator test to check Constraints.
parent
e02b451e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
55 deletions
+46
-55
master/bt5/slapos_configurator/TestTemplateItem/portal_components/test.erp5.testSlapOSConfigurator.py
...tem/portal_components/test.erp5.testSlapOSConfigurator.py
+27
-48
master/product/SlapOS/tests/testSlapOSMixin.py
master/product/SlapOS/tests/testSlapOSMixin.py
+19
-7
No files found.
master/bt5/slapos_configurator/TestTemplateItem/portal_components/test.erp5.testSlapOSConfigurator.py
View file @
f054122a
...
...
@@ -11,60 +11,40 @@ import os
class
TestSlapOSConfigurator
(
testSlapOSMixin
):
def
_testConfiguredPromiseViaAlarm
(
self
,
alarm_id
):
"""
Make sue one alarm is configured.
"""
alarm
=
getattr
(
self
.
portal
.
portal_alarms
,
alarm_id
,
None
)
self
.
assertNotEquals
(
alarm
,
None
)
alarm
.
activeSense
()
self
.
tic
()
self
.
failIf
(
alarm
.
sense
())
def
testConfiguredPAS
(
self
):
""" Make sure PAS is well configured, in this case
we trust on promise outcome."""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_slapos_pas"
)
def
testConfiguredPASExternal
(
self
):
""" Make sure External PAS (Facebook, Google, Browser ID)
is well configured, in this case we trust on promise outcome."""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_slapos_pas_external"
)
def
testConfiguredModuleGeneratorID
(
self
):
def
testConfiguredModuleGeneratorIDViaConstraint
(
self
):
""" Make sure Generator ID is well configured, in this
case we trust on promise outcome."""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_slapos_module_id_generator"
)
self
.
assertEquals
(
self
.
portal
.
portal_ids
.
checkConsistency
(),
[]
)
def
testConfiguredShacacheWebSite
(
self
):
""" Make sure Shacache WebSite is setuped by Alarm
case we trust on promise outcome."""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_slapos_shacache_website"
)
def
testConfiguredVolatileCacheViaPromise
(
self
):
""" Make sure Volitile Cache was configured well,
invoking the alarm to check """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_memcached_server"
)
self
.
assertEquals
(
self
.
portal
.
web_site_module
.
checkConsistency
(),
[])
def
testConfigured
PersistentCacheViaPromise
(
self
):
""" Make sure Persistent Cache was configured well,
invoking the
alarm
to check """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_kumofs_server"
)
def
testConfigured
CacheViaConstraint
(
self
):
""" Make sure
Volitile and
Persistent Cache was configured well,
invoking the
consistency
to check """
self
.
assertEquals
(
self
.
portal
.
portal_memcached
.
checkConsistency
(),
[]
)
def
testConfiguredConversionServerVia
Promise
(
self
):
def
testConfiguredConversionServerVia
Constraint
(
self
):
""" Make sure Conversion Server was configured well,
invoking
the alarm to check
"""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_conversion_server"
)
invoking
checkConsistency
"""
self
.
assertEquals
(
self
.
portal
.
portal_preferences
.
checkConsistency
(),
[]
)
def
testConfiguredCertificateAuthoring
ViaPromise
(
self
):
def
testConfiguredCertificateAuthoring
Constraint
(
self
):
"""Make sure Certificate Authoring was configured well,
invoking the alarm to check. """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_certificate_autority_tool"
)
invoking checkConsistency.
def
testConfiguredTemplateToolViaPromise
(
self
):
Make sure PAS is well configured."""
self
.
assertEquals
(
self
.
portal
.
portal_certificate_authority
.
checkConsistency
(),
[])
def
testConfiguredTemplateToolViaConstraint
(
self
):
""" Make sure Template Tool Repositories was configured well,
invoking the alarm to check """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_template_tool_configuration"
)
invoking checkConsistency """
self
.
assertEquals
(
[
i
for
i
in
self
.
portal
.
portal_templates
.
checkConsistency
()
if
"(reinstall)"
not
in
i
.
message
],
[])
def
testConfiguredVolatileCache
(
self
):
""" Make sure Memcached is configured
...
...
@@ -79,7 +59,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
memcached_tool
=
self
.
getPortal
().
portal_memcached
connection_dict
=
_getVolatileMemcachedServerDict
()
url_string
=
'
%(hostname)s
:%(port)s'
%
connection_dict
url_string
=
'
erp5-memcached-volatile
:%(port)s'
%
connection_dict
self
.
assertEquals
(
memcached_tool
.
default_memcached_plugin
.
getUrlString
(),
url_string
)
...
...
@@ -96,7 +76,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
_getPersistentMemcachedServerDict
memcached_tool
=
self
.
getPortal
().
portal_memcached
connection_dict
=
_getPersistentMemcachedServerDict
()
url_string
=
'
%(hostname)s
:%(port)s'
%
connection_dict
url_string
=
'
erp5-memcached-persistent
:%(port)s'
%
connection_dict
self
.
assertEquals
(
memcached_tool
.
persistent_memcached_plugin
.
getUrlString
(),
url_string
)
...
...
@@ -104,18 +84,17 @@ class TestSlapOSConfigurator(testSlapOSMixin):
""" Make sure Conversion Server (Cloudooo) is
well configured """
if
self
.
isLiveTest
():
# This test is redundant with testConfigured
VolatileCacheViaPromise
# This test is redundant with testConfigured
ConversionServerViaConstraint
# and it is only aims to verify if test environment is behaving as
# expected, nothing else, and if alamrs were invoked.
return
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
\
_getConversionServerDict
_getConversionServerUrl
# set preference
preference_tool
=
self
.
portal
.
portal_preferences
conversion_dict
=
_getConversionServerDict
()
self
.
assertEquals
(
preference_tool
.
getPreferredOoodocServerAddress
(),
conversion_dict
[
'hostname'
])
self
.
assertEquals
(
preference_tool
.
getPreferredOoodocServerPortNumber
(),
conversion_dict
[
'port'
])
conversion_url
=
_getConversionServerUrl
()
self
.
assertEquals
(
preference_tool
.
getPreferredDocumentConversionServerUrl
(),
conversion_url
)
def
testConfiguredCertificateAuthoring
(
self
):
""" Make sure Certificate Authoting is
...
...
master/product/SlapOS/tests/testSlapOSMixin.py
View file @
f054122a
...
...
@@ -39,6 +39,9 @@ from functools import wraps
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
from
App.config
import
getConfiguration
config
=
getConfiguration
()
def
changeSkin
(
skin_name
):
def
decorator
(
func
):
...
...
@@ -190,18 +193,25 @@ class testSlapOSMixin(ERP5TypeTestCase):
self
.
portal
.
portal_caches
.
_p_changed
=
1
self
.
commit
()
self
.
portal
.
portal_caches
.
updateCache
()
if
getattr
(
self
.
portal
,
'is_site_bootstrapped'
,
0
):
for
alarm
in
self
.
portal
.
portal_alarms
.
contentValues
():
if
alarm
.
getId
().
startswith
(
"promise_slapos"
):
alarm
.
solve
()
return
else
:
try
:
initsite
=
config
.
product_config
[
"initsite"
]
except
KeyError
:
initsite
=
{}
if
initsite
.
get
(
"cloudooo_url"
,
None
)
is
None
:
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
\
_getConversionServerUrl
initsite
[
"cloudooo_url"
]
=
_getConversionServerUrl
()
config
.
product_config
[
"initsite"
]
=
initsite
if
not
getattr
(
self
.
portal
,
'is_site_bootstrapped'
,
0
):
self
.
portal
.
is_site_bootstrapped
=
1
self
.
bootstrapSite
()
self
.
portal
.
_p_changed
=
1
self
.
commit
()
def
deSetUpPersistentDummyMailHost
(
self
):
if
'MailHost'
in
self
.
portal
.
objectIds
():
self
.
portal
.
manage_delObjects
([
'MailHost'
])
...
...
@@ -237,6 +247,8 @@ class testSlapOSMixin(ERP5TypeTestCase):
def
bootstrapSite
(
self
):
self
.
setupPortalAlarms
()
self
.
createCertificateAuthorityFile
()
self
.
getDefaultSystemPreference
().
setPreferredHateoasUrl
(
"http://dummy/"
)
self
.
getBusinessConfiguration
().
BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList
()
self
.
clearCache
()
self
.
tic
()
...
...
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