Skip to content

Commit fd712d6

Browse files
committed
B2B-1648: Implement Solution for Unblocking S3 MFTF Import Tests
- Converting permissions param to an octal - Adding umask to createDirectory
1 parent ccf637c commit fd712d6

6 files changed

+18
-5
lines changed

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ImportBundleProductTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<!-- Locally Copy Import Files to Unique Media Import Directory -->
2626
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="createDirectory" stepKey="createDirectoryForImportFiles" after="createCustomer">
2727
<argument name="path">pub/media/import/{{ImportProduct_Bundle.name}}</argument>
28-
<argument name="permissions">0777</argument>
2928
</helper>
3029
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="copy" stepKey="copyImportFile" after="createDirectoryForImportFiles">
3130
<argument name="source">dev/tests/acceptance/tests/_data/{{ImportProduct_Bundle.fileName}}</argument>

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ImportDownloadableProductsWithFileLinksTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<!-- Locally Copy Import Files to Unique Media Import Directory -->
2626
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="createDirectory" stepKey="createDirectoryForImportFiles" after="createCustomer">
2727
<argument name="path">pub/media/import/{{ImportProduct_Downloadable_FileLinks.name}}</argument>
28-
<argument name="permissions">0777</argument>
2928
</helper>
3029
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="copy" stepKey="copyImportFile" after="createDirectoryForImportFiles">
3130
<argument name="source">dev/tests/acceptance/tests/_data/{{ImportProduct_Downloadable_FileLinks.fileName}}</argument>

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ImportDownloadableProductsWithUrlLinksTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<!-- Locally Copy Import Files to Unique Media Import Directory -->
2626
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="createDirectory" stepKey="createDirectoryForImportFiles" after="createCustomer">
2727
<argument name="path">pub/media/import/{{ImportProduct_Downloadable_UrlLinks.name}}</argument>
28-
<argument name="permissions">0777</argument>
2928
</helper>
3029
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="copy" stepKey="copyImportFile" after="createDirectoryForImportFiles">
3130
<argument name="source">dev/tests/acceptance/tests/_data/{{ImportProduct_Downloadable_UrlLinks.fileName}}</argument>

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ImportGroupedProductTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
<!-- Locally Copy Import Files to Unique Media Import Directory -->
2626
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="createDirectory" stepKey="createDirectoryForImportFiles" after="createCustomer">
2727
<argument name="path">pub/media/import/{{ImportProduct_Grouped.name}}</argument>
28-
<argument name="permissions">0777</argument>
2928
</helper>
3029
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="copy" stepKey="copyImportFile" after="createDirectoryForImportFiles">
3130
<argument name="source">dev/tests/acceptance/tests/_data/{{ImportProduct_Grouped.fileName}}</argument>

app/code/Magento/AwsS3/Test/Mftf/Test/AdminAwsS3ImportSimpleAndConfigurableProductsWithAssignedImagesTest.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
<!-- Locally Copy Import Files to Unique Media Import Directory -->
2727
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="createDirectory" stepKey="createDirectoryForImportFiles" after="createCustomer">
2828
<argument name="path">pub/media/import/{{ImportProduct_Configurable.name}}</argument>
29-
<argument name="permissions">0777</argument>
3029
</helper>
3130
<helper class="\Magento\Catalog\Test\Mftf\Helper\LocalFileAssertions" method="copy" stepKey="copyImportFile" after="createDirectoryForImportFiles">
3231
<argument name="source">dev/tests/acceptance/tests/_data/{{ImportProduct_Configurable.fileName}}</argument>

app/code/Magento/Catalog/Test/Mftf/Helper/LocalFileAssertions.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,11 @@ public function copy($source, $destination): void
112112
*/
113113
public function createDirectory($path, $permissions = 0777): void
114114
{
115+
$permissions = $this->convertToOctal($permissions);
115116
$sourceRealPath = $this->expandPath($path);
117+
$oldUmask = umask(0);
116118
$this->driver->createDirectory($sourceRealPath, $permissions);
119+
umask($oldUmask);
117120
}
118121

119122
/**
@@ -223,6 +226,21 @@ public function assertDirectoryEmpty($path, $message = ""): void
223226
$this->assertEmpty($this->driver->readDirectory($realPath), $message);
224227
}
225228

229+
/**
230+
* Helper function to convert a string to an octal
231+
*
232+
* @param string $string
233+
* @return int
234+
*
235+
*/
236+
private function convertToOctal($string): int
237+
{
238+
if (is_string($string)) {
239+
$string = octdec($string);
240+
}
241+
return $string;
242+
}
243+
226244
/**
227245
* Helper function to construct the real path to the file
228246
*

0 commit comments

Comments
 (0)