Skip to content
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

Georges suggestions #8

Open
wants to merge 3 commits into
base: georgeMaster
Choose a base branch
from
Open

Conversation

GeorgeJahad
Copy link
Owner

@GeorgeJahad GeorgeJahad commented Mar 10, 2022

No description provided.

@@ -84,7 +86,7 @@ public OmTestManagers(OzoneConfiguration conf,
blockClient =
new ScmBlockLocationTestingClient(null, null, 0);
}

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove this

@@ -116,7 +118,15 @@ public OmTestManagers(OzoneConfiguration conf,
.getInternalState(om, "bucketManager");
prefixManager = (PrefixManagerImpl)HddsWhiteboxTestUtils
.getInternalState(om, "prefixManager");
}

public KeyProviderCryptoExtension kmsProviderInit() {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment something like:

// returns a mock kmsProvider

import org.junit.Assert;
import org.junit.Test;
import org.junit.Rule;

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did you add these here and remove them below?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed that as well to minimize the diffs


import org.apache.hadoop.crypto.key.KeyProvider;
import org.apache.hadoop.crypto.key.KeyProviderCryptoExtension;
import org.apache.hadoop.hdds.client.StandaloneReplicationConfig;
import org.apache.hadoop.hdds.conf.OzoneConfiguration;
import org.apache.hadoop.hdds.protocol.StorageType;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why did this change?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the IDE altered it because I was making a static reference to ReplicationFactor like HddsProtos.ReplicationFactor, but I changed it to minimize the changes.

@@ -67,51 +85,51 @@ private OzoneConfiguration createNewTestPath() throws IOException {
return conf;
}

private OmMetadataManagerImpl createSampleVol() throws IOException {
private void createSampleVol() throws IOException, AuthenticationException {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really need the AuthenticationException?

Copy link

@xBis7 xBis7 Mar 11, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need that due to initialization of OmTestManagers. If I remove that there is an error from the IDE.

try {
BucketManager bucketManager = new BucketManagerImpl(metaMgr);
OzoneManagerProtocol writeCl = omTestManagers.getWriteClient();
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we've used writeClient everywhere else. I would use that instead of writeCl here.

It's good to be consistent unless there is a good reason otherwise.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I declared OzoneManagerProtocol as well based on your PR and then I was getting an error from checkstyle about hiding the class field with the same name. But now I realize there is a so much better way and simpler way because the class field has not been initialized. I will fix that.

.setBucketEncryptionKey(new
BucketEncryptionKeyInfo.Builder().setKeyName("key1").build())
BucketEncryptionKeyInfo.Builder().setKeyName("key1").build())
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space?


OmBucketInfo bucketInfoRead =
bucketManager.getBucketInfo("sampleVol", "bucketOne");
bucketManager.getBucketInfo("sample-vol", "bucket-one");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space


Assert.assertTrue(bucketInfoRead.getEncryptionKeyInfo().getKeyName()
.equals(bucketInfo.getEncryptionKeyInfo().getKeyName()));
metaMgr.getStore().close();
.equals(bucketInfo.getEncryptionKeyInfo().getKeyName()));
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra space

}

private OzoneConfiguration createNewTestPath() throws IOException,
AuthenticationException {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really need the AuthenticationException?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's actually not needed, I will remove it. I declared inside the method omTestManagers but when I removed the field, I forgot about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants