srdo commented on a change in pull request #2990: STORM-3372: Fix NPE when
shutting down HFSSpout, fix storm-hdfs tests…
URL: https://github.com/apache/storm/pull/2990#discussion_r281024077
##########
File path:
external/storm-hdfs-blobstore/src/test/java/org/apache/storm/hdfs/blobstore/BlobStoreTest.java
##########
@@ -289,133 +280,130 @@ public void testReplication(String path, BlobStore
store)
store.deleteBlob("test", getSubject(createSubject));
}
- public Subject getSubject(String name) {
+ public static Subject getSubject(String name) {
Subject subject = new Subject();
SingleUserPrincipal user = new SingleUserPrincipal(name);
subject.getPrincipals().add(user);
return subject;
}
-
- // Check for Blobstore with authentication
- public void testWithAuthentication(BlobStore store)
- throws Exception {
- //Test for Nimbus Admin
- Subject admin = getSubject("admin");
- assertStoreHasExactly(store);
- SettableBlobMeta metadata = new
SettableBlobMeta(BlobStoreAclHandler.DEFAULT);
- try (AtomicOutputStream out = store.createBlob("test", metadata,
admin)) {
- assertStoreHasExactly(store, "test");
- out.write(1);
+
+ static enum AuthenticationTestSubject {
+ //Nimbus Admin
+ ADMIN(getSubject("admin")),
+ //Nimbus groups admin
+ ADMIN_GROUPS_USER(getSubject("adminGroupsUser")),
+ //Supervisor admin
+ SUPERVISOR(getSubject("supervisor")),
+ //Nimbus itself
+ NIMBUS(getNimbusSubject());
+
+ private Subject subject;
+
+ private AuthenticationTestSubject(Subject subject) {
+ this.subject = subject;
}
- store.deleteBlob("test", admin);
-
- //Test for Nimbus Groups Admin
- Subject adminsGroupsUser = getSubject("adminsGroupsUser");
- assertStoreHasExactly(store);
- metadata = new SettableBlobMeta(BlobStoreAclHandler.DEFAULT);
- try (AtomicOutputStream out = store.createBlob("test", metadata,
adminsGroupsUser)) {
- assertStoreHasExactly(store, "test");
- out.write(1);
+ }
+
+ @ParameterizedTest
+ @EnumSource(value = AuthenticationTestSubject.class)
+ void testWithAuthentication(AuthenticationTestSubject testSubject) throws
Exception {
+ try (AutoCloseableBlobStoreContainer container =
initHdfs("/storm/blobstore-auth-" + testSubject.name())) {
Review comment:
This method corresponds to the previous `testWithAuthentication`. I've just
pulled the initWithHdfs call into it, where it was previously happening in the
wrapper method (e.g. `testHdfsWithAuth`)
The `testWithAuthentication` method was fairly large, so I've split it into
multiple tests. This corresponds to the first part of the previous test, down
to
https://github.com/apache/storm/pull/2990/files#diff-a48145dd5bbd83aced6dd85b1d85ec64L340
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services