You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2021/10/07 08:16:14 UTC
[GitHub] [druid] kfaraz commented on a change in pull request #11724: Return HTTP 404 instead of 400 for supervisor/task endpoints
kfaraz commented on a change in pull request #11724:
URL: https://github.com/apache/druid/pull/11724#discussion_r723904086
##########
File path: indexing-service/src/test/java/org/apache/druid/indexing/overlord/http/security/OverlordResourceFilterTest.java
##########
@@ -0,0 +1,113 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.druid.indexing.overlord.http.security;
+
+import com.google.common.base.Optional;
+import com.sun.jersey.spi.container.ContainerRequest;
+import org.apache.druid.indexing.overlord.TaskStorageQueryAdapter;
+import org.apache.druid.indexing.overlord.supervisor.SupervisorSpec;
+import org.apache.druid.server.security.AuthorizerMapper;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MultivaluedMap;
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.Response;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import static org.easymock.EasyMock.expect;
+
+public class OverlordResourceFilterTest
Review comment:
I think we should call this class `TaskResourceFilterTest` as `TaskResourceFilter` is the one used in the tests here.
##########
File path: indexing-service/src/main/java/org/apache/druid/indexing/overlord/supervisor/SupervisorResource.java
##########
@@ -386,6 +386,7 @@ public Response specGetAllHistory(@Context final HttpServletRequest req)
@GET
@Path("/{id}/history")
@Produces(MediaType.APPLICATION_JSON)
+ @ResourceFilters(SupervisorResourceFilter.class)
Review comment:
If we are using the `SupervisorResourceFilter` here, I think it would be safe to remove the filtering done by `AuthorizationUtils.filterAuthorizedResources()` later in this method?
##########
File path: integration-tests/src/test/java/org/apache/druid/tests/TestNGGroup.java
##########
@@ -159,4 +159,6 @@
public static final String SHUFFLE_DEEP_STORE = "shuffle-deep-store";
public static final String CUSTOM_COORDINATOR_DUTIES = "custom-coordinator-duties";
+
+ public static final String OVERLORD_RESOURCE = "overlord-resources";
Review comment:
Could we use a more generic group name here that could later include other tests, say for other resources / HTTP endpoints?
##########
File path: integration-tests/src/main/java/org/apache/druid/testing/clients/OverlordResourceTestClient.java
##########
@@ -136,6 +136,9 @@ public TaskStatusPlus getTaskStatus(String taskID)
);
return taskStatusResponse.getStatus();
}
+ catch (ISE e) {
Review comment:
Would it make sense to catch all `RuntimeException`s here (not just ISE) and re-throw them as is?
(same comment in other places too)
--
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.
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org