-
Notifications
You must be signed in to change notification settings - Fork 93
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
Run CI/CD on Java 8, 11, 14 and 17. #121
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
name: Build and Test | ||
on: | ||
push: | ||
branches: | ||
- "*" | ||
pull_request: | ||
branches: | ||
- "*" | ||
|
||
jobs: | ||
build: | ||
|
||
name: Build and Test (17) | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Java 11 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
java-version: 11 | ||
|
||
Comment on lines
+20
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to test both Java 11 and 17 here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We build with 11 but test with 17 here, so really this is a 17 test. |
||
- name: Build | ||
run: | | ||
./gradlew build --build-cache | ||
- name: Setup Java 17 | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'temurin' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. May be a very dumb question. I dont understand Java distributions yet, but can we use with what with support on OpenSearch for consistency? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Temurin is a distribution of adoptium - https://adoptium.net/ |
||
java-version: 17 | ||
|
||
- name: Test | ||
run: | | ||
./gradlew test --build-cache | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
import static org.opensearch.commons.ConfigConstants.OPENSEARCH_SECURITY_USE_INJECTED_USER_FOR_PLUGINS; | ||
|
||
import java.util.Arrays; | ||
import java.util.Map; | ||
import java.util.HashMap; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.opensearch.common.settings.Settings; | ||
|
@@ -114,7 +114,11 @@ public void testInjectProperty() { | |
assertTrue(helper.injectProperty("property1", true)); | ||
assertTrue(helper.injectProperty("property2", "some value")); | ||
assertTrue(helper.injectProperty("property3", "")); | ||
assertTrue(helper.injectProperty("property4", Map.of("key", "value"))); | ||
assertTrue(helper.injectProperty("property4", new HashMap<String, String>() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
{ | ||
put("key", "value"); | ||
} | ||
})); | ||
// verify the set properties are not null and equal to what was set | ||
assertNull(threadContext.getTransient("property")); | ||
assertNotNull(threadContext.getTransient("property1")); | ||
|
@@ -124,7 +128,11 @@ public void testInjectProperty() { | |
assertNotNull(threadContext.getTransient("property3")); | ||
assertEquals("", threadContext.getTransient("property3")); | ||
assertNotNull(threadContext.getTransient("property4")); | ||
assertEquals(Map.of("key", "value"), threadContext.getTransient("property4")); | ||
assertEquals(new HashMap<String, String>() { | ||
{ | ||
put("key", "value"); | ||
} | ||
}, threadContext.getTransient("property4")); | ||
} | ||
assertEquals("1", threadContext.getHeader("default")); | ||
assertEquals("opendistro", threadContext.getHeader("name")); | ||
|
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.
Also instead of duplicating the test information for each one of them, can we use github action matrix?
Something like
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.
Ignore me :)
Just saw the description and it makes sense.