Skip to content

Commit 14ce5a6

Browse files
committed
add cross cluster IT
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 4374109 commit 14ce5a6

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

integ-test/src/test/java/org/opensearch/sql/security/CalciteCrossClusterSearchIT.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_BANK;
99
import static org.opensearch.sql.legacy.TestsConstants.TEST_INDEX_DOG;
1010
import static org.opensearch.sql.util.MatcherUtils.columnName;
11+
import static org.opensearch.sql.util.MatcherUtils.rows;
1112
import static org.opensearch.sql.util.MatcherUtils.schema;
1213
import static org.opensearch.sql.util.MatcherUtils.verifyColumn;
14+
import static org.opensearch.sql.util.MatcherUtils.verifyDataRows;
1315
import static org.opensearch.sql.util.MatcherUtils.verifySchema;
1416

1517
import java.io.IOException;
@@ -146,4 +148,31 @@ public void testCrossClusterFieldsAndTableEquivalence() throws IOException {
146148
verifySchema(fieldsResult, schema("dog_name", "string"), schema("age", "bigint"));
147149
verifySchema(tableResult, schema("dog_name", "string"), schema("age", "bigint"));
148150
}
151+
152+
@Test
153+
public void testCrossClusterRegexBasic() throws IOException {
154+
JSONObject result =
155+
executeQuery(
156+
String.format(
157+
"search source=%s | regex firstname='.*att.*' | fields firstname",
158+
TEST_INDEX_BANK_REMOTE));
159+
verifyDataRows(result, rows("Hattie"));
160+
}
161+
162+
@Test
163+
public void testCrossClusterRegexWithNegation() throws IOException {
164+
JSONObject result =
165+
executeQuery(
166+
String.format(
167+
"search source=%s | regex firstname!='.*att.*' | fields firstname",
168+
TEST_INDEX_BANK_REMOTE));
169+
verifyDataRows(
170+
result,
171+
rows("Virginia"),
172+
rows("Elinor"),
173+
rows("Dillard"),
174+
rows("Dale"),
175+
rows("Amber JOHnny"),
176+
rows("Nanette"));
177+
}
149178
}

0 commit comments

Comments
 (0)