-
Notifications
You must be signed in to change notification settings - Fork 589
HDDS-12524. Reuse TestDataUtil.createKey in more tests #8270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 11 commits
7d40d1f
f6505b3
0d8151b
548961e
032e850
ed03311
8fb2894
0ace6a2
bc6bdca
63bc83c
b45db54
d183df3
ef93908
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -57,12 +57,12 @@ | |||||||||
| import java.nio.charset.StandardCharsets; | ||||||||||
| import java.nio.file.Paths; | ||||||||||
| import java.security.PrivilegedExceptionAction; | ||||||||||
| import java.security.SecureRandom; | ||||||||||
| import java.util.ArrayList; | ||||||||||
| import java.util.Arrays; | ||||||||||
| import java.util.Collection; | ||||||||||
| import java.util.Collections; | ||||||||||
| import java.util.EnumSet; | ||||||||||
| import java.util.HashMap; | ||||||||||
| import java.util.Iterator; | ||||||||||
| import java.util.LinkedList; | ||||||||||
| import java.util.List; | ||||||||||
|
|
@@ -113,7 +113,6 @@ | |||||||||
| import org.apache.hadoop.ozone.client.OzoneKeyDetails; | ||||||||||
| import org.apache.hadoop.ozone.client.OzoneVolume; | ||||||||||
| import org.apache.hadoop.ozone.client.VolumeArgs; | ||||||||||
| import org.apache.hadoop.ozone.client.io.OzoneOutputStream; | ||||||||||
| import org.apache.hadoop.ozone.client.protocol.ClientProtocol; | ||||||||||
| import org.apache.hadoop.ozone.om.OMConfigKeys; | ||||||||||
| import org.apache.hadoop.ozone.om.OMMetrics; | ||||||||||
|
|
@@ -216,6 +215,7 @@ public Path getBucketPath() { | |||||||||
| private Path bucketPath; | ||||||||||
| private String rootPath; | ||||||||||
| private final BucketLayout bucketLayout; | ||||||||||
| private SecureRandom random; | ||||||||||
|
|
||||||||||
| private static final String USER1 = "regularuser1"; | ||||||||||
| private static final UserGroupInformation UGI_USER1 = UserGroupInformation | ||||||||||
|
|
@@ -274,6 +274,7 @@ void initClusterAndEnv() throws IOException, InterruptedException, TimeoutExcept | |||||||||
| userOfs = UGI_USER1.doAs( | ||||||||||
| (PrivilegedExceptionAction<RootedOzoneFileSystem>)() | ||||||||||
| -> (RootedOzoneFileSystem) FileSystem.get(conf)); | ||||||||||
| random = new SecureRandom(); | ||||||||||
| } | ||||||||||
|
|
||||||||||
| protected OMMetrics getOMMetrics() { | ||||||||||
|
|
@@ -342,12 +343,10 @@ void testListStatusWithIntermediateDirWithECEnabled() | |||||||||
| String key = "object-dir/object-name1"; | ||||||||||
|
|
||||||||||
| // write some test data into bucket | ||||||||||
| try (OzoneOutputStream outputStream = objectStore.getVolume(volumeName). | ||||||||||
| getBucket(bucketName).createKey(key, 1, | ||||||||||
| new ECReplicationConfig("RS-3-2-1024k"), | ||||||||||
| new HashMap<>())) { | ||||||||||
| outputStream.write(RandomUtils.nextBytes(1)); | ||||||||||
| } | ||||||||||
| byte[] bytes = new byte[1]; | ||||||||||
| random.nextBytes(bytes); | ||||||||||
| TestDataUtil.createKey(objectStore.getVolume(volumeName).getBucket(bucketName), key, | ||||||||||
| new ECReplicationConfig("RS-3-2-1024k"), bytes); | ||||||||||
|
||||||||||
| TestDataUtil.createKey(objectStore.getVolume(volumeName).getBucket(bucketName), key, | |
| new ECReplicationConfig("RS-3-2-1024k"), bytes); | |
| TestDataUtil.createKey(objectStore.getVolume(volumeName).getBucket(bucketName), key, | |
| new ECReplicationConfig("RS-3-2-1024k"), RandomUtils.secure().nextBytes(1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
RandomUtils.secure().randomBytes(1)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we don't need to use secure here, or you just want to avoid the deprecated warning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry, I got it, the RandomUtils.nextBytes(1)) would cause spotbugs error.
Updated the code suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
randommember variable is unused after d183df3, please remove. Also remove import ofSecureRandom.