4848import org .apache .hadoop .ozone .om .exceptions .OMException ;
4949import org .apache .hadoop .ozone .om .helpers .OmMultipartUploadList ;
5050import org .apache .hadoop .ozone .protocol .proto .OzoneManagerProtocolProtos .S3Authentication ;
51- import org .apache .hadoop .ozone .security .STSTokenIdentifier ;
5251import org .junit .jupiter .api .AfterAll ;
5352import org .junit .jupiter .api .AfterEach ;
5453import org .junit .jupiter .api .BeforeAll ;
5958import 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 )
6564public 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