Skip to content

Commit 0057a8b

Browse files
author
Fabian Morgan
committed
remove no longer used method and remove sts terminology from unit test
Conflicts: hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
1 parent db40ff8 commit 0057a8b

2 files changed

Lines changed: 10 additions & 14 deletions

File tree

hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ public static void setS3Auth(S3Authentication val) {
877877
public static S3Authentication getS3Auth() {
878878
return S3_AUTH.get();
879879
}
880-
880+
881881
/** Returns the ThreadName prefix for the current OM. */
882882
public String getThreadNamePrefix() {
883883
return threadPrefix;

hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManagerListMultipartUploadsAcls.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import org.apache.hadoop.ozone.om.exceptions.OMException;
4949
import org.apache.hadoop.ozone.om.helpers.OmMultipartUploadList;
5050
import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.S3Authentication;
51-
import org.apache.hadoop.ozone.security.STSTokenIdentifier;
5251
import org.junit.jupiter.api.AfterAll;
5352
import org.junit.jupiter.api.AfterEach;
5453
import org.junit.jupiter.api.BeforeAll;
@@ -59,7 +58,7 @@
5958
import org.mockito.InOrder;
6059

6160
/**
62-
* Unit tests for STS + ACL checks on {@link OzoneManager#listMultipartUploads}.
61+
* Unit tests for ACL checks on {@link OzoneManager#listMultipartUploads}.
6362
*/
6463
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
6564
public class TestOzoneManagerListMultipartUploadsAcls {
@@ -77,7 +76,6 @@ public class TestOzoneManagerListMultipartUploadsAcls {
7776
private static final String REAL_VOLUME = "realVolume";
7877
private static final String REAL_BUCKET = "realBucket";
7978
private static final String PREFIX = "prefix";
80-
private static final String STS_ACCESS_ID = "ASIA7O1AJD8VV4KCEAX5";
8179

8280
@BeforeAll
8381
void setup(@TempDir File folder) throws Exception {
@@ -122,12 +120,11 @@ void init() throws Exception {
122120
@AfterEach
123121
void tearDown() {
124122
OzoneManager.setS3Auth(null);
125-
OzoneManager.setStsTokenIdentifier(null);
126123
}
127124

128125
@Test
129-
void testSkipsAclChecksWhenAclsAreDisabledEvenForStsRequest() throws Exception {
130-
setupStsS3Request();
126+
void testSkipsAclChecksWhenAclsAreDisabled() throws Exception {
127+
setupS3Request();
131128
when(omSpy.getAclsEnabled()).thenReturn(false);
132129

133130
omSpy.listMultipartUploads(REQUESTED_VOLUME, REQUESTED_BUCKET, PREFIX, "", "", 10, false);
@@ -138,8 +135,8 @@ void testSkipsAclChecksWhenAclsAreDisabledEvenForStsRequest() throws Exception {
138135
}
139136

140137
@Test
141-
void testAclsEnabledAndStsRequestChecksBucketReadThenListUsingResolvedNames() throws Exception {
142-
setupStsS3Request();
138+
void testAclsEnabledChecksBucketReadThenListUsingResolvedNames() throws Exception {
139+
setupS3Request();
143140
when(omSpy.getAclsEnabled()).thenReturn(true);
144141

145142
omSpy.listMultipartUploads(REQUESTED_VOLUME, REQUESTED_BUCKET, PREFIX, "", "", 10, false);
@@ -157,7 +154,7 @@ void testAclsEnabledAndStsRequestChecksBucketReadThenListUsingResolvedNames() th
157154

158155
@Test
159156
void testReadAclAccessDeniedSkipsKeyManagerAndListAclChecksAndIncrementsFailMetric() throws Exception {
160-
setupStsS3Request();
157+
setupS3Request();
161158
when(omSpy.getAclsEnabled()).thenReturn(true);
162159

163160
doThrow(new OMException("denied", OMException.ResultCodes.PERMISSION_DENIED))
@@ -176,7 +173,7 @@ void testReadAclAccessDeniedSkipsKeyManagerAndListAclChecksAndIncrementsFailMetr
176173

177174
@Test
178175
void testListAclAccessDeniedSkipsKeyManagerAndIncrementsFailMetric() throws Exception {
179-
setupStsS3Request();
176+
setupS3Request();
180177
when(omSpy.getAclsEnabled()).thenReturn(true);
181178

182179
doNothing().when(omMetadataReader).checkAcls(BUCKET, OZONE, READ, REAL_VOLUME, REAL_BUCKET, null);
@@ -193,8 +190,7 @@ void testListAclAccessDeniedSkipsKeyManagerAndIncrementsFailMetric() throws Exce
193190
verify(metrics, never()).incNumListMultipartUploads();
194191
}
195192

196-
private void setupStsS3Request() {
197-
OzoneManager.setS3Auth(S3Authentication.newBuilder().setAccessId(STS_ACCESS_ID).build());
198-
OzoneManager.setStsTokenIdentifier(mock(STSTokenIdentifier.class));
193+
private void setupS3Request() {
194+
OzoneManager.setS3Auth(S3Authentication.newBuilder().setAccessId("AKIAJWFJK62WUTKNFJJA").build());
199195
}
200196
}

0 commit comments

Comments
 (0)