Skip to content

Commit

Permalink
Minor optimizations and fixes.
Browse files Browse the repository at this point in the history
* Fix for not excluded tests.
* Reordered matrix strategy variables.
* Restored unified list of Gradle task.. again!

Signed-off-by: Pawel Gudel <[email protected]>
  • Loading branch information
pawel-gudel-eliatra committed Jun 28, 2023
1 parent 1dc9f57 commit ebae0eb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 76 deletions.
52 changes: 4 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ jobs:
runs-on: ubuntu-latest
outputs:
separateTestsNames: ${{ steps.set-matrix.outputs.separateTestsNames }}
testsNamesExclude: ${{ steps.set-matrix.outputs.testsNamesExclude }}
steps:
- name: Set up JDK for build and test
uses: actions/setup-java@v2
Expand All @@ -26,58 +25,15 @@ jobs:
run: |
echo "separateTestsNames=$(./gradlew listTasksAsJSON -q --console=plain | tail -n 1)" >> $GITHUB_OUTPUT
tests:
name: tests
strategy:
fail-fast: false
matrix:
platform: ["windows-latest", "ubuntu-latest"]
jdk: [11, 17]
runs-on: ${{ matrix.platform }}

steps:
- name: Set up JDK for build and test
uses: actions/setup-java@v2
with:
distribution: temurin
java-version: ${{ matrix.jdk }}

- name: Checkout security
uses: actions/checkout@v2

- name: Build and Test
uses: gradle/gradle-build-action@v2
with:
arguments: |
citest -Dbuild.snapshot=false
-x test
- name: Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./build/reports/jacoco/test/jacocoTestReport.xml

- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports
path: |
./build/reports/
- name: check archive for debugging
if: always()
run: echo "Check the artifact ${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports for detailed test results"

test:
name: test
needs: generate-test-list
strategy:
fail-fast: false
matrix:
platform: ["windows-latest", "ubuntu-latest"]
jdk: [11, 17]
gradle_task: ${{ fromJson(needs.generate-test-list.outputs.separateTestsNames) }}
platform: [windows-latest, ubuntu-latest]
jdk: [11, 17]
runs-on: ${{ matrix.platform }}

steps:
Expand Down Expand Up @@ -120,7 +76,7 @@ jobs:
fail-fast: false
matrix:
jdk: [17]
platform: ["ubuntu-latest", "windows-latest"]
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
Expand Down Expand Up @@ -149,7 +105,7 @@ jobs:
fail-fast: false
matrix:
jdk: [11, 17]
platform: ["ubuntu-latest", "windows-latest"]
platform: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.platform }}

steps:
Expand Down
56 changes: 28 additions & 28 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -107,64 +107,64 @@ tasks.whenTaskAdded {task ->
}

def splitTestConfig = [
dlicDlsflsTest: [
description: "Runs Document- and Field-Level Security tests.",
ciSecurityIntegrationTest: [
description: "Runs integration tests from all classes.",
filters: [
includeTestsMatching: [
"org.opensearch.security.dlic.dlsfls.*"
"org.opensearch.security.*Integ*"
],
excludeTestsMatching: [
"org.opensearch.security.sanity.tests.*"
]
]
],
dlicRestApiTest: [
description: "Runs REST Management API tests.",
crossClusterTest: [
description: "Runs cross-cluster tests.",
filters: [
includeTestsMatching: [
"org.opensearch.security.dlic.rest.*"
"org.opensearch.security.ccstest.*"
]
]
],
crossClusterTest: [
description: "Runs cross-cluster tests.",
dlicDlsflsTest: [
description: "Runs Document- and Field-Level Security tests.",
filters: [
includeTestsMatching: [
"org.opensearch.security.ccstest.*"
"org.opensearch.security.dlic.dlsfls.*"
]
]
],
sslTest: [
description: "Runs most of the SSL tests.",
dlicRestApiTest: [
description: "Runs REST Management API tests.",
filters: [
includeTestsMatching: [
"org.opensearch.security.ssl.*"
],
excludeTestsMatching: [
"org.opensearch.security.ssl.OpenSSL*"
"org.opensearch.security.dlic.rest.*"
]
]
],
opensslCiTest: [
description: "Runs portion of SSL tests related to OpenSSL. Explained in https://github.com/opensearch-project/security/pull/2301",
include: '**/OpenSSL*.class'
],
securityIntegrationTest: [
description: "Runs integration tests from all classes.",
indicesTest: [
description: "Runs indices tests from all classes.",
filters: [
includeTestsMatching: [
"org.opensearch.security.*Integ*"
"org.opensearch.security.*indices*"
],
excludeTestsMatching: [
"org.opensearch.security.sanity.tests.*"
]
]
],
indicesTest: [
description: "Runs indices tests from all classes.",
opensslCITest: [
description: "Runs portion of SSL tests related to OpenSSL. Explained in https://github.com/opensearch-project/security/pull/2301",
include: '**/OpenSSL*.class'
],
sslTest: [
description: "Runs most of the SSL tests.",
filters: [
includeTestsMatching: [
"org.opensearch.security.*indices*"
"org.opensearch.security.ssl.*"
],
excludeTestsMatching: [
"org.opensearch.security.sanity.tests.*"
"org.opensearch.security.ssl.OpenSSL*"
]
]
]
Expand All @@ -177,7 +177,7 @@ task listTasksAsJSON {
// want this action to be started. Without it the output
// is not shown at all or can be mixed with other outputs.
doLast {
System.out.println(new JsonBuilder(taskNames))
System.out.println(new JsonBuilder(["citest"] + taskNames))
}
}

Expand Down Expand Up @@ -269,7 +269,7 @@ task citest(type: Test) {
excludeTestsMatching "org.opensearch.security.sanity.tests.*"
excludeTestsMatching "org.opensearch.security.ssl.OpenSSL*"
splitTestConfig.each { entry ->
entry.value.each{ test ->
entry.value.filters.each{ test ->
if (test.key == "includeTestsMatching") {
test.value.each{
excludeTestsMatching "${it}"
Expand Down

0 comments on commit ebae0eb

Please sign in to comment.