Skip to content

Commit

Permalink
LRQA-30539 Pass in unique bucket id
Browse files Browse the repository at this point in the history
  • Loading branch information
vicnate5 authored and brianchandotcom committed Jun 5, 2021
1 parent 20c500c commit d469c36
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 32 deletions.
10 changes: 5 additions & 5 deletions build-test-aws-s3.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<local name="bucket.objects" />

<exec executable="aws" outputproperty="bucket.objects">
<arg line="s3api list-objects --bucket lfr-qa-poshi-test-${bucket.id} --prefix ${companyId}/${groupId}" />
<arg line="s3api list-objects --bucket lfr-qa-poshi-test-${aws.bucket.id} --prefix ${companyId}/${groupId}" />
</exec>

<echo>${bucket.objects}</echo>
Expand All @@ -76,7 +76,7 @@
<local name="bucket.objects" />

<exec executable="aws" outputproperty="bucket.objects">
<arg line="s3api list-objects --bucket lfr-qa-poshi-test-${bucket.id} --prefix ${companyId}/${groupId}" />
<arg line="s3api list-objects --bucket lfr-qa-poshi-test-${aws.bucket.id} --prefix ${companyId}/${groupId}" />
</exec>

<echo>${bucket.objects}</echo>
Expand Down Expand Up @@ -118,14 +118,14 @@
<local name="bucket.create.output" />

<exec executable="aws" outputproperty="bucket.create.output">
<arg line="s3api create-bucket --bucket lfr-qa-poshi-test-${bucket.id} --region us-west-1 --create-bucket-configuration LocationConstraint=us-west-1" />
<arg line="s3api create-bucket --bucket lfr-qa-poshi-test-${aws.bucket.id} --region us-west-1 --create-bucket-configuration LocationConstraint=us-west-1" />
</exec>

<echo>${bucket.create.output}</echo>

<if>
<not>
<contains string="${bucket.create.output}" substring="lfr-qa-poshi-test-${bucket.id}" />
<contains string="${bucket.create.output}" substring="lfr-qa-poshi-test-${aws.bucket.id}" />
</not>
<then>
<fail>Bucket is not created.</fail>
Expand All @@ -135,7 +135,7 @@

<target name="delete-s3-bucket">
<exec executable="aws">
<arg line="s3 rb s3://lfr-qa-poshi-test-${bucket.id} --force" />
<arg line="s3 rb s3://lfr-qa-poshi-test-${aws.bucket.id} --force" />
</exec>

<delete-expired-buckets />
Expand Down
64 changes: 40 additions & 24 deletions build-test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1863,6 +1863,34 @@ war.path=${app.server.portal.dir}/</echo>
</sequential>
</macrodef>

<macrodef name="prepare-aws-s3-configuration">
<sequential>
<echo file="${liferay.home}/osgi/configs/com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config">
cacheDirCleanUpExpunge=&quot;7&quot;
ntlmProxyDomain=&quot;&quot;
proxyAuthType=&quot;none&quot;
httpClientMaxConnections=&quot;50&quot;
secretKey=&quot;${aws.s3.secret.access.key}&quot;
httpClientMaxErrorRetry=&quot;5&quot;
accessKey=&quot;${aws.s3.access.key.id}&quot;
cacheDirCleanUpFrequency=&quot;100&quot;
connectionTimeout=&quot;10000&quot;
multipartUploadThreshold=&quot;10485760&quot;
bucketName=&quot;lfr-qa-poshi-test-${aws.bucket.id}&quot;
minimumUploadPartSize=&quot;5242880&quot;
proxyPassword=&quot;&quot;
maxPoolSize=&quot;20&quot;
proxyUsername=&quot;&quot;
proxyPort=&quot;12345&quot;
s3Region=&quot;us-west-1&quot;
proxyHost=&quot;&quot;
ntlmProxyWorkstation=&quot;&quot;
corePoolSize=&quot;7&quot;
s3StorageClass=&quot;STANDARD&quot;
s3Endpoint=&quot;s3.us-west-1.amazonaws.com&quot;</echo>
</sequential>
</macrodef>

<macrodef name="prepare-blacklist-configuration">
<sequential>
<var name="blacklistBundleSymbolicNames" value="[&quot;com.liferay.portal.mobile.device.detection.fiftyonedegrees.api&quot;,&quot;com.liferay.portal.mobile.device.detection.fiftyonedegrees.enterprise&quot;,&quot;com.liferay.portal.mobile.device.detection.fiftyonedegrees.enterprise.test.data&quot;,&quot;com.liferay.portal.mobile.device.detection.fiftyonedegrees&quot;]" />
Expand Down Expand Up @@ -9098,29 +9126,6 @@ jdbc.default.connectionProperties=oracle.jdbc.ReadTimeout=0;oracle.net.CONNECT_T
<echo append="true" file="portal-impl/src/portal-ext.properties">

dl.store.impl=com.liferay.portal.store.s3.S3Store</echo>
<echo file="${liferay.home}/osgi/configs/com.liferay.portal.store.s3.configuration.S3StoreConfiguration.config">
cacheDirCleanUpExpunge=&quot;7&quot;
ntlmProxyDomain=&quot;&quot;
proxyAuthType=&quot;none&quot;
httpClientMaxConnections=&quot;50&quot;
secretKey=&quot;${aws.s3.secret.access.key}&quot;
httpClientMaxErrorRetry=&quot;5&quot;
accessKey=&quot;${aws.s3.access.key.id}&quot;
cacheDirCleanUpFrequency=&quot;100&quot;
connectionTimeout=&quot;10000&quot;
multipartUploadThreshold=&quot;10485760&quot;
bucketName=&quot;lfr-qa-poshi-test&quot;
minimumUploadPartSize=&quot;5242880&quot;
proxyPassword=&quot;&quot;
maxPoolSize=&quot;20&quot;
proxyUsername=&quot;&quot;
proxyPort=&quot;12345&quot;
s3Region=&quot;us-west-1&quot;
proxyHost=&quot;&quot;
ntlmProxyWorkstation=&quot;&quot;
corePoolSize=&quot;7&quot;
s3StorageClass=&quot;STANDARD&quot;
s3Endpoint=&quot;s3.us-west-1.amazonaws.com&quot;</echo>
</then>
</if>

Expand Down Expand Up @@ -9570,6 +9575,15 @@ auto.deploy.dest.dir=C:/WINDOWS/system32/config/systemprofile/liferay/websphere-
test.retry.command.wait.time=${test.retry.command.wait.time}
</echo>

<if>
<isset property="aws.bucket.id" />
<then>
<echo append="true" file="${test.ext.properties.file}">
aws.bucket.id=${aws.bucket.id}
</echo>
</then>
</if>

<if>
<isset property="browser.chrome.bin.args" />
<then>
Expand Down Expand Up @@ -13521,12 +13535,14 @@ module.framework.properties.blacklist.portal.profile.names=${blacklist.portal.pr
<equals arg1="${aws.store.enabled}" arg2="true" />
<then>
<tstamp>
<format pattern="yyyyMMddkkmmssSSS" property="bucket.id" />
<format pattern="yyyyMMddkkmmssSSS" property="aws.bucket.id" />
</tstamp>

<ant antfile="build-test-aws-s3.xml" target="configure-aws-cli" />

<ant antfile="build-test-aws-s3.xml" target="create-s3-bucket" />

<prepare-aws-s3-configuration />
</then>
</if>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ definition {

JSONGroup.addGroup(groupName = "Test Site Name");

var bucketID = PropsUtil.get("aws.bucket.id");
var companyId = JSONCompany.getCompanyId();
var groupId = JSONGroupAPI._getGroupIdByName(groupName = "Test Site Name", site = "true");

AntCommand(
locator1 = "build-test-aws-s3.xml",
value1 = "assert-no-document-in-bucket -DcompanyId=${companyId} -DgroupId=${groupId}");
value1 = "assert-no-document-in-bucket -Daws.bucket.id=${bucketID} -DcompanyId=${companyId} -DgroupId=${groupId}");

JSONDocument.addFileWithUploadedFile(
dmDocumentDescription = "DM Document Description",
Expand All @@ -87,7 +88,7 @@ definition {

AntCommand(
locator1 = "build-test-aws-s3.xml",
value1 = "assert-document-in-bucket -DcompanyId=${companyId} -DgroupId=${groupId}");
value1 = "assert-document-in-bucket -Daws.bucket.id=${bucketID} -DcompanyId=${companyId} -DgroupId=${groupId}");

DMNavigator.openDocumentsAndMediaAdmin(siteURLKey = "test-site-name");

Expand All @@ -103,7 +104,7 @@ definition {

AntCommand(
locator1 = "build-test-aws-s3.xml",
value1 = "assert-no-document-in-bucket -DcompanyId=${companyId} -DgroupId=${groupId}");
value1 = "assert-no-document-in-bucket -Daws.bucket.id=${bucketID} -DcompanyId=${companyId} -DgroupId=${groupId}");
}

@priority = "5"
Expand Down

0 comments on commit d469c36

Please sign in to comment.