Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
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
Ivan Tyagov
slapos
Commits
5317573a
Commit
5317573a
authored
Aug 09, 2023
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/rapid-cdn: Fix replicate tests
parent
b20ea3b3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
48 deletions
+53
-48
software/rapid-cdn/test/test.py
software/rapid-cdn/test/test.py
+53
-48
No files found.
software/rapid-cdn/test/test.py
View file @
5317573a
...
...
@@ -452,7 +452,7 @@ class TestDataMixin(object):
data_replacement_dict
=
{
'@@_ipv4_address@@'
:
self
.
_ipv4_address
,
'@@_ipv6_address@@'
:
[
self
.
master_ipv6
,
self
.
kedifa_ipv6
,
self
.
caddy_frontend_ipv6
],
self
.
master_ipv6
,
self
.
kedifa_ipv6
,
self
.
caddy_frontend
1
_ipv6
],
'@@_server_http_port@@'
:
str
(
self
.
_server_http_port
),
'@@_server_https_auth_port@@'
:
str
(
self
.
_server_https_auth_port
),
'@@_server_https_port@@'
:
str
(
self
.
_server_https_port
),
...
...
@@ -1256,8 +1256,8 @@ class HttpFrontendTestCase(SlapOSInstanceTestCase):
cls
.
master_ipv6
=
cls
.
computer_partition_ipv6_address
kedifa_partition
=
cls
.
getPartitionId
(
'kedifa'
)
cls
.
kedifa_ipv6
=
cls
.
getPartitionIPv6
(
kedifa_partition
)
caddy_frontend_partition
=
cls
.
getPartitionId
(
'caddy-frontend-1'
)
cls
.
caddy_frontend
_ipv6
=
cls
.
getPartitionIPv6
(
caddy_frontend
_partition
)
caddy_frontend
1
_partition
=
cls
.
getPartitionId
(
'caddy-frontend-1'
)
cls
.
caddy_frontend
1_ipv6
=
cls
.
getPartitionIPv6
(
caddy_frontend1
_partition
)
class
SlaveHttpFrontendTestCase
(
HttpFrontendTestCase
):
...
...
@@ -1957,7 +1957,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
def
test_monitor_setup
(
self
):
MASTER_IP
=
self
.
master_ipv6
KEDIFA_IP
=
self
.
kedifa_ipv6
CADDY_IP
=
self
.
caddy_frontend_ipv6
CADDY_IP
=
self
.
caddy_frontend
1
_ipv6
self
.
monitor_configuration_list
=
[
{
'htmlUrl'
:
'https://[%s]:8401/public/feed'
%
(
MASTER_IP
,),
...
...
@@ -2449,7 +2449,7 @@ class TestSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
# check out access via IPv6
out_ipv6, err_ipv6 = self._curl(
parameter_dict['
domain
'], self.caddy_frontend_ipv6, HTTPS_PORT,
parameter_dict['
domain
'], self.caddy_frontend
1
_ipv6, HTTPS_PORT,
source_ip=SOURCE_IPV6)
try:
j = json.loads(out_ipv6.decode())
...
...
@@ -4819,7 +4819,47 @@ class TestEnableHttp2ByDefaultFalseSlave(TestSlave):
test_enable_http3_false_http_version
=
'1'
class
TestReplicateSlave
(
SlaveHttpFrontendTestCase
,
TestDataMixin
,
AtsMixin
):
class
ReplicateSlaveMixin
(
object
):
def
frontends1And2HaveDifferentIPv6
(
self
):
_
,
*
prefixlen
=
self
.
_ipv6_address
.
split
(
'/'
)
return
bool
(
prefixlen
and
int
(
prefixlen
[
0
])
<
127
)
def
requestSecondFrontend
(
self
,
final_state
=
'stopped'
):
ipv6_collision
=
not
self
.
frontends1And2HaveDifferentIPv6
()
# now instantiate 2nd partition in started state
# and due to port collision, stop the first one...
self
.
instance_parameter_dict
.
update
({
'-frontend-quantity'
:
2
,
'-sla-2-computer_guid'
:
self
.
slap
.
_computer_id
,
'-frontend-1-state'
:
'stopped'
,
'-frontend-2-state'
:
'started'
,
})
self
.
requestDefaultInstance
()
self
.
requestSlaves
()
try
:
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
except
Exception
:
if
ipv6_collision
:
raise
# for now, accept failing promise due to stopped frontend
finally
:
# ...and be nice, put back the first one online
self
.
instance_parameter_dict
.
update
({
'-frontend-1-state'
:
'started'
,
'-frontend-2-state'
:
final_state
,
})
self
.
requestDefaultInstance
()
for
_
in
range
(
3
):
try
:
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
except
Exception
:
if
ipv6_collision
:
raise
# for now, accept failing promise due to stopped frontend
class
TestReplicateSlave
(
SlaveHttpFrontendTestCase
,
TestDataMixin
,
AtsMixin
,
ReplicateSlaveMixin
):
instance_parameter_dict
=
{
'domain'
:
'example.com'
,
'port'
:
HTTPS_PORT
,
...
...
@@ -4841,27 +4881,12 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
},
}
def
frontends1And2HaveDifferentIPv6
(
self
):
_
,
*
prefixlen
=
self
.
_ipv6_address
.
split
(
'/'
)
return
bool
(
prefixlen
and
int
(
prefixlen
[
0
])
<
127
)
def
test
(
self
):
# now instantiate 2nd partition in started state
# and due to port collision, stop the first one...
self
.
instance_parameter_dict
.
update
({
'-frontend-quantity'
:
2
,
'-sla-2-computer_guid'
:
self
.
slap
.
_computer_id
,
'-frontend-1-state'
:
'stopped'
,
'-frontend-2-state'
:
'started'
,
})
self
.
requestDefaultInstance
()
self
.
requestSlaves
()
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
# ...and be nice, put back the first one online
self
.
instance_parameter_dict
.
update
({
'-frontend-1-state'
:
'started'
,
'-frontend-2-state'
:
'stopped'
,
})
self
.
requestDefaultInstance
()
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
self
.
requestSecondFrontend
()
self
.
updateSlaveConnectionParameterDictDict
()
# the real assertions follow...
...
...
@@ -4928,7 +4953,7 @@ class TestReplicateSlave(SlaveHttpFrontendTestCase, TestDataMixin, AtsMixin):
)
class
TestReplicateSlaveOtherDestroyed
(
SlaveHttpFrontendTestCase
):
class
TestReplicateSlaveOtherDestroyed
(
SlaveHttpFrontendTestCase
,
ReplicateSlaveMixin
):
instance_parameter_dict
=
{
'domain'
:
'example.com'
,
'port'
:
HTTPS_PORT
,
...
...
@@ -4951,27 +4976,7 @@ class TestReplicateSlaveOtherDestroyed(SlaveHttpFrontendTestCase):
}
def
test_extra_slave_instance_list_not_present_destroyed_request
(
self
):
# now instantiate 2nd partition in started state
# and due to port collision, stop the first one
self
.
instance_parameter_dict
.
update
({
'-frontend-quantity'
:
2
,
'-sla-2-computer_guid'
:
self
.
slap
.
_computer_id
,
'-frontend-1-state'
:
'stopped'
,
'-frontend-2-state'
:
'started'
,
})
self
.
requestDefaultInstance
()
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
# now start back first instance, and destroy 2nd one
self
.
instance_parameter_dict
.
update
({
'-frontend-1-state'
:
'started'
,
'-frontend-2-state'
:
'destroyed'
,
})
self
.
requestDefaultInstance
()
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
self
.
slap
.
waitForInstance
(
self
.
instance_max_retry
)
self
.
requestSecondFrontend
(
final_state
=
'destroyed'
)
buildout_file
=
os
.
path
.
join
(
self
.
getMasterPartitionPath
(),
'instance-master.cfg'
)
...
...
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