Skip to content

Commit

Permalink
Run CI/CD on Java 8, 11, 14 and 17. (opensearch-project#121)
Browse files Browse the repository at this point in the history
* Run CI/CD on Java 8, 11, 14 and 17.

Signed-off-by: dblock <dblock@dblock.org>

* Add JDK 17.

Signed-off-by: dblock <dblock@dblock.org>
  • Loading branch information
dblock authored and getsaurabh02 committed Mar 9, 2022
1 parent e3c745b commit a2777c1
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 8 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/ci-17.yml
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

- name: Build
run: |
./gradlew build --build-cache
- name: Setup Java 17
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: 17

- name: Test
run: |
./gradlew test --build-cache
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ jobs:
build:
strategy:
matrix:
java: [14]
java:
- 8
- 11
- 14

name: Build and Test
runs-on: ubuntu-latest
Expand All @@ -25,7 +28,6 @@ jobs:
with:
java-version: ${{ matrix.java }}

# common-utils
- name: Build and Test
run: |
./gradlew build
Expand Down
6 changes: 3 additions & 3 deletions DEVELOPER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
- [Developer Guide](#developer-guide)
- [Forking and Cloning](#forking-and-cloning)
- [Install Prerequisites](#install-prerequisites)
- [JDK 14](#jdk-14)
- [JDK 11](#jdk-11)
- [Building](#building)
- [Using IntelliJ IDEA](#using-intellij-idea)
- [Submitting Changes](#submitting-changes)
Expand All @@ -16,9 +16,9 @@ Fork this repository on GitHub, and clone locally with `git clone`.

### Install Prerequisites

#### JDK 14
#### JDK 11

OpenSearch components build using Java 14 at a minimum. This means you must have a JDK 14 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 14 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-14`.
OpenSearch components build using Java 11 at a minimum. This means you must have a JDK 11 installed with the environment variable `JAVA_HOME` referencing the path to Java home for your JDK 11 installation, e.g. `JAVA_HOME=/usr/lib/jvm/jdk-11`.

### Building

Expand Down
14 changes: 11 additions & 3 deletions src/test/java/org/opensearch/commons/InjectSecurityTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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>() {
{
put("key", "value");
}
}));
// verify the set properties are not null and equal to what was set
assertNull(threadContext.getTransient("property"));
assertNotNull(threadContext.getTransient("property1"));
Expand All @@ -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"));
Expand Down

0 comments on commit a2777c1

Please sign in to comment.