Skip to content

Commit 39665d6

Browse files
committed
MC-5926: Conflict of simultaneous write in Redis cache
- fix integration test
1 parent da142df commit 39665d6

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

dev/tests/integration/framework/Magento/TestFramework/App/Shell.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@
1010
class Shell extends \Magento\Framework\App\Shell
1111
{
1212
/**
13+
* Override app/shell by running bin/magento located in the integration test and pass environment parameters
14+
*
1315
* @inheritdoc
1416
*/
1517
public function execute($command, array $arguments = [])

dev/tests/integration/framework/Magento/TestFramework/Isolation/DeploymentConfig.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ public function startTestSuite()
5858
public function endTest(\PHPUnit\Framework\TestCase $test)
5959
{
6060
$config = $this->reader->load();
61+
// ignore compiled_config setting because is not set in default mode
62+
if (isset($config['cache_types']['compiled_config'])) {
63+
unset($config['cache_types']['compiled_config']);
64+
}
6165
if ($this->config != $config) {
6266
$error = "\n\nERROR: deployment configuration is corrupted. The application state is no longer valid.\n"
6367
. 'Further tests may fail.'

dev/tests/integration/testsuite/Magento/Deploy/Console/Command/SetModeCommandTest.php

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,14 @@ public function tearDown()
9494
$this->writer->saveConfig([ConfigFilePool::APP_ENV => $this->envConfig]);
9595

9696
$this->clearStaticFiles();
97+
// enable default mode
98+
$this->commandTester = new CommandTester($this->getStaticContentDeployCommand());
99+
$this->commandTester->execute(
100+
['mode' => 'default']
101+
);
102+
$commandOutput = $this->commandTester->getDisplay();
103+
$this->assertEquals(Cli::RETURN_SUCCESS, $this->commandTester->getStatusCode());
104+
$this->assertContains('Enabled default mode', $commandOutput);
97105
}
98106

99107
/**
@@ -111,23 +119,11 @@ public function testSwitchMode()
111119
{
112120
if ($this->prevMode === 'production') {
113121
//in production mode, so we have to switch to dev, then to production
114-
$this->clearStaticFiles();
115122
$this->enableAndAssertDeveloperMode();
116123
$this->enableAndAssertProductionMode();
117124
} else {
118125
//already in non production mode
119-
//$this->clearStaticFiles();
120126
$this->enableAndAssertProductionMode();
121-
122-
// enable previous mode
123-
$this->clearStaticFiles();
124-
$this->commandTester = new CommandTester($this->getStaticContentDeployCommand());
125-
$this->commandTester->execute(
126-
['mode' => $this->prevMode]
127-
);
128-
$commandOutput = $this->commandTester->getDisplay();
129-
$this->assertEquals(Cli::RETURN_SUCCESS, $this->commandTester->getStatusCode());
130-
$this->assertContains('Enabled ' . $this->prevMode . ' mode', $commandOutput);
131127
}
132128
}
133129

@@ -139,7 +135,6 @@ public function testSwitchMode()
139135
private function enableAndAssertProductionMode()
140136
{
141137
// Enable production mode
142-
$this->clearStaticFiles();
143138
$this->commandTester = new CommandTester($this->getStaticContentDeployCommand());
144139
$this->commandTester->execute(
145140
['mode' => 'production']

0 commit comments

Comments
 (0)