openinx commented on a change in pull request #3596:
URL: https://github.com/apache/iceberg/pull/3596#discussion_r763602127
##########
File path:
aliyun/src/test/java/org/apache/iceberg/aliyun/oss/mock/TestLocalAliyunOSS.java
##########
@@ -42,7 +41,7 @@
public class TestLocalAliyunOSS {
@ClassRule
- public static final AliyunOSSTestRule OSS_TEST_RULE =
AliyunOSSTestUtility.initialize();
+ public static final AliyunOSSTestRule OSS_TEST_RULE =
AliyunOSSMockRule.builder().silent().build();
Review comment:
I guess you changed this because you are trying to address the test
issue:
```
export
ALIYUN_TEST_OSS_TEST_RULE_CLASS=org.apache.iceberg.aliyun.oss.OSSIntegrationTestRule
export ALIYUN_TEST_BUCKET=iceberg-test
export ALIYUN_TEST_ACCESS_KEY_ID=******
export ALIYUN_TEST_ACCESS_KEY_SECRET=******
export ALIYUN_TEST_OSS_WAREHOUSE=oss://iceberg-test/ci
export ALIYUN_TEST_OSS_ENDPOINT=oss-cn-hangzhou.aliyuncs.com
./gradlew iceberg-aliyun:test
```
The broken test:
```
> Task :iceberg-aliyun:test
org.apache.iceberg.aliyun.oss.mock.TestLocalAliyunOSS > testDeleteBucket
FAILED
com.aliyun.oss.OSSException: The bucket has objects. Please delete them
first.
[ErrorCode]: BucketNotEmpty
[RequestId]: 61AED497E868B3353408ACE8
[HostId]: iceberg-test.oss-cn-hangzhou.aliyuncs.com
[ResponseError]:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>BucketNotEmpty</Code>
<Message>The bucket has objects. Please delete them first.</Message>
<RequestId>61AED497E868B3353408ACE8</RequestId>
<HostId>iceberg-test.oss-cn-hangzhou.aliyuncs.com</HostId>
<BucketName>iceberg-test</BucketName>
</Error>
at
com.aliyun.oss.common.utils.ExceptionFactory.createOSSException(ExceptionFactory.java:100)
at
com.aliyun.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:70)
at
com.aliyun.oss.common.comm.ServiceClient.handleResponse(ServiceClient.java:257)
at
com.aliyun.oss.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:140)
at
com.aliyun.oss.common.comm.ServiceClient.sendRequest(ServiceClient.java:70)
at com.aliyun.oss.internal.OSSOperation.send(OSSOperation.java:83)
at
com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:145)
at
com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:102)
at
com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:97)
at
com.aliyun.oss.internal.OSSBucketOperation.deleteBucket(OSSBucketOperation.java:231)
at com.aliyun.oss.OSSClient.deleteBucket(OSSClient.java:352)
at com.aliyun.oss.OSSClient.deleteBucket(OSSClient.java:347)
at
org.apache.iceberg.aliyun.oss.mock.TestLocalAliyunOSS.testDeleteBucket(TestLocalAliyunOSS.java:100)
org.apache.iceberg.aliyun.oss.mock.TestLocalAliyunOSS > testBuckets FAILED
com.aliyun.oss.OSSException: The bucket has objects. Please delete them
first.
[ErrorCode]: BucketNotEmpty
[RequestId]: 61AED497D5C0693231492A8B
[HostId]: iceberg-test.oss-cn-hangzhou.aliyuncs.com
[ResponseError]:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>BucketNotEmpty</Code>
<Message>The bucket has objects. Please delete them first.</Message>
<RequestId>61AED497D5C0693231492A8B</RequestId>
<HostId>iceberg-test.oss-cn-hangzhou.aliyuncs.com</HostId>
<BucketName>iceberg-test</BucketName>
</Error>
at
com.aliyun.oss.common.utils.ExceptionFactory.createOSSException(ExceptionFactory.java:100)
at
com.aliyun.oss.internal.OSSErrorResponseHandler.handle(OSSErrorResponseHandler.java:70)
at
com.aliyun.oss.common.comm.ServiceClient.handleResponse(ServiceClient.java:257)
at
com.aliyun.oss.common.comm.ServiceClient.sendRequestImpl(ServiceClient.java:140)
at
com.aliyun.oss.common.comm.ServiceClient.sendRequest(ServiceClient.java:70)
at com.aliyun.oss.internal.OSSOperation.send(OSSOperation.java:83)
at
com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:145)
at
com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:102)
at
com.aliyun.oss.internal.OSSOperation.doOperation(OSSOperation.java:97)
at
com.aliyun.oss.internal.OSSBucketOperation.deleteBucket(OSSBucketOperation.java:231)
at com.aliyun.oss.OSSClient.deleteBucket(OSSClient.java:352)
at com.aliyun.oss.OSSClient.deleteBucket(OSSClient.java:347)
at
org.apache.iceberg.aliyun.oss.mock.TestLocalAliyunOSS.testBuckets(TestLocalAliyunOSS.java:75)
org.apache.iceberg.aliyun.oss.mock.TestLocalAliyunOSS > testPutObject FAILED
org.junit.ComparisonFailure:
expected:<6[e796fee4afcb1ce49f17ad8e214d]996> but
was:<6[E796FEE4AFCB1CE49F17AD8E214D]996>
at org.junit.Assert.assertEquals(Assert.java:117)
at org.junit.Assert.assertEquals(Assert.java:146)
at
org.apache.iceberg.aliyun.oss.mock.TestLocalAliyunOSS.testPutObject(TestLocalAliyunOSS.java:115)
37 tests completed, 3 failed
```
But I think the correct approach to address this issue is change the way to
design the unit tests, rather than making the test class only works for
`AliyunOSSMockRule`. In other words, we need to make this test class works
fine for both `OSSIntegrationTestRule` and `AliyunOSSMockRule` because we need
to guarantee the same semantics between the aliyun oss and mock oss app.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]