aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/test/java
diff options
context:
space:
mode:
authorLester Solbakken <lester.solbakken@gmail.com>2024-05-03 13:04:05 +0200
committerLester Solbakken <lester.solbakken@gmail.com>2024-05-03 13:04:05 +0200
commit0c0868e895c2ad0c1b82c1f57992e68378d1f3b0 (patch)
tree7c6eaf8399d41710346be56a145ba24585a6fd61 /config-model/src/test/java
parent1f22a18d27c99abbf81ce208d5584f58ea5b34ac (diff)
Use class.getName() instead of string
Diffstat (limited to 'config-model/src/test/java')
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartOnDeployForLocalLLMValidatorTest.java25
1 files changed, 16 insertions, 9 deletions
diff --git a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartOnDeployForLocalLLMValidatorTest.java b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartOnDeployForLocalLLMValidatorTest.java
index 311d4f39fcd..13e91f60712 100644
--- a/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartOnDeployForLocalLLMValidatorTest.java
+++ b/config-model/src/test/java/com/yahoo/vespa/model/application/validation/change/RestartOnDeployForLocalLLMValidatorTest.java
@@ -19,21 +19,20 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
public class RestartOnDeployForLocalLLMValidatorTest {
- public static final String OPENAI_LLM_COMPONENT = "ai.vespa.llm.clients.OpenAI";
- public static final String LOCAL_LLM_COMPONENT = "ai.vespa.llm.clients.LocalLLM";
+ private static final String LOCAL_LLM_COMPONENT = RestartOnDeployForLocalLLMValidator.LOCAL_LLM_COMPONENT;
@Test
void validate_no_restart_on_deploy() {
- VespaModel current = createModelWithComponent(OPENAI_LLM_COMPONENT);
- VespaModel next = createModelWithComponent(LOCAL_LLM_COMPONENT);
+ VespaModel current = createModel();
+ VespaModel next = createModel(withComponent(LOCAL_LLM_COMPONENT));
List<ConfigChangeAction> result = validateModel(current, next);
assertEquals(0, result.size());
}
@Test
void validate_restart_on_deploy() {
- VespaModel current = createModelWithComponent(LOCAL_LLM_COMPONENT);
- VespaModel next = createModelWithComponent(LOCAL_LLM_COMPONENT);
+ VespaModel current = createModel(withComponent(LOCAL_LLM_COMPONENT));
+ VespaModel next = createModel(withComponent(LOCAL_LLM_COMPONENT));
List<ConfigChangeAction> result = validateModel(current, next);
assertEquals(1, result.size());
assertTrue(result.get(0).validationId().isEmpty());
@@ -46,21 +45,29 @@ public class RestartOnDeployForLocalLLMValidatorTest {
deployStateBuilder().previousModel(current).build());
}
- private static VespaModel createModelWithComponent(String componentClass) {
+ private static VespaModel createModel(String component) {
var xml = """
<services version='1.0'>
<container id='cluster1' version='1.0'>
<http>
<server id='server1' port='8080'/>
</http>
- <component id="llm" class="%s" />
+ %s
</container>
</services>
- """.formatted(componentClass);
+ """.formatted(component);
DeployState.Builder builder = deployStateBuilder();
return new VespaModelCreatorWithMockPkg(null, xml).create(builder);
}
+ private static VespaModel createModel() {
+ return createModel("");
+ }
+
+ private static String withComponent(String componentClass) {
+ return "<component id='llm' class='%s' />".formatted(componentClass);
+ }
+
private static DeployState.Builder deployStateBuilder() {
return new DeployState.Builder().properties(new TestProperties());
}