From 7f6a24d96ebb23dc2a3c9a7842351c6676c018f6 Mon Sep 17 00:00:00 2001 From: Sergey Zinchenko Date: Fri, 27 Dec 2024 18:00:18 +0100 Subject: [PATCH] Publication api test cleanup --- .../aidial/core/server/PublicationApiTest.java | 17 ++++------------- .../aidial/core/server/ResourceBaseTest.java | 2 +- 2 files changed, 5 insertions(+), 14 deletions(-) diff --git a/server/src/test/java/com/epam/aidial/core/server/PublicationApiTest.java b/server/src/test/java/com/epam/aidial/core/server/PublicationApiTest.java index 1efe4981..099fc72a 100644 --- a/server/src/test/java/com/epam/aidial/core/server/PublicationApiTest.java +++ b/server/src/test/java/com/epam/aidial/core/server/PublicationApiTest.java @@ -1,18 +1,13 @@ package com.epam.aidial.core.server; import com.epam.aidial.core.server.util.ProxyUtil; -import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; import io.vertx.core.http.HttpMethod; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; class PublicationApiTest extends ResourceBaseTest { - private static final ObjectMapper objectMapper = new ObjectMapper(); - - private static final String PUBLICATION_REQUEST = """ { "name": "Publication name", @@ -1530,7 +1525,7 @@ void testPublicationRuleWithoutTargets() { } @Test - void testApplicationWithTypeSchemaPublish_Ok_FilesAccessible() throws JsonProcessingException { + void testApplicationWithTypeSchemaPublish_Ok_FilesAccessible() { Response response = upload(HttpMethod.PUT, "/v1/files/%s/test_file.txt".formatted(bucket), null, """ Test1 """); @@ -1605,7 +1600,7 @@ void testApplicationWithTypeSchemaPublish_Ok_FilesAccessible() throws JsonProces "targetUrl" : "files/public/folder/with_apps/.test_app/test_file_2.txt", "reviewUrl" : "files/2CZ9i2bcBACFts8JbBu3MdTHfU5imDZBmDVomBuDCkbhEstv1KXNzCiw693js8BLmo/with_apps/.test_app/test_file_2.txt" } ], - "resourceTypes" : [ "APPLICATION", "FILE" ], + "resourceTypes" : [ "FILE", "APPLICATION" ], "rules" : [ { "function" : "TRUE", "source" : "roles", @@ -1613,13 +1608,9 @@ void testApplicationWithTypeSchemaPublish_Ok_FilesAccessible() throws JsonProces } ] }""".formatted(bucket, bucket, bucket, bucket); - JsonNode jsonNode = objectMapper.readTree(correctResponse); - - String unformattedJson = objectMapper.writeValueAsString(jsonNode); - - verify(response, - 200, unformattedJson); + verifyJsonNotExact(response, + 200, correctResponse); response = operationRequest("/v1/ops/publication/approve", PUBLICATION_URL, "authorization", "admin"); verify(response, 200); diff --git a/server/src/test/java/com/epam/aidial/core/server/ResourceBaseTest.java b/server/src/test/java/com/epam/aidial/core/server/ResourceBaseTest.java index 6e2e6ad1..c0a188b1 100644 --- a/server/src/test/java/com/epam/aidial/core/server/ResourceBaseTest.java +++ b/server/src/test/java/com/epam/aidial/core/server/ResourceBaseTest.java @@ -117,7 +117,7 @@ void init() throws Exception { redis = RedisServer.newRedisServer() .port(16370) .bind("127.0.0.1") - .onShutdownForceStop(true) // redis on windows does not stop gracefully. So tests takes 6h to complete otherwise. + //.onShutdownForceStop(true) // redis on windows does not stop gracefully. So tests takes 6h to complete otherwise. .setting("maxmemory 16M") .setting("maxmemory-policy volatile-lfu") .build();