Skip to content

Commit

Permalink
Publication api test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-zinchenko committed Dec 27, 2024
1 parent 245a951 commit 7f6a24d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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
""");
Expand Down Expand Up @@ -1605,21 +1600,17 @@ 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",
"targets" : null
} ]
}""".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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 7f6a24d

Please sign in to comment.