Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
f80e766f
Commit
f80e766f
authored
Oct 04, 2024
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testVanillaERP5Catalog: add READ-COMMITTED connection in hot reindex test.
parent
271cc7d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
2 deletions
+12
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testVanillaERP5Catalog.py
...tem/portal_components/test.erp5.testVanillaERP5Catalog.py
+12
-2
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testVanillaERP5Catalog.py
View file @
f80e766f
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#
#
##############################################################################
##############################################################################
import
re
import
unittest
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
LogInterceptor
,
getExtraSqlConnectionStringList
from
Products.ERP5Type.tests.utils
import
LogInterceptor
,
getExtraSqlConnectionStringList
...
@@ -48,6 +49,7 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -48,6 +49,7 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# Different variables used for this test
# Different variables used for this test
username
=
'seb'
username
=
'seb'
new_erp5_sql_connection
=
'erp5_sql_connection2'
new_erp5_sql_connection
=
'erp5_sql_connection2'
new_erp5_sql_read_committed_connection
=
'erp5_sql_read_committed_connection2'
new_erp5_deferred_sql_connection
=
'erp5_sql_deferred_connection2'
new_erp5_deferred_sql_connection
=
'erp5_sql_deferred_connection2'
original_catalog_id
=
'erp5_mysql_innodb'
original_catalog_id
=
'erp5_mysql_innodb'
new_catalog_id
=
'erp5_mysql_innodb2'
new_catalog_id
=
'erp5_mysql_innodb2'
...
@@ -69,6 +71,8 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -69,6 +71,8 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# Remove copied sql_connector and catalog
# Remove copied sql_connector and catalog
if
self
.
new_erp5_sql_connection
in
portal
.
objectIds
():
if
self
.
new_erp5_sql_connection
in
portal
.
objectIds
():
portal
.
manage_delObjects
([
self
.
new_erp5_sql_connection
])
portal
.
manage_delObjects
([
self
.
new_erp5_sql_connection
])
if
self
.
new_erp5_sql_read_committed_connection
in
self
.
portal
.
objectIds
():
self
.
portal
.
manage_delObjects
([
self
.
new_erp5_sql_read_committed_connection
])
if
self
.
new_erp5_deferred_sql_connection
in
portal
.
objectIds
():
if
self
.
new_erp5_deferred_sql_connection
in
portal
.
objectIds
():
portal
.
manage_delObjects
([
self
.
new_erp5_deferred_sql_connection
])
portal
.
manage_delObjects
([
self
.
new_erp5_deferred_sql_connection
])
if
self
.
new_catalog_id
in
portal
.
portal_catalog
.
objectIds
():
if
self
.
new_catalog_id
in
portal
.
portal_catalog
.
objectIds
():
...
@@ -134,10 +138,12 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -134,10 +138,12 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
"""
"""
portal
=
self
.
portal
portal
=
self
.
portal
original_connection_id
=
'erp5_sql_connection'
original_connection_id
=
'erp5_sql_connection'
original_read_committed_connection_id
=
'erp5_sql_read_committed_connection'
extra_connection_string_list
=
getExtraSqlConnectionStringList
()
extra_connection_string_list
=
getExtraSqlConnectionStringList
()
if
not
extra_connection_string_list
or
extra_connection_string_list
[
0
]
==
getattr
(
portal
,
original_connection_id
).
connection_string
:
if
not
extra_connection_string_list
or
extra_connection_string_list
[
0
]
==
getattr
(
portal
,
original_connection_id
).
connection_string
:
self
.
skipTest
(
'default connection string is the same as the one for hot-reindex catalog'
)
self
.
skipTest
(
'default connection string is the same as the one for hot-reindex catalog'
)
new_connection_string
=
extra_connection_string_list
[
0
]
new_connection_string
=
extra_connection_string_list
[
0
]
new_erp5_sql_read_committed_connection
=
'erp5_sql_read_committed_connection2'
new_deferred_connection_id
=
'erp5_sql_deferred_connection2'
new_deferred_connection_id
=
'erp5_sql_deferred_connection2'
module
=
portal
.
organisation_module
module
=
portal
.
organisation_module
organisation
=
module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
"GreatTitle2"
)
organisation
=
module
.
newContent
(
portal_type
=
'Organisation'
,
title
=
"GreatTitle2"
)
...
@@ -146,6 +152,10 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -146,6 +152,10 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
# Create new connectors
# Create new connectors
addSQLConnection
(
self
.
new_erp5_sql_connection
,
''
,
new_connection_string
)
addSQLConnection
(
self
.
new_erp5_sql_connection
,
''
,
new_connection_string
)
portal
[
self
.
new_erp5_sql_connection
].
manage_open_connection
()
portal
[
self
.
new_erp5_sql_connection
].
manage_open_connection
()
addSQLConnection
(
self
.
new_erp5_sql_read_committed_connection
,
''
,
re
.
sub
(
r'((?:[%*][^ ]+ )*)(![^ ]+ )?(.+)'
,
r'\1!READ-COMMITTED \3'
,
new_connection_string
))
portal
[
self
.
new_erp5_sql_read_committed_connection
].
manage_open_connection
()
addSQLConnection
(
new_deferred_connection_id
,
''
,
new_connection_string
)
addSQLConnection
(
new_deferred_connection_id
,
''
,
new_connection_string
)
portal
[
new_deferred_connection_id
].
manage_open_connection
()
portal
[
new_deferred_connection_id
].
manage_open_connection
()
# Note: transactionless connector must not be changed because this one
# Note: transactionless connector must not be changed because this one
...
@@ -159,8 +169,8 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -159,8 +169,8 @@ class TestVanillaERP5Catalog(ERP5TypeTestCase, LogInterceptor):
)[
0
][
'new_id'
],
)[
0
][
'new_id'
],
new_id
=
self
.
new_catalog_id
,
new_id
=
self
.
new_catalog_id
,
)
)
source_sql_connection_id_list
=
[
original_connection_id
,
self
.
new_erp5_deferred_sql_connection
]
source_sql_connection_id_list
=
[
original_connection_id
,
original_read_committed_connection_id
,
self
.
new_erp5_deferred_sql_connection
]
destination_sql_connection_id_list
=
[
self
.
new_erp5_sql_connection
,
new_deferred_connection_id
]
destination_sql_connection_id_list
=
[
self
.
new_erp5_sql_connection
,
self
.
new_erp5_sql_read_committed_connection
,
new_deferred_connection_id
]
portal_catalog
.
manage_hotReindexAll
(
portal_catalog
.
manage_hotReindexAll
(
source_sql_catalog_id
=
self
.
original_catalog_id
,
source_sql_catalog_id
=
self
.
original_catalog_id
,
destination_sql_catalog_id
=
self
.
new_catalog_id
,
destination_sql_catalog_id
=
self
.
new_catalog_id
,
...
...
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