Skip to content

Commit

Permalink
Prune support for deprecated /rest paths
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Edgar <[email protected]>
  • Loading branch information
MikeEdgar committed Jul 14, 2023
1 parent 37215c7 commit 5587717
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 135 deletions.
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,6 @@ kcat -b localhost:9092 -F ./hack/kcat.properties -P -t test

6. Interact with the API to view results
`
curl -s -u admin:admin-secret http://localhost:8080/rest/consumer-groups | jq
curl -s -u admin:admin-secret http://localhost:8080/api/v1/consumer-groups | jq
`

Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
public class HttpMetrics {
private static final String FAILED_REQUESTS_COUNTER = "failed_requests";
private static final String HTTP_STATUS_CODE = "status_code";
private static final String DEPRECATED_REQUESTS_COUNTER = "deprecated_requests";
private static final String DEPRECATED_REQUESTS_PATH = "path";

@Inject
PrometheusMeterRegistry meterRegistry;
Expand All @@ -31,7 +29,6 @@ public void init(@Observes StartupEvent event) {
* Status code 404 is a placeholder for defining the status_code label.
*/
meterRegistry.counter(FAILED_REQUESTS_COUNTER, HTTP_STATUS_CODE, "404");
meterRegistry.counter(DEPRECATED_REQUESTS_COUNTER, DEPRECATED_REQUESTS_PATH, "/rest/openapi");

}

Expand All @@ -54,8 +51,4 @@ public Counter getOpenApiCounter() {
public Counter getSucceededRequestsCounter() {
return succeededRequestsCounter;
}

public Counter getDeprecatedRequestCounter(String path) {
return getRegistry().counter(DEPRECATED_REQUESTS_COUNTER, DEPRECATED_REQUESTS_PATH, path);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ ValidatableResponse aclRequest(Method method,
.log().ifValidationFails()
.when()
.queryParams(filters)
.request(Method.valueOf(method.name()), "/rest/acls")
.request(Method.valueOf(method.name()), "/api/v1/acls")
.then()
.log().ifValidationFails()
.statusCode(expectedStatus.getStatusCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
@TestProfile(TestOAuthProfile.class)
class ConsumerGroupsOAuthTestIT {

static final String CONSUMER_GROUP_COLLECTION_PATH = "/rest/consumer-groups";
static final String CONSUMER_GROUP_PATH = "/rest/consumer-groups/{groupId}";
static final String CONSUMER_GROUP_COLLECTION_PATH = "/api/v1/consumer-groups";
static final String CONSUMER_GROUP_PATH = "/api/v1/consumer-groups/{groupId}";

@Inject
Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
@TestProfile(TestPlainProfile.class)
class ConsumerGroupsEndpointTestIT {

static final String CONSUMER_GROUP_COLLECTION_PATH = "/rest/consumer-groups";
static final String CONSUMER_GROUP_PATH = "/rest/consumer-groups/{groupId}";
static final String CONSUMER_GROUP_COLLECTION_PATH = "/api/v1/consumer-groups";
static final String CONSUMER_GROUP_PATH = "/api/v1/consumer-groups/{groupId}";

@Inject
Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ void assertMetricDiff(int expectedDiff, List<String> preMetrics, List<String> po
void listTopics(int times, Status expectedStatus) {
IntStream.range(0, times).forEach(i ->
when()
.get("/rest/topics")
.get("/api/v1/topics")
.then()
.log().ifValidationFails()
.statusCode(expectedStatus.getStatusCode()));
Expand All @@ -175,7 +175,7 @@ void createTopics(List<String> names, int numPartitions, Status expectedStatus)
.body(buildTopicRequest(name, numPartitions, Map.of("min.insync.replicas", "1")).toString())
.contentType(ContentType.JSON)
.log().ifValidationFails()
.post("/rest/topics")
.post("/api/v1/topics")
.then()
.log().ifValidationFails()
.statusCode(expectedStatus.getStatusCode());
Expand All @@ -186,7 +186,7 @@ void describeTopics(List<String> names, Status expectedStatus) {
names.forEach(name -> {
given()
.log().ifValidationFails()
.get("/rest/topics/" + name)
.get("/api/v1/topics/" + name)
.then()
.log().ifValidationFails()
.statusCode(expectedStatus.getStatusCode());
Expand All @@ -199,7 +199,7 @@ void updateTopics(List<String> names) {
.body(buildTopicRequest(name, 6, Map.of("min.insync.replicas", "2")).toString())
.contentType(ContentType.JSON)
.log().ifValidationFails()
.patch("/rest/topics/" + name)
.patch("/api/v1/topics/" + name)
.then()
.log().ifValidationFails()
.statusCode(Status.OK.getStatusCode());
Expand All @@ -210,7 +210,7 @@ void deleteTopics(List<String> names, Status expectedStatus) {
names.forEach(name -> {
given()
.log().ifValidationFails()
.delete("/rest/topics/" + name)
.delete("/api/v1/topics/" + name)
.then()
.log().ifValidationFails()
.statusCode(expectedStatus.getStatusCode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@

public class TopicUtils {

public static final String TOPIC_COLLECTION_PATH = "/rest/topics";
public static final String TOPIC_PATH = "/rest/topics/{topicName}";
public static final String TOPIC_COLLECTION_PATH = "/api/v1/topics";
public static final String TOPIC_PATH = "/api/v1/topics/{topicName}";

static final Logger log = Logger.getLogger(TopicUtils.class);
final Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void testOpenApiContractMatchesGenerated() throws Exception {
var response = given()
.log().ifValidationFails()
.when()
.get("/rest/openapi?format=JSON")
.get("/api/v1/openapi?format=JSON")
.then()
.log().ifValidationFails()
.assertThat()
Expand Down

This file was deleted.

0 comments on commit 5587717

Please sign in to comment.