Skip to content

Commit

Permalink
skip running OPENAI when key is not present and fix yaml test issue
Browse files Browse the repository at this point in the history
Signed-off-by: Mingshi Liu <mingshl@amazon.com>
  • Loading branch information
mingshl committed Jul 17, 2024
1 parent 037d2fc commit 50afa89
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ext {
apply plugin: 'opensearch.opensearchplugin'
apply plugin: 'opensearch.testclusters'
apply plugin: 'opensearch.pluginzip'
apply plugin: 'opensearch.yaml-rest-test'
ext {
projectSubstitutions = [:]
licenseFile = rootProject.file('LICENSE.txt')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ public void setup() throws Exception {
* @throws Exception if any error occurs during the test
*/
public void testMLInferenceProcessorRemoteModelRewriteQueryString() throws Exception {
// Skip test if key is null
if (OPENAI_KEY == null) {
return;
}
String createPipelineRequestBody = "{\n"
+ " \"request_processors\": [\n"
+ " {\n"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

public class PluginClientYamlTestSuiteIT extends OpenSearchClientYamlSuiteTestCase {

public ConversationalClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
public PluginClientYamlTestSuiteIT(@Name("yaml") ClientYamlTestCandidate testCandidate) {
super(testCandidate);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
h: component

- match:
$body: /^plugin\n$/
$body: /opensearch-ml\n$/
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ teardown:
ignore: 404

---
"Test ML Inference Processor":
"Test ML Inference Ingest Processor":
- skip:
version: " - 2.13.99"
reason: "Added in 2.14.0"
- do:
ingest.put_pipeline:
id: "my_pipeline"
Expand All @@ -21,4 +24,4 @@ teardown:
}
]
}
- match: { acknowledged: true }
- match: { acknowledged: true }
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
---
teardown:
- do:
search.delete_pipeline:
search_pipeline.delete:
id: "my_pipeline"
ignore: 404

---
"Test ML Inference Processor":
"Test ML Inference Search Request Processor":
- skip:
version: " - 2.15.99"
reason: "Added in 2.16.0"
- do:
search.put_pipeline:
search_pipeline.put:
id: "my_pipeline"
body: >
{
Expand All @@ -35,4 +38,4 @@ teardown:
}
]
}
- match: { acknowledged: true }
- match: { acknowledged: true }

0 comments on commit 50afa89

Please sign in to comment.