-
Notifications
You must be signed in to change notification settings - Fork 281
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CI for Windows and MacOS platforms #2190
Merged
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
c3995e7
Add CI for Windows and MacOS platforms
peternied 3fb3d1a
Remove OpenSSL tests with platform quirks
peternied 2a4ce68
Support for environment variables in other platforms
peternied a44c85a
Handle dash character for MacOS
peternied f876447
Use lazy lookahead to find the env key name
peternied 4b31bca
Disabling flaky tests in HeapBasedRateTrackerTest
peternied d753335
Disable testSpecialUsernames broken on Windows
peternied e704db9
Enable retries on integration tests
peternied d9aa6cf
Disable OpenSSL on Windows and Mac
peternied d2a8952
Remove env variable for OpenSSL setup
peternied 49016cd
Fix checkstyle issue
peternied c937165
Move validation steps in separate jobs
peternied df79cef
Protect against random failures due to document count
peternied dbe4669
Ensure integrationTest is not run in primary workflow
peternied 5c7123e
Verify that removing the clean step unblocks the tests
peternied 97d1f77
Run all impacted tests only
peternied 5a7154f
Merge remote-tracking branch 'origin/main' into more-platforms
peternied 70a4cf3
Verify SSL tests are in order
peternied e167fd7
Disable OpenSSL for only Windows
peternied 221ece1
Fix build break
peternied 5f8211c
Clean up for review readiness
peternied 7fe3292
Remove testEnsureOpenSSLAvailabilit that wass unreliable
peternied File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/test/java/org/opensearch/security/support/SecurityUtilsTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
/* | ||
* 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. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
package org.opensearch.security.support; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
import java.util.function.Predicate; | ||
|
||
import org.junit.Test; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.hamcrest.Matchers.equalTo; | ||
import static org.opensearch.security.support.SecurityUtils.ENVBASE64_PATTERN; | ||
import static org.opensearch.security.support.SecurityUtils.ENVBC_PATTERN; | ||
import static org.opensearch.security.support.SecurityUtils.ENV_PATTERN; | ||
|
||
public class SecurityUtilsTest { | ||
|
||
private final Collection<String> interestingEnvKeyNames = List.of( | ||
"=ExitCode", | ||
"=C:", | ||
"ProgramFiles(x86)", | ||
"INPUT_GRADLE-HOME-CACHE-CLEANUP", | ||
"MYENV", | ||
"MYENV:", | ||
"MYENV::" | ||
); | ||
private final Collection<String> namesFromThisRuntimeEnvironment = System.getenv().keySet(); | ||
|
||
@Test | ||
public void checkInterestingNamesForEnvPattern() { | ||
checkKeysWithPredicate(interestingEnvKeyNames, "env", ENV_PATTERN.asMatchPredicate()); | ||
} | ||
|
||
@Test | ||
public void checkRuntimeKeyNamesForEnvPattern() { | ||
checkKeysWithPredicate(namesFromThisRuntimeEnvironment, "env", ENV_PATTERN.asMatchPredicate()); | ||
} | ||
|
||
@Test | ||
public void checkInterestingNamesForEnvbcPattern() { | ||
checkKeysWithPredicate(interestingEnvKeyNames, "envbc", ENVBC_PATTERN.asMatchPredicate()); | ||
} | ||
|
||
@Test | ||
public void checkInterestingNamesForEnvBase64Pattern() { | ||
checkKeysWithPredicate(interestingEnvKeyNames, "envbase64", ENVBASE64_PATTERN.asMatchPredicate()); | ||
} | ||
|
||
private void checkKeysWithPredicate(Collection<String> keys, String predicateName, Predicate<String> predicate) { | ||
keys.forEach(envKeyName -> { | ||
final String prefixWithKeyName = "${" + predicateName + "." + envKeyName; | ||
|
||
final String baseKeyName = prefixWithKeyName + "}"; | ||
assertThat("Testing " + envKeyName + ", " + baseKeyName, | ||
predicate.test(baseKeyName), | ||
equalTo(true)); | ||
|
||
final String baseKeyNameWithDefault = prefixWithKeyName + ":-tTt}"; | ||
assertThat("Testing " + envKeyName + " with defaultValue, " + baseKeyNameWithDefault, | ||
predicate.test(baseKeyNameWithDefault), | ||
equalTo(true)); | ||
}); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test inserts 17 documents and then does a query for matches on them checking the 'hits'. This hits have a default limit of 10... so this test was failing all the time because it depends if you got the right mix of 10/17 items in the output. By making this size much larger this should prevent this issue from happening again.
Always be careful with defaults!