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
Xavier Thompson
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
Show 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
...
@@ -11,60 +11,40 @@ import os
class
TestSlapOSConfigurator
(
testSlapOSMixin
):
class
TestSlapOSConfigurator
(
testSlapOSMixin
):
def
_testConfiguredPromiseViaAlarm
(
self
,
alarm_id
):
def
testConfiguredModuleGeneratorIDViaConstraint
(
self
):
"""
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
):
""" Make sure Generator ID is well configured, in this
""" Make sure Generator ID is well configured, in this
case we trust on promise outcome."""
case we trust on promise outcome."""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_slapos_module_id_generator"
)
self
.
assertEquals
(
self
.
portal
.
portal_ids
.
checkConsistency
(),
[]
)
def
testConfiguredShacacheWebSite
(
self
):
def
testConfiguredShacacheWebSite
(
self
):
""" Make sure Shacache WebSite is setuped by Alarm
""" Make sure Shacache WebSite is setuped by Alarm
case we trust on promise outcome."""
case we trust on promise outcome."""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_slapos_shacache_website"
)
self
.
assertEquals
(
self
.
portal
.
web_site_module
.
checkConsistency
(),
[])
def
testConfiguredVolatileCacheViaPromise
(
self
):
""" Make sure Volitile Cache was configured well,
invoking the alarm to check """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_memcached_server"
)
def
testConfigured
PersistentCacheViaPromise
(
self
):
def
testConfigured
CacheViaConstraint
(
self
):
""" Make sure Persistent Cache was configured well,
""" Make sure
Volitile and
Persistent Cache was configured well,
invoking the
alarm
to check """
invoking the
consistency
to check """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_kumofs_server"
)
self
.
assertEquals
(
self
.
portal
.
portal_memcached
.
checkConsistency
(),
[]
)
def
testConfiguredConversionServerVia
Promise
(
self
):
def
testConfiguredConversionServerVia
Constraint
(
self
):
""" Make sure Conversion Server was configured well,
""" Make sure Conversion Server was configured well,
invoking
the alarm to check
"""
invoking
checkConsistency
"""
self
.
_testConfiguredPromiseViaAlarm
(
"promise_conversion_server"
)
self
.
assertEquals
(
self
.
portal
.
portal_preferences
.
checkConsistency
(),
[]
)
def
testConfiguredCertificateAuthoring
ViaPromise
(
self
):
def
testConfiguredCertificateAuthoring
Constraint
(
self
):
"""Make sure Certificate Authoring was configured well,
"""Make sure Certificate Authoring was configured well,
invoking the alarm to check. """
invoking checkConsistency.
self
.
_testConfiguredPromiseViaAlarm
(
"promise_certificate_autority_tool"
)
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,
""" Make sure Template Tool Repositories was configured well,
invoking the alarm to check """
invoking checkConsistency """
self
.
_testConfiguredPromiseViaAlarm
(
"promise_template_tool_configuration"
)
self
.
assertEquals
(
[
i
for
i
in
self
.
portal
.
portal_templates
.
checkConsistency
()
if
"(reinstall)"
not
in
i
.
message
],
[])
def
testConfiguredVolatileCache
(
self
):
def
testConfiguredVolatileCache
(
self
):
""" Make sure Memcached is configured
""" Make sure Memcached is configured
...
@@ -79,7 +59,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
...
@@ -79,7 +59,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
memcached_tool
=
self
.
getPortal
().
portal_memcached
memcached_tool
=
self
.
getPortal
().
portal_memcached
connection_dict
=
_getVolatileMemcachedServerDict
()
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
(),
self
.
assertEquals
(
memcached_tool
.
default_memcached_plugin
.
getUrlString
(),
url_string
)
url_string
)
...
@@ -96,7 +76,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
...
@@ -96,7 +76,7 @@ class TestSlapOSConfigurator(testSlapOSMixin):
_getPersistentMemcachedServerDict
_getPersistentMemcachedServerDict
memcached_tool
=
self
.
getPortal
().
portal_memcached
memcached_tool
=
self
.
getPortal
().
portal_memcached
connection_dict
=
_getPersistentMemcachedServerDict
()
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
(),
self
.
assertEquals
(
memcached_tool
.
persistent_memcached_plugin
.
getUrlString
(),
url_string
)
url_string
)
...
@@ -104,18 +84,17 @@ class TestSlapOSConfigurator(testSlapOSMixin):
...
@@ -104,18 +84,17 @@ class TestSlapOSConfigurator(testSlapOSMixin):
""" Make sure Conversion Server (Cloudooo) is
""" Make sure Conversion Server (Cloudooo) is
well configured """
well configured """
if
self
.
isLiveTest
():
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
# and it is only aims to verify if test environment is behaving as
# expected, nothing else, and if alamrs were invoked.
# expected, nothing else, and if alamrs were invoked.
return
return
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
\
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
\
_getConversionServerDict
_getConversionServerUrl
# set preference
# set preference
preference_tool
=
self
.
portal
.
portal_preferences
preference_tool
=
self
.
portal
.
portal_preferences
conversion_dict
=
_getConversionServerDict
()
conversion_url
=
_getConversionServerUrl
()
self
.
assertEquals
(
preference_tool
.
getPreferredOoodocServerAddress
(),
conversion_dict
[
'hostname'
])
self
.
assertEquals
(
preference_tool
.
getPreferredDocumentConversionServerUrl
(),
conversion_url
)
self
.
assertEquals
(
preference_tool
.
getPreferredOoodocServerPortNumber
(),
conversion_dict
[
'port'
])
def
testConfiguredCertificateAuthoring
(
self
):
def
testConfiguredCertificateAuthoring
(
self
):
""" Make sure Certificate Authoting is
""" Make sure Certificate Authoting is
...
...
master/product/SlapOS/tests/testSlapOSMixin.py
View file @
f054122a
...
@@ -39,6 +39,9 @@ from functools import wraps
...
@@ -39,6 +39,9 @@ from functools import wraps
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
from
AccessControl.SecurityManagement
import
getSecurityManager
,
\
setSecurityManager
setSecurityManager
from
App.config
import
getConfiguration
config
=
getConfiguration
()
def
changeSkin
(
skin_name
):
def
changeSkin
(
skin_name
):
def
decorator
(
func
):
def
decorator
(
func
):
...
@@ -190,18 +193,25 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -190,18 +193,25 @@ class testSlapOSMixin(ERP5TypeTestCase):
self
.
portal
.
portal_caches
.
_p_changed
=
1
self
.
portal
.
portal_caches
.
_p_changed
=
1
self
.
commit
()
self
.
commit
()
self
.
portal
.
portal_caches
.
updateCache
()
self
.
portal
.
portal_caches
.
updateCache
()
if
getattr
(
self
.
portal
,
'is_site_bootstrapped'
,
0
):
for
alarm
in
self
.
portal
.
portal_alarms
.
contentValues
():
try
:
if
alarm
.
getId
().
startswith
(
"promise_slapos"
):
initsite
=
config
.
product_config
[
"initsite"
]
alarm
.
solve
()
except
KeyError
:
return
initsite
=
{}
else
:
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
.
portal
.
is_site_bootstrapped
=
1
self
.
bootstrapSite
()
self
.
bootstrapSite
()
self
.
portal
.
_p_changed
=
1
self
.
portal
.
_p_changed
=
1
self
.
commit
()
self
.
commit
()
def
deSetUpPersistentDummyMailHost
(
self
):
def
deSetUpPersistentDummyMailHost
(
self
):
if
'MailHost'
in
self
.
portal
.
objectIds
():
if
'MailHost'
in
self
.
portal
.
objectIds
():
self
.
portal
.
manage_delObjects
([
'MailHost'
])
self
.
portal
.
manage_delObjects
([
'MailHost'
])
...
@@ -237,6 +247,8 @@ class testSlapOSMixin(ERP5TypeTestCase):
...
@@ -237,6 +247,8 @@ class testSlapOSMixin(ERP5TypeTestCase):
def
bootstrapSite
(
self
):
def
bootstrapSite
(
self
):
self
.
setupPortalAlarms
()
self
.
setupPortalAlarms
()
self
.
createCertificateAuthorityFile
()
self
.
createCertificateAuthorityFile
()
self
.
getDefaultSystemPreference
().
setPreferredHateoasUrl
(
"http://dummy/"
)
self
.
getBusinessConfiguration
().
BusinessConfiguration_invokeSlapOSMasterPromiseAlarmList
()
self
.
clearCache
()
self
.
clearCache
()
self
.
tic
()
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