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
Thomas Leymonerie
slapos.core
Commits
a88369fc
Commit
a88369fc
authored
Aug 06, 2020
by
Rafael Monnerat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test for Test upgrade from older versions of ERP5
parent
a5da7be3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
111 additions
and
0 deletions
+111
-0
master/product/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
...ct/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
+74
-0
master/tests/__init__.py
master/tests/__init__.py
+37
-0
No files found.
master/product/SlapOS/tests/testSlapOSUpgradeInstanceWithOldDataFs.py
0 → 100644
View file @
a88369fc
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2012 Vifib SA and Contributors. All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsibility of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# guarantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
##############################################################################
from
testSlapOSMixin
import
testSlapOSMixin
import
unittest
class
TestUpgradeInstanceWithOldDataFs
(
testSlapOSMixin
):
def
afterSetUp
(
self
):
# Do nothing as all work is done on the saved testSlapOSMixin already
# When save the data.fs
pass
def
getBusinessTemplateList
(
self
):
# we dont need bt5 as this test is supposed to run only as --load
return
[
'erp5_core'
]
def
testUpgrade
(
self
):
if
not
self
.
portal
.
portal_templates
.
getRepositoryList
():
self
.
setupAutomaticBusinessTemplateRepository
(
searchable_business_template_list
=
[
"erp5_core"
,
"erp5_base"
,
"slapos_erp5"
,
"erp5_slapos_tutorial"
])
alarm
=
self
.
portal
.
portal_alarms
.
promise_check_upgrade
alarm
.
solve
()
self
.
tic
()
self
.
assertEquals
(
alarm
.
getLastActiveProcess
().
getResultList
(),
[])
bt5_list
=
self
.
portal
.
portal_templates
.
getInstalledBusinessTemplateTitleList
()
self
.
assertTrue
(
'slapos_erp5'
in
bt5_list
,
bt5_list
)
# Make sure that *all* Portal Type can be loaded after upgrade
import
erp5.portal_type
from
Products.ERP5Type.dynamic.lazy_class
import
ERP5BaseBroken
error_list
=
[]
for
portal_type_obj
in
self
.
portal
.
portal_types
.
listTypeInfo
():
portal_type_id
=
portal_type_obj
.
getId
()
portal_type_class
=
getattr
(
erp5
.
portal_type
,
portal_type_id
)
portal_type_class
.
loadClass
()
if
issubclass
(
portal_type_class
,
ERP5BaseBroken
):
error_list
.
append
(
portal_type_id
)
self
.
assertEquals
(
error_list
,
[],
msg
=
"The following Portal Type classes could not be loaded (see zLOG.log): %r"
%
error_list
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestUpgradeInstanceWithOldDataFs
))
return
suite
master/tests/__init__.py
View file @
a88369fc
...
@@ -60,6 +60,43 @@ class SlapOSCloud(SavedTestSuite, ProjectTestSuite):
...
@@ -60,6 +60,43 @@ class SlapOSCloud(SavedTestSuite, ProjectTestSuite):
test
=
':'
in
full_test
and
full_test
.
split
(
':'
)[
1
]
or
full_test
test
=
':'
in
full_test
and
full_test
.
split
(
':'
)[
1
]
or
full_test
if
test
.
startswith
(
'testFunctional'
):
if
test
.
startswith
(
'testFunctional'
):
return
self
.
_updateFunctionalTestResponse
(
self
.
runUnitTest
(
full_test
))
return
self
.
_updateFunctionalTestResponse
(
self
.
runUnitTest
(
full_test
))
elif
test
==
'testSlapOSUpgradeInstanceWithOldDataFs'
:
old_data_path
=
None
for
path
in
sys
.
path
:
if
path
.
endswith
(
'/slapos-bin'
):
old_data_path
=
os
.
path
.
join
(
path
,
'test_data'
,
test
)
if
not
os
.
path
.
isdir
(
old_data_path
):
return
dict
(
status_code
=-
1
,
test_count
=
1
,
failure_count
=
1
,
stderr
=
'%s does not exist or is not a directory'
%
old_data_path
)
break
else
:
return
dict
(
status_code
=-
1
,
test_count
=
1
,
failure_count
=
1
,
stderr
=
'slapos-bin repository not found in %s'
%
'
\
n
'
.
join
(
sys
.
path
))
instance_home
=
(
self
.
instance
and
'unit_test.%u'
%
self
.
instance
or
'unit_test'
)
import
shutil
shutil
.
rmtree
(
instance_home
,
ignore_errors
=
True
)
os
.
makedirs
(
os
.
path
.
join
(
instance_home
,
'var'
))
shutil
.
copyfile
(
os
.
path
.
join
(
old_data_path
,
'Data.fs'
),
os
.
path
.
join
(
instance_home
,
'var'
,
'Data.fs'
))
shutil
.
copyfile
(
os
.
path
.
join
(
old_data_path
,
'dump.sql'
),
os
.
path
.
join
(
instance_home
,
'dump.sql'
))
return
self
.
runUnitTest
(
'--load'
,
'--portal_id=erp5'
,
'--enable_full_indexing=portal_types,portal_property_sheets'
,
full_test
)
return
super
(
SlapOSCloud
,
self
).
run
(
full_test
)
return
super
(
SlapOSCloud
,
self
).
run
(
full_test
)
def
_updateFunctionalTestResponse
(
self
,
status_dict
):
def
_updateFunctionalTestResponse
(
self
,
status_dict
):
...
...
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