diff --git a/build.gradle b/build.gradle index 512508022..34084d94a 100644 --- a/build.gradle +++ b/build.gradle @@ -382,6 +382,7 @@ integTest { systemProperty 'tests.security.manager', 'false' systemProperty 'java.io.tmpdir', opensearch_tmp_dir.absolutePath systemProperty "java.library.path", "$rootDir/jni/release" + systemProperty "tests.path.repo", "${buildDir}/testSnapshotFolder" // allows integration test classes to access test resource from project root path systemProperty('project.root', project.rootDir.absolutePath) @@ -448,6 +449,9 @@ testClusters.integTest { } } systemProperty("java.library.path", "$rootDir/jni/release") + final testSnapshotFolder = file("${buildDir}/testSnapshotFolder") + testSnapshotFolder.mkdirs() + setting 'path.repo', "${buildDir}/testSnapshotFolder" systemProperty propertyKeys.breaker.useRealMemory, getBreakerSetting() } diff --git a/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/ModelIT.java b/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/ModelIT.java index 29496cff9..39c0b8918 100644 --- a/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/ModelIT.java +++ b/qa/restart-upgrade/src/test/java/org/opensearch/knn/bwc/ModelIT.java @@ -53,7 +53,7 @@ public class ModelIT extends AbstractRestartUpgradeTestCase { private static final int DELAY_MILLI_SEC = 1000; private static final int MIN_NUM_OF_MODELS = 2; private static final int K = 5; - private static final int NUM_DOCS = 10; + private static final int NUM_DOCS = 1100; private static final int NUM_DOCS_TEST_MODEL_INDEX = 100; private static final int NUM_DOCS_TEST_MODEL_INDEX_DEFAULT = 100; private static final int NUM_DOCS_TEST_MODEL_INDEX_FOR_NON_KNN_INDEX = 100; diff --git a/src/testFixtures/java/org/opensearch/knn/KNNRestTestCase.java b/src/testFixtures/java/org/opensearch/knn/KNNRestTestCase.java index 7dd1ec237..c537d0155 100644 --- a/src/testFixtures/java/org/opensearch/knn/KNNRestTestCase.java +++ b/src/testFixtures/java/org/opensearch/knn/KNNRestTestCase.java @@ -1980,4 +1980,19 @@ protected boolean isApproximateThresholdSupported(final Optional bwcVers protected static String randomLowerCaseString() { return randomAlphaOfLengthBetween(MIN_CODE_UNITS, MAX_CODE_UNITS).toLowerCase(Locale.ROOT); } + + @SneakyThrows + protected void setupSnapshotRestore(String index, String snapshot, String repository) { + final String pathRepo = System.getProperty("tests.path.repo"); + + // create index + createIndex(index, getDefaultIndexSettings()); + + // create repo + Settings repoSettings = Settings.builder().put("compress", randomBoolean()).put("location", pathRepo).build(); + registerRepository(repository, "fs", true, repoSettings); + + // create snapshot + createSnapshot(repository, snapshot, true); + } }