Skip to content

Commit 683664a

Browse files
committed
B2B-2023: [AWS S3] [Integration Tests]: Investigate Test Failures in CatalogImportExport module
1 parent f937ea7 commit 683664a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

app/code/Magento/RemoteStorage/Plugin/Image.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,9 @@ public function aroundSave(
167167
public function __destruct()
168168
{
169169
try {
170-
foreach ($this->tmpFiles as $tmpFile) {
170+
foreach ($this->tmpFiles as $key => $tmpFile) {
171171
$this->tmpDirectoryWrite->delete($tmpFile);
172+
unset($this->tmpFiles[$key]);
172173
}
173174
} catch (\Exception $e) {
174175
$this->logger->error($e->getMessage());
@@ -192,7 +193,7 @@ private function copyFileToTmp(string $filePath): string
192193
$this->tmpDirectoryWrite->create();
193194
$tmpPath = $this->storeTmpName($filePath);
194195
$content = $this->remoteDirectoryWrite->getDriver()->fileGetContents($filePath);
195-
$filePath = $this->tmpDirectoryWrite->getDriver()->filePutContents($tmpPath, $content)
196+
$filePath = $this->tmpDirectoryWrite->getDriver()->filePutContents($tmpPath, $content) >= 0
196197
? $tmpPath
197198
: $filePath;
198199
}

dev/tests/integration/testsuite/Magento/CatalogImportExport/Model/Import/ProductTestBase.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Magento\ImportExport\Model\Import;
2222
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
2323
use Magento\ImportExport\Model\Import\Source\Csv;
24+
use Magento\RemoteStorage\Plugin\Image;
2425
use Magento\Store\Model\Store;
2526
use Magento\Store\Model\StoreManagerInterface;
2627
use Magento\TestFramework\Indexer\TestCase;
@@ -109,6 +110,9 @@ protected function tearDown(): void
109110
// nothing to delete
110111
}
111112
}
113+
// Removing cached images from previous tests in cases when Remote storage is configured
114+
$image = $this->objectManager->get(Image::class);
115+
$image->__destruct();
112116
}
113117

114118

0 commit comments

Comments
 (0)