Skip to content

Commit f543cef

Browse files
committed
MAGECLOUD-2895: The var/log/install_upgrade.log is useless without dividers and timestamps
1 parent 6a0198f commit f543cef

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

src/Process/Deploy/InstallUpdate/Install/Setup.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ public function execute()
112112
}
113113

114114
try {
115+
$this->shell->execute("echo 'Installation time: '$(date)");
115116
$this->shell->execute(sprintf(
116117
'/bin/bash -c "set -o pipefail; %s | tee -a %s"',
117118
escapeshellcmd($command),

src/Process/Deploy/InstallUpdate/Update/Setup.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ public function execute()
9696

9797
$this->logger->info('Running setup upgrade.');
9898

99+
$this->shell->execute("echo 'Upgrading time: '$(date)");
99100
$this->shell->execute(sprintf(
100101
'/bin/bash -c "set -o pipefail; %s | tee -a %s"',
101102
'php ./bin/magento setup:upgrade --keep-generated --ansi --no-interaction ' . $verbosityLevel,

src/Test/Unit/Process/Deploy/InstallUpdate/Install/SetupTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -184,18 +184,19 @@ public function testExecute(
184184
. ' --admin-firstname=\'' . $adminFirstnameExpected . '\' --admin-lastname=\'' . $adminLastnameExpected
185185
. '\' --admin-email=\'' . $adminEmail . '\' --admin-password=\'' . $adminPasswordExpected . '\''
186186
: '';
187-
$this->shellMock->expects($this->once())
187+
$this->shellMock->expects($this->exactly(2))
188188
->method('execute')
189-
->with(
190-
'/bin/bash -c "set -o pipefail;'
189+
->withConsecutive(
190+
["echo 'Installation time: '$(date)"],
191+
['/bin/bash -c "set -o pipefail;'
191192
. ' php ./bin/magento setup:install -n --session-save=db --cleanup-database --currency=\'USD\''
192193
. ' --base-url=\'http://unsecure.url\' --base-url-secure=\'https://secure.url\' --language=\'fr_FR\''
193194
. ' --timezone=America/Los_Angeles --db-host=\'localhost\' --db-name=\'magento\' --db-user=\'user\''
194195
. ' --backend-frontname=\'' . $adminUrlExpected . '\''
195196
. $adminCredential
196197
. ' --use-secure-admin=1 --ansi --no-interaction'
197198
. ' --db-password=\'password\' -v'
198-
. ' | tee -a ' . $installUpgradeLog . '"'
199+
. ' | tee -a ' . $installUpgradeLog . '"']
199200
);
200201

201202
$this->process->execute();

src/Test/Unit/Process/Deploy/InstallUpdate/Update/SetupTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,12 +105,13 @@ public function testExecute()
105105
$this->flagManagerMock->expects($this->exactly(2))
106106
->method('delete')
107107
->with(FlagManager::FLAG_REGENERATE);
108-
$this->shellMock->expects($this->once())
108+
$this->shellMock->expects($this->exactly(2))
109109
->method('execute')
110-
->with(
111-
'/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade '
110+
->withConsecutive(
111+
["echo 'Upgrading time: '$(date)"],
112+
['/bin/bash -c "set -o pipefail; php ./bin/magento setup:upgrade '
112113
. '--keep-generated --ansi --no-interaction -v | tee -a '
113-
. $installUpgradeLog . '"'
114+
. $installUpgradeLog . '"']
114115
);
115116
$this->loggerMock->expects($this->once())
116117
->method('info')

0 commit comments

Comments
 (0)