-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Aliaksandr Stsiapanay <[email protected]>
- Loading branch information
1 parent
2e06dbb
commit f6a9403
Showing
6 changed files
with
448 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package com.epam.aidial.core; | ||
|
||
import io.vertx.core.Vertx; | ||
import io.vertx.ext.web.client.WebClient; | ||
import io.vertx.junit5.VertxExtension; | ||
import io.vertx.junit5.VertxTestContext; | ||
import org.junit.jupiter.api.AfterAll; | ||
import org.junit.jupiter.api.AfterEach; | ||
import org.junit.jupiter.api.BeforeAll; | ||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.ExtendWith; | ||
|
||
import java.nio.file.Path; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
|
||
@ExtendWith(VertxExtension.class) | ||
public class TracerApiTest { | ||
private static AiDial dial; | ||
private static int serverPort; | ||
private static Path testDir; | ||
|
||
@BeforeAll | ||
public static void init() throws Exception { | ||
// initialize server | ||
dial = new AiDial(); | ||
testDir = FileUtil.baseTestPath(FileApiTest.class); | ||
dial.setStorage(FileUtil.buildFsBlobStorage(testDir)); | ||
dial.start(); | ||
serverPort = dial.getServer().actualPort(); | ||
} | ||
|
||
@BeforeEach | ||
public void setUp() { | ||
// prepare test directory | ||
FileUtil.createDir(testDir.resolve("test")); | ||
} | ||
|
||
@AfterEach | ||
public void clean() { | ||
// clean test directory | ||
FileUtil.deleteDir(testDir); | ||
} | ||
|
||
@AfterAll | ||
public static void destroy() { | ||
// stop server | ||
dial.stop(); | ||
} | ||
|
||
@Test | ||
public void testTraceNotFound(Vertx vertx, VertxTestContext context) { | ||
WebClient client = WebClient.create(vertx); | ||
client.post(serverPort, "localhost", "/openai/deployments/app/chat/completions") | ||
.putHeader("Api-key", "proxyKey2") | ||
.putHeader("content-type", "application/json") | ||
.putHeader("traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01") | ||
.send(context.succeeding(response -> { | ||
context.verify(() -> { | ||
assertEquals(400, response.statusCode()); | ||
context.completeNow(); | ||
}); | ||
})); | ||
} | ||
|
||
} |
Oops, something went wrong.