|
81 | 81 | import org.junit.After; |
82 | 82 | import org.junit.AfterClass; |
83 | 83 | import org.junit.Assert; |
| 84 | + |
| 85 | +import static org.apache.hadoop.ozone.web.ozShell.s3.GetS3SecretHandler.OZONE_GETS3SECRET_ERROR; |
84 | 86 | import static org.junit.Assert.assertEquals; |
85 | 87 | import static org.junit.Assert.assertNotNull; |
86 | 88 | import static org.junit.Assert.assertTrue; |
87 | 89 | import static org.junit.Assert.fail; |
88 | 90 | import org.junit.Before; |
89 | 91 | import org.junit.BeforeClass; |
90 | | -import org.junit.Ignore; |
91 | 92 | import org.junit.Rule; |
92 | 93 | import org.junit.Test; |
93 | 94 | import org.junit.rules.Timeout; |
@@ -1214,36 +1215,18 @@ public void testS3BucketMapping() throws IOException { |
1214 | 1215 | } |
1215 | 1216 |
|
1216 | 1217 | @Test |
1217 | | - @Ignore("Can't run without secure cluster.") |
1218 | 1218 | public void testS3Secret() throws Exception { |
1219 | 1219 | String setOmAddress = |
1220 | 1220 | "--set=" + OZONE_OM_ADDRESS_KEY + "=" + getOmAddress(); |
1221 | 1221 |
|
1222 | | - err.reset(); |
1223 | | - String outputFirstAttempt; |
1224 | | - String outputSecondAttempt; |
| 1222 | + String output; |
1225 | 1223 |
|
1226 | | - //First attempt: If secrets are not found in database, they will be created |
1227 | 1224 | String[] args = new String[] {setOmAddress, "s3", "getsecret"}; |
1228 | 1225 | execute(shell, args); |
1229 | | - outputFirstAttempt = out.toString(); |
1230 | | - //Extracting awsAccessKey & awsSecret value from output |
1231 | | - String[] output = outputFirstAttempt.split("\n"); |
1232 | | - String awsAccessKey = output[0].split("=")[1]; |
1233 | | - String awsSecret = output[1].split("=")[1]; |
1234 | | - assertTrue((awsAccessKey != null && awsAccessKey.length() > 0) && |
1235 | | - (awsSecret != null && awsSecret.length() > 0)); |
1236 | | - |
1237 | | - out.reset(); |
1238 | | - |
1239 | | - //Second attempt: Since secrets were created in previous attempt, it |
1240 | | - // should return the same value |
1241 | | - args = new String[] {setOmAddress, "s3", "getsecret"}; |
1242 | | - execute(shell, args); |
1243 | | - outputSecondAttempt = out.toString(); |
| 1226 | + // Get the first line of output |
| 1227 | + output = out.toString().split("\n")[0]; |
1244 | 1228 |
|
1245 | | - //verifying if secrets from both attempts are same |
1246 | | - assertTrue(outputFirstAttempt.equals(outputSecondAttempt)); |
| 1229 | + assertTrue(output.equals(OZONE_GETS3SECRET_ERROR)); |
1247 | 1230 | } |
1248 | 1231 |
|
1249 | 1232 | private void createS3Bucket(String userName, String s3Bucket) { |
|
0 commit comments