Skip to content

Commit a90c853

Browse files
authored
MAGECLOUD-2919: Wrong Log Level for Starting/Finishing Deployment Phases (#382)
1 parent 90d6675 commit a90c853

17 files changed

+67
-40
lines changed

src/Command/Build/Generate.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,9 @@ protected function configure()
7171
public function execute(InputInterface $input, OutputInterface $output)
7272
{
7373
try {
74-
$this->logger->info('Starting generate command. ' . $this->packageManager->getPrettyInfo());
74+
$this->logger->notice('Starting generate command. ' . $this->packageManager->getPrettyInfo());
7575
$this->process->execute();
76-
$this->logger->info('Generate command completed.');
76+
$this->logger->notice('Generate command completed.');
7777
} catch (\Throwable $e) {
7878
$this->logger->critical($e->getMessage());
7979

src/Command/Build/Transfer.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ protected function configure()
6161
public function execute(InputInterface $input, OutputInterface $output)
6262
{
6363
try {
64-
$this->logger->info('Starting transfer files.');
64+
$this->logger->notice('Starting transfer files.');
6565
$this->process->execute();
66-
$this->logger->info('Transfer completed.');
66+
$this->logger->notice('Transfer completed.');
6767
} catch (\Throwable $e) {
6868
$this->logger->critical($e->getMessage());
6969

src/Process/Build/ApplyPatches.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,13 @@ public function __construct(
4343
*/
4444
public function execute()
4545
{
46-
$this->logger->info('Applying patches.');
46+
$this->logger->notice('Applying patches.');
4747

4848
try {
4949
$this->manager->applyAll();
5050
} catch (GenericException $exception) {
5151
throw new ProcessException($exception->getMessage(), $exception->getCode(), $exception);
5252
}
53+
$this->logger->notice('End of applying patches.');
5354
}
5455
}

src/Process/Build/BackupData.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ public function __construct(LoggerInterface $logger, ProcessInterface $processes
4040
*/
4141
public function execute()
4242
{
43-
$this->logger->info('Copying data to the ./init directory');
43+
$this->logger->notice('Copying data to the ./init directory');
4444
$this->processes->execute();
45+
$this->logger->notice('End of copying data to the ./init directory');
4546
}
4647
}

src/Process/Build/DeployStaticContent.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,9 @@ public function execute()
6969
return;
7070
}
7171

72+
$this->logger->notice('Generating fresh static content');
7273
$this->process->execute();
7374
$this->flagManager->set(FlagManager::FLAG_STATIC_CONTENT_DEPLOY_IN_BUILD);
75+
$this->logger->notice('End of generating fresh static content');
7476
}
7577
}

src/Process/Deploy/DeployStaticContent.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ public function execute()
9797
$this->staticContentCleaner->clean();
9898
}
9999

100-
$this->logger->info('Generating fresh static content');
100+
$this->logger->notice('Generating fresh static content');
101101
$this->process->execute();
102+
$this->logger->notice('End of generating fresh static content');
102103
}
103104
}

src/Process/Deploy/InstallUpdate.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,13 @@ public function execute()
5959
{
6060
try {
6161
if (!$this->deployConfig->isInstalled()) {
62-
$this->logger->info('Starting install.');
62+
$this->logger->notice('Starting install.');
6363
$this->installProcess->execute();
64+
$this->logger->notice('End of install.');
6465
} else {
65-
$this->logger->info('Starting update.');
66+
$this->logger->notice('Starting update.');
6667
$this->updateProcess->execute();
68+
$this->logger->notice('End of update.');
6769
}
6870
} catch (GenericException $exception) {
6971
throw new ProcessException($exception->getMessage(), $exception->getCode(), $exception);

src/Process/Deploy/PreDeploy.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,14 @@ public function __construct(
5757
*/
5858
public function execute()
5959
{
60-
$this->logger->info('Starting pre-deploy.');
60+
$this->logger->notice('Starting pre-deploy.');
6161
$this->process->execute();
6262

6363
try {
6464
$this->maintenanceModeSwitcher->enable();
6565
} catch (ShellException $exception) {
6666
throw new ProcessException($exception->getMessage(), $exception->getCode(), $exception);
6767
}
68+
$this->logger->notice('End of pre-deploy.');
6869
}
6970
}

src/Process/Deploy/PreDeploy/RestoreWritableDirectories.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function execute()
7878
}
7979

8080
// Restore mounted directories.
81-
$this->logger->info('Recoverable directories were copied back.');
81+
$this->logger->notice('Recoverable directories were copied back.');
8282
$this->flagManager->delete(FlagManager::FLAG_REGENERATE);
8383
}
8484
}

src/Test/Unit/Command/Build/GenerateTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ protected function setUp()
5959
public function testExecute()
6060
{
6161
$this->loggerMock->expects($this->exactly(2))
62-
->method('info')
62+
->method('notice')
6363
->withConsecutive(
6464
['Starting generate command. Some info.'],
6565
['Generate command completed.']
@@ -88,7 +88,7 @@ public function testExecuteWithException()
8888
->method('getPrettyInfo')
8989
->willReturn('Some info.');
9090
$this->loggerMock->expects($this->once())
91-
->method('info')
91+
->method('notice')
9292
->with('Starting generate command. Some info.');
9393
$this->loggerMock->expects($this->once())
9494
->method('critical')

src/Test/Unit/Command/Build/TransferTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ protected function setUp()
5151
public function testExecute()
5252
{
5353
$this->loggerMock->expects($this->exactly(2))
54-
->method('info')
54+
->method('notice')
5555
->withConsecutive(
5656
['Starting transfer files.'],
5757
['Transfer completed.']
@@ -74,7 +74,7 @@ public function testExecute()
7474
public function testExecuteWithException()
7575
{
7676
$this->loggerMock->expects($this->once())
77-
->method('info')
77+
->method('notice')
7878
->with('Starting transfer files.');
7979
$this->loggerMock->expects($this->once())
8080
->method('critical')

src/Test/Unit/Process/Build/ApplyPatchesTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,12 @@ protected function setUp()
5050

5151
public function testExecute()
5252
{
53-
$this->loggerMock->expects($this->once())
54-
->method('info')
55-
->with('Applying patches.');
53+
$this->loggerMock->expects($this->exactly(2))
54+
->method('notice')
55+
->withConsecutive(
56+
['Applying patches.'],
57+
['End of applying patches.']
58+
);
5659
$this->managerMock->expects($this->once())
5760
->method('applyAll');
5861

src/Test/Unit/Process/Build/BackupDataTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,12 @@ protected function setUp()
4747

4848
public function testExecute()
4949
{
50-
$this->loggerMock->expects($this->once())
51-
->method('info')
52-
->with('Copying data to the ./init directory');
50+
$this->loggerMock->expects($this->exactly(2))
51+
->method('notice')
52+
->withConsecutive(
53+
['Copying data to the ./init directory'],
54+
['End of copying data to the ./init directory']
55+
);
5356

5457
$this->processesMock->expects($this->once())
5558
->method('execute');

src/Test/Unit/Process/Deploy/DeployStaticContentTest.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,12 @@ public function testExecuteOnRemoteInDeploy()
9494
->method('exists')
9595
->with(FlagManager::FLAG_STATIC_CONTENT_DEPLOY_IN_BUILD)
9696
->willReturn(false);
97-
$this->loggerMock->expects($this->once())
98-
->method('info')
99-
->with('Generating fresh static content');
97+
$this->loggerMock->expects($this->exactly(2))
98+
->method('notice')
99+
->withConsecutive(
100+
['Generating fresh static content'],
101+
['End of generating fresh static content']
102+
);
100103
$this->stageConfigMock->expects($this->any())
101104
->method('get')
102105
->willReturnMap([
@@ -121,10 +124,11 @@ public function testExecuteOnRemoteWithoutCleaning()
121124
->method('exists')
122125
->with(FlagManager::FLAG_STATIC_CONTENT_DEPLOY_IN_BUILD)
123126
->willReturn(false);
124-
$this->loggerMock->expects($this->once())
125-
->method('info')
127+
$this->loggerMock->expects($this->exactly(2))
128+
->method('notice')
126129
->withConsecutive(
127-
['Generating fresh static content']
130+
['Generating fresh static content'],
131+
['End of generating fresh static content']
128132
);
129133
$this->stageConfigMock->expects($this->any())
130134
->method('get')
@@ -164,9 +168,9 @@ public function testExecuteScdOnDemandInProduction()
164168
->willReturn(true);
165169
$this->loggerMock->expects($this->once())
166170
->method('notice')
167-
->with('Skipping static content deploy. SCD on demand is enabled.');
168-
$this->loggerMock->expects($this->never())
169-
->method('info');
171+
->withConsecutive(
172+
['Skipping static content deploy. SCD on demand is enabled.']
173+
);
170174
$this->flagManagerMock->expects($this->never())
171175
->method('exists');
172176
$this->staticContentCleanerMock->expects($this->once())

src/Test/Unit/Process/Deploy/InstallUpdateTest.php

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,12 @@ public function testExecuteInstall()
6161
$this->stateMock->expects($this->once())
6262
->method('isInstalled')
6363
->willReturn(false);
64-
$this->loggerMock->expects($this->once())
65-
->method('info')
66-
->with('Starting install.');
64+
$this->loggerMock->expects($this->exactly(2))
65+
->method('notice')
66+
->withConsecutive(
67+
['Starting install.'],
68+
['End of install.']
69+
);
6770
$this->installProcessMock->expects($this->once())
6871
->method('execute');
6972
$this->updateProcessMock->expects($this->never())
@@ -77,9 +80,12 @@ public function testExecuteUpdate()
7780
$this->stateMock->expects($this->once())
7881
->method('isInstalled')
7982
->willReturn(true);
80-
$this->loggerMock->expects($this->once())
81-
->method('info')
82-
->with('Starting update.');
83+
$this->loggerMock->expects($this->exactly(2))
84+
->method('notice')
85+
->withConsecutive(
86+
['Starting update.'],
87+
['End of update.']
88+
);
8389
$this->installProcessMock->expects($this->never())
8490
->method('execute');
8591
$this->updateProcessMock->expects($this->once())

src/Test/Unit/Process/Deploy/PreDeploy/RestoreWritableDirectoriesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function testExecute()
8484
['pub/media', 'copy']
8585
);
8686
$this->loggerMock->expects($this->once())
87-
->method('info')
87+
->method('notice')
8888
->with('Recoverable directories were copied back.');
8989
$this->flagManagerMock->expects($this->once())
9090
->method('delete')

src/Test/Unit/Process/Deploy/PreDeployTest.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,12 @@ protected function setUp()
5555

5656
public function testExecute()
5757
{
58-
$this->loggerMock->expects($this->once())
59-
->method('info')
60-
->with('Starting pre-deploy.');
58+
$this->loggerMock->expects($this->exactly(2))
59+
->method('notice')
60+
->withConsecutive(
61+
['Starting pre-deploy.'],
62+
['End of pre-deploy.']
63+
);
6164
$this->maintenanceModeSwitcher->expects($this->once())
6265
->method('enable');
6366
$this->processMock->expects($this->once())

0 commit comments

Comments
 (0)