Skip to content

Commit 728aded

Browse files
committed
MAGECLOUD-1246: Cover different RabbitMQ relationship names
1 parent 74d77de commit 728aded

File tree

2 files changed

+81
-35
lines changed
  • src
    • Process/Deploy/InstallUpdate/ConfigUpdate
    • Test/Unit/Process/Deploy/InstallUpdate/ConfigUpdate

2 files changed

+81
-35
lines changed

src/Process/Deploy/InstallUpdate/ConfigUpdate/Amqp.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function execute()
7373
$config['queue']['amqp']['port'] = $amqpConfig['port'];
7474
$config['queue']['amqp']['user'] = $amqpConfig['username'];
7575
$config['queue']['amqp']['password'] = $amqpConfig['password'];
76-
$config['queue']['amqp']['virtualhost'] = '/';
76+
$config['queue']['amqp']['virtualhost'] = isset($amqpConfig['vhost']) ? $amqpConfig['vhost'] : '/';
7777
$config['queue']['amqp']['ssl'] = '';
7878
} else {
7979
$config = $this->removeAmqpConfig($config);

src/Test/Unit/Process/Deploy/InstallUpdate/ConfigUpdate/AmqpTest.php

Lines changed: 80 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -88,28 +88,8 @@ public function testExecuteWithoutAmqp()
8888
* @return void
8989
* @dataProvider executeAddUpdateDataProvider
9090
*/
91-
public function testExecuteAddUpdate(array $config)
91+
public function testExecuteAddUpdate(array $config, array $amqpConfig, array $resultConfig)
9292
{
93-
$amqpConfig = [[
94-
'host' => 'localhost',
95-
'port' => '777',
96-
'username' => 'login',
97-
'password' => 'pswd'
98-
]];
99-
$resultConfig = [
100-
'some config',
101-
'queue' => [
102-
'amqp' => [
103-
'host' => 'localhost',
104-
'port' => '777',
105-
'user' => 'login',
106-
'password' => 'pswd',
107-
'virtualhost' => '/',
108-
'ssl' => '',
109-
]
110-
],
111-
];
112-
11393
$this->environmentMock->expects($this->exactly(2))
11494
->method('getRelationship')
11595
->withConsecutive(
@@ -139,20 +119,86 @@ public function testExecuteAddUpdate(array $config)
139119
public function executeAddUpdateDataProvider(): array
140120
{
141121
return [
142-
[['some config']],
143-
[[
144-
'some config',
145-
'queue' => [
146-
'amqp' => [
147-
'host' => 'some-host',
148-
'port' => '888',
149-
'user' => 'mylogin',
150-
'password' => 'mysqwwd',
151-
'virtualhost' => 'virtualhost',
152-
'ssl' => '1',
153-
]
122+
[
123+
['some config'],
124+
[[
125+
'host' => 'localhost',
126+
'port' => '777',
127+
'username' => 'login',
128+
'password' => 'pswd',
129+
'vhost' => 'virtualhost'
130+
]],
131+
[
132+
'some config',
133+
'queue' => [
134+
'amqp' => [
135+
'host' => 'localhost',
136+
'port' => '777',
137+
'user' => 'login',
138+
'password' => 'pswd',
139+
'virtualhost' => 'virtualhost',
140+
'ssl' => '',
141+
]
142+
],
143+
]
144+
],
145+
[
146+
['some config'],
147+
[[
148+
'host' => 'localhost',
149+
'port' => '777',
150+
'username' => 'login',
151+
'password' => 'pswd',
152+
]],
153+
[
154+
'some config',
155+
'queue' => [
156+
'amqp' => [
157+
'host' => 'localhost',
158+
'port' => '777',
159+
'user' => 'login',
160+
'password' => 'pswd',
161+
'virtualhost' => '/',
162+
'ssl' => '',
163+
]
164+
],
165+
]
166+
],
167+
[
168+
[
169+
'some config',
170+
'queue' => [
171+
'amqp' => [
172+
'host' => 'some-host',
173+
'port' => '888',
174+
'user' => 'mylogin',
175+
'password' => 'mysqwwd',
176+
'virtualhost' => 'virtualhost',
177+
'ssl' => '1',
178+
]
179+
],
154180
],
155-
]]
181+
[[
182+
'host' => 'localhost',
183+
'port' => '777',
184+
'username' => 'login',
185+
'password' => 'pswd',
186+
'vhost' => 'virtualhost'
187+
]],
188+
[
189+
'some config',
190+
'queue' => [
191+
'amqp' => [
192+
'host' => 'localhost',
193+
'port' => '777',
194+
'user' => 'login',
195+
'password' => 'pswd',
196+
'virtualhost' => 'virtualhost',
197+
'ssl' => '',
198+
]
199+
],
200+
]
201+
]
156202
];
157203
}
158204

0 commit comments

Comments
 (0)