Skip to content

Commit

Permalink
Fix linngering CI issues + License headers
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Nied <petern@amazon.com>
  • Loading branch information
peternied committed Sep 21, 2023
1 parent 12f170b commit 7a1296d
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger;

import com.carrotsearch.randomizedtesting.annotations.ThreadLeakScope;
import com.google.common.base.Stopwatch;
Expand Down Expand Up @@ -1769,7 +1768,6 @@ public void shouldDeleteSnapshot_negative() throws IOException {
@Test
public void shouldRestoreSnapshot_positive() throws IOException {
final String snapshotName = "restore-snapshot-positive";
final AtomicInteger countRequestsIssued = new AtomicInteger();
try (RestHighLevelClient restHighLevelClient = cluster.getRestHighLevelClient(LIMITED_WRITE_USER)) {
SnapshotSteps steps = new SnapshotSteps(restHighLevelClient);
// 1. create some documents
Expand Down Expand Up @@ -1807,10 +1805,7 @@ public void shouldRestoreSnapshot_positive() throws IOException {
Awaitility.await()
.ignoreExceptions()
.alias("Index contains proper number of documents restored from snapshot.")
.until(() -> {
countRequestsIssued.incrementAndGet();
return restHighLevelClient.count(countRequest, DEFAULT).getCount() == 2;
});
.until(() -> restHighLevelClient.count(countRequest, DEFAULT).getCount() == 2);

// 8. verify that document are present in restored index
assertThat(
Expand All @@ -1834,7 +1829,6 @@ public void shouldRestoreSnapshot_positive() throws IOException {
"/_snapshot/test-snapshot-repository/restore-snapshot-positive/_restore"
)
);
auditLogsRule.assertExactly(countRequestsIssued.get(), userAuthenticated(LIMITED_WRITE_USER).withRestRequest(POST, "/restored_write_song_index/_count"));
auditLogsRule.assertExactly(2, userAuthenticated(LIMITED_WRITE_USER).withRestRequest(POST, "/_bulk"));
auditLogsRule.assertAtLeast(
1,
Expand All @@ -1846,9 +1840,12 @@ public void shouldRestoreSnapshot_positive() throws IOException {
auditLogsRule.assertExactly(2, grantedPrivilege(LIMITED_WRITE_USER, "CreateIndexRequest"));
auditLogsRule.assertExactly(4, grantedPrivilege(LIMITED_WRITE_USER, "PutMappingRequest"));
auditLogsRule.assertExactly(2, grantedPrivilege(LIMITED_WRITE_USER, "RestoreSnapshotRequest"));
auditLogsRule.assertExactlyOne(grantedPrivilege(LIMITED_WRITE_USER, "SearchRequest"));
auditLogsRule.assertAtLeast(2, grantedPrivilege(LIMITED_WRITE_USER, "GetSnapshotsRequest"));
auditLogsRule.assertExactly(6, auditPredicate(INDEX_EVENT).withEffectiveUser(LIMITED_WRITE_USER));

// Audit events generated in step 7 above
auditLogsRule.assertAtLeast(1, userAuthenticated(LIMITED_WRITE_USER).withRestRequest(POST, "/restored_write_song_index/_count"));
auditLogsRule.assertAtLeast(1, grantedPrivilege(LIMITED_WRITE_USER, "SearchRequest"));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/
package org.opensearch.test.framework.testplugins;

import org.opensearch.ExceptionsHelper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/
package org.opensearch.security.dlic.rest.validation;

import org.opensearch.core.rest.RestStatus;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/
package org.opensearch.security.dlic.rest.api;

import com.fasterxml.jackson.databind.node.ObjectNode;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
*/
package org.opensearch.security.dlic.rest.api;

import org.junit.Before;
Expand Down

0 comments on commit 7a1296d

Please sign in to comment.