Commit d870d278 authored by Ivan Tyagov's avatar Ivan Tyagov

Auto deployment tests

This MR continues !1074  (Ivan's mistake)

See merge request !1077
parents 50805955 7ceb37ef
...@@ -11,7 +11,8 @@ portal_catalog = portal.portal_catalog ...@@ -11,7 +11,8 @@ portal_catalog = portal.portal_catalog
status_code = 0 status_code = 0
error_message = "No error." error_message = "No error."
context.ERP5Site_setUpActivityTool() if setup_activity_tool:
context.ERP5Site_setUpActivityTool()
if user_quantity is None: if user_quantity is None:
return json.dumps({"status_code" : 1, return json.dumps({"status_code" : 1,
...@@ -42,12 +43,14 @@ if configurator.getSimulationState() == "draft": ...@@ -42,12 +43,14 @@ if configurator.getSimulationState() == "draft":
# create users if installation is done # create users if installation is done
try: try:
context.portal_categories.activate(after_method_id = ('ERP5Site_afterConfigurationSetup', if create_test_data:
'immediateReindexObject') context.portal_categories.activate(after_method_id = ('ERP5Site_afterConfigurationSetup',
).ERP5Site_createTestData(user_quantity, password) 'immediateReindexObject')
context.portal_categories.activate(after_method_id = ('ERP5Site_afterConfigurationSetup', ).ERP5Site_createTestData(user_quantity, password)
'immediateReindexObject') if set_id_generator:
).ERP5Site_setIdGenerator() context.portal_categories.activate(after_method_id = ('ERP5Site_afterConfigurationSetup',
'immediateReindexObject')
).ERP5Site_setIdGenerator()
except Exception as e: except Exception as e:
status_code = 1 status_code = 1
error_message = "Error calling ERP5Site_createTestData script: " + str(e) error_message = "Error calling ERP5Site_createTestData script: " + str(e)
......
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
</item> </item>
<item> <item>
<key> <string>_params</string> </key> <key> <string>_params</string> </key>
<value> <string>user_quantity=None</string> </value> <value> <string>user_quantity=None, setup_activity_tool=True, create_test_data=True, set_id_generator=True</string> </value>
</item> </item>
<item> <item>
<key> <string>guard</string> </key> <key> <string>guard</string> </key>
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Alarm" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>active_sense_method_id</string> </key>
<value> <string>Alarm_setupAutoConfiguration</string> </value>
</item>
<item>
<key> <string>automatic_solve</string> </key>
<value> <int>0</int> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>enabled</string> </key>
<value> <int>1</int> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_auto_configuration</string> </value>
</item>
<item>
<key> <string>periodicity_hour</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_minute_frequency</string> </key>
<value> <int>30</int> </value>
</item>
<item>
<key> <string>periodicity_month</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_month_day</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>periodicity_start_date</string> </key>
<value>
<object>
<klass>
<global name="DateTime" module="DateTime.DateTime"/>
</klass>
<tuple>
<none/>
</tuple>
<state>
<tuple>
<float>1577836800.0</float>
<string>GMT</string>
</tuple>
</state>
</object>
</value>
</item>
<item>
<key> <string>periodicity_week</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Alarm</string> </value>
</item>
<item>
<key> <string>sense_method_id</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string>Setup the default automatic ERP5\'s configuration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Folder" module="OFS.Folder"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_local_properties</string> </key>
<value>
<tuple>
<dictionary>
<item>
<key> <string>id</string> </key>
<value> <string>business_template_skin_layer_priority</string> </value>
</item>
<item>
<key> <string>type</string> </key>
<value> <string>float</string> </value>
</item>
</dictionary>
</tuple>
</value>
</item>
<item>
<key> <string>_objects</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>business_template_skin_layer_priority</string> </key>
<value> <float>110.0</float> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>erp5_scalability_test_auto_configuration</string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
This script will setup the default ERP5's configuration as saved in erp5_scalability_test business template.
As this modifies your site care must be taken!
"""
from Products.ERP5Type.Log import log
portal = context.getPortalObject()
configurator = getattr(portal.business_configuration_module, "default_standard_configuration", None)
if configurator is None:
log("Could not find the scalability business configuration object. Be sure to have erp5_scalability_test business template installed.")
return
if not portal.ERP5Site_isReady():
# nothing installed, thus do it
log("START auto-configuration for ERP5's default configuration.")
context.ERP5Site_bootstrapScalabilityTest(user_quantity=0, setup_activity_tool=False, create_test_data=False, set_id_generator=False)
else:
log("All configured. Nothing to do.")
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Alarm_setupAutoConfiguration</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
"""
The purpose of the script is to tell if configuration of a site was finished or not.
It is used from Deployment Tests.
"""
return context.portal_templates.getInstalledBusinessTemplate("erp5_accounting", strict=True) is not None
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>_proxy_roles</string> </key>
<value>
<tuple>
<string>Manager</string>
</tuple>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>ERP5Site_isReady</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
[CAUTION] This business templates installs default ERP5's configuration thus it can potentially destroy your site!
\ No newline at end of file
portal_alarms/erp5_auto_configuration
portal_alarms/erp5_auto_configuration/**
\ No newline at end of file
erp5_scalability_test_auto_configuration
\ No newline at end of file
erp5_scalability_test_auto_configuration
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment