Will-Lo commented on a change in pull request #3142:
URL: https://github.com/apache/incubator-gobblin/pull/3142#discussion_r518924533



##########
File path: 
gobblin-restli/gobblin-flow-config-service/gobblin-flow-config-service-client/src/test/java/org/apache/gobblin/service/FlowConfigV2Test.java
##########
@@ -185,20 +203,102 @@ public void testBadPartialUpdate() throws Exception {
     _client.partialUpdateFlowConfig(flowId, flowConfigPatch);
   }
 
-  @Test (expectedExceptions = RestLiResponseException.class)
+  @Test
   public void testDisallowedRequester() throws Exception {
-    ServiceRequester testRequester = new ServiceRequester("testName", 
"testType", "testFrom");
-    _requesterService.setRequester(testRequester);
+    try {
+      ServiceRequester testRequester = new ServiceRequester("testName", 
"testType", "testFrom");
+      _requesterService.setRequester(testRequester);
+
+      Map<String, String> flowProperties = Maps.newHashMap();
+      flowProperties.put("param1", "value1");
+
+      FlowConfig flowConfig = new FlowConfig().setId(new 
FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME_4))
+          .setTemplateUris(TEST_TEMPLATE_URI)
+          .setProperties(new StringMap(flowProperties));
+      _client.createFlowConfig(flowConfig);
+
+      testRequester.setName("testName2");
+      _client.deleteFlowConfig(new 
FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME_4));
+    } catch (RestLiResponseException e) {
+      Assert.assertEquals(e.getStatus(), HttpStatus.ORDINAL_401_Unauthorized);
+    }
+  }
 
+  @Test
+  public void testGroupRequesterAllowed() throws Exception {
+    ServiceRequester testRequester = new ServiceRequester("testName", 
"USER_PRINCIPAL", "testFrom");
+    _requesterService.setRequester(testRequester);
     Map<String, String> flowProperties = Maps.newHashMap();
-    flowProperties.put("param1", "value1");
 
-    FlowConfig flowConfig = new FlowConfig().setId(new 
FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME))
-        .setTemplateUris(TEST_TEMPLATE_URI).setProperties(new 
StringMap(flowProperties));
-    _client.createFlowConfig(flowConfig);
+    FlowConfig flowConfig = new FlowConfig().setId(new 
FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME_5))
+        .setTemplateUris(TEST_TEMPLATE_URI)
+        .setProperties(new StringMap(flowProperties))
+        .setOwningGroup("testGroup");
+
+     _client.createFlowConfig(flowConfig);
 
     testRequester.setName("testName2");
-    _client.deleteFlowConfig(new 
FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME));
+    _client.deleteFlowConfig(new 
FlowId().setFlowGroup(TEST_GROUP_NAME).setFlowName(TEST_FLOW_NAME_5));
+  }
+
+  @Test
+  public void testGroupRequesterRejected() throws Exception {

Review comment:
       testDisallowedRequester doesn't test using owning groups, it was 
originally used to test the requester service. This tests for a group member 
that isn't part of a group that exists. They are pretty similar though.




----------------------------------------------------------------
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]


Reply via email to