From f8e3bf8cb89b749b3f724caf3262e4343a8d3368 Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Mon, 12 Dec 2022 09:28:37 -0800 Subject: [PATCH] fix for running windows integration tests (#176) * fix for running windows integration tests (cherry picked from commit b91c1f695846b0f9367a4d650b9a8f0a3803bf25) --- .github/workflows/ci.yml | 4 ++-- .../transport/TransportIndexDetectorAction.java | 2 +- .../org/opensearch/securityanalytics/util/RuleIndices.java | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index efcc81de6..6158fb59d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,11 +18,11 @@ jobs: os: [ ubuntu-latest, windows-latest, macos-latest ] include: - os: windows-latest - os_build_args: -x integTest -x jacocoTestReport + os_build_args: -x jacocoTestReport working_directory: X:\ os_java_options: -Xmx4096M - os: macos-latest - os_build_args: -x integTest -x jacocoTestReport + os_build_args: -x jacocoTestReport name: Build and Test security-analytics with JDK ${{ matrix.java }} on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java index 998676dcb..53ed86947 100644 --- a/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java +++ b/src/main/java/org/opensearch/securityanalytics/transport/TransportIndexDetectorAction.java @@ -815,7 +815,7 @@ public void initRuleIndexAndImportRules(IndexDetectorRequest request, ActionList @Override public void onResponse(CreateIndexResponse response) { ruleIndices.onCreateMappingsResponse(response, true); - ruleIndices.importRules(WriteRequest.RefreshPolicy.IMMEDIATE, indexTimeout, + ruleIndices.importRules(RefreshPolicy.IMMEDIATE, indexTimeout, new ActionListener<>() { @Override public void onResponse(BulkResponse response) { diff --git a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java index 2e42b041d..f333de406 100644 --- a/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java +++ b/src/main/java/org/opensearch/securityanalytics/util/RuleIndices.java @@ -253,9 +253,7 @@ private void loadQueries(Path path, WriteRequest.RefreshPolicy refreshPolicy, Ti } private String getRuleCategory(Path folderPath) { - String folder = folderPath.toString(); - int idx = folder.lastIndexOf(PathUtils.getDefaultFileSystem().getSeparator()); - return folder.substring(idx+1); + return folderPath.getFileName().toString(); } private void ingestQueries(Map> logIndexToRules, WriteRequest.RefreshPolicy refreshPolicy, TimeValue indexTimeout, ActionListener listener) throws SigmaError, IOException {