Skip to content

Commit

Permalink
OpenAiCompatibleV1ApiControllerTest : listModels() (#44) (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: Arnaud MENGUS <[email protected]>
  • Loading branch information
amengus87 and isontheline authored Jun 11, 2024
1 parent 33ed743 commit 8370af3
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
2 changes: 2 additions & 0 deletions backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ dependencies {
testImplementation 'org.awaitility:awaitility:4.2.1'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
testImplementation 'io.github.lambdua:client:0.20.9'
testImplementation 'io.github.lambdua:service:0.20.9'

compileOnly 'org.projectlombok:lombok:1.18.32'
annotationProcessor 'org.projectlombok:lombok:1.18.32'
Expand Down
2 changes: 2 additions & 0 deletions backend/src/main/resources/application-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ org:
poll-interval-in-seconds: 5 # Check for new work every 5 seconds
job-scheduler:
enabled: true
dashboard:
enabled: false
jobs:
default-number-of-retries: 0 # Number of retries for a failing job
dragon:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package ai.dragon.controller.api.raag;

import static org.junit.jupiter.api.Assertions.assertFalse;

import java.util.List;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
import org.springframework.boot.test.web.server.LocalServerPort;
import org.springframework.test.context.ActiveProfiles;

import com.theokanning.openai.model.Model;
import com.theokanning.openai.service.OpenAiService;

@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class OpenAiCompatibleV1ApiControllerTest {
@LocalServerPort
private int serverPort;

@Test
void listModels() throws Exception {
OpenAiService service = new OpenAiService("TODO_PUT_KEY_HERE",
String.format("http://localhost:%d/api/raag/v1/", serverPort));
List<Model> models = service.listModels();
assertFalse(models.isEmpty());
}
}

0 comments on commit 8370af3

Please sign in to comment.