Skip to content

Commit

Permalink
Update the CI workflow to run the integ tests on all platforms (#649)
Browse files Browse the repository at this point in the history
* Update the CI workflow to run the integ tests on all platforms

Signed-off-by: Ankit Kala <[email protected]>

* Skip FS snapshot repository registration on windows

Signed-off-by: Ankit Kala <[email protected]>

Signed-off-by: Ankit Kala <[email protected]>
  • Loading branch information
ankitkala authored Dec 6, 2022
1 parent c052fdc commit d8ec7ad
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 23 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: CCR Test Workflow
# This workflow is triggered on pull requests to main branch
on:
pull_request:
branches:
- '*'
push:
branches:
- '*'

# We build for all combinations but run tests only on all platforms on latest java)
jobs:
build:
continue-on-error: true
strategy:
matrix:
java:
- 14
os:
- ubuntu-latest
- windows-latest
- macos-latest
# Job name
name: Run integration tests on ${{ matrix.os }} with Java ${{ matrix.java }}
runs-on: ${{ matrix.os }}
steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK ${{ matrix.java }}
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
# This step uses the checkout Github action: https://github.com/actions/checkout
- name: Checkout Branch
uses: actions/checkout@v2
- name: Build and run Replication tests
run: |
./gradlew clean release -D"build.snapshot=true"
- name: Upload failed logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: logs
path: |
build/testclusters/integTest-*/logs/*
build/testclusters/leaderCluster-*/logs/*
build/testclusters/followCluster-*/logs/*
- name: Create Artifact Path
run: |
mkdir -p cross-cluster-replication-artifacts
cp ./build/distributions/*.zip cross-cluster-replication-artifacts
- name: Uploads coverage
with:
fetch-depth: 2
uses: codecov/[email protected]
33 changes: 11 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test and Build Workflow
name: Build Replication plugin
# This workflow is triggered on pull requests to main branch
on:
pull_request:
Expand All @@ -8,17 +8,22 @@ on:
branches:
- '*'

# We build for other platforms except linux which is already covered in build-and-test.
# Also, We're not running tests here as those are already covered with linux build.
jobs:
build:
continue-on-error: true
strategy:
matrix:
java:
- 14
- 8
- 11
- 14
os:
- ubuntu-latest
# Job name
name: Build Replication plugin
runs-on: ubuntu-latest
name: Java ${{ matrix.java }} On ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
# This step uses the setup-java Github action: https://github.com/actions/setup-java
- name: Set Up JDK ${{ matrix.java }}
Expand All @@ -30,21 +35,5 @@ jobs:
uses: actions/checkout@v2
- name: Build and run Replication tests
run: |
./gradlew clean release -Dbuild.snapshot=true -Dopensearch.version=1.3.7-SNAPSHOT
- name: Upload failed logs
uses: actions/upload-artifact@v2
if: failure()
with:
name: logs
path: |
build/testclusters/integTest-*/logs/*
build/testclusters/leaderCluster-*/logs/*
build/testclusters/followCluster-*/logs/*
- name: Create Artifact Path
run: |
mkdir -p cross-cluster-replication-artifacts
cp ./build/distributions/*.zip cross-cluster-replication-artifacts
- name: Uploads coverage
with:
fetch-depth: 2
uses: codecov/[email protected]
./gradlew clean release -D"build.snapshot=true" -x test -x IntegTest
Original file line number Diff line number Diff line change
Expand Up @@ -263,10 +263,17 @@ abstract class MultiClusterRestTestCase : OpenSearchTestCase() {
}
}

fun isWindowsPlatform(): Boolean {
return System.getProperty("os.name").contains("windows", true)
}

/**
* Register snapshot repo - "fs" type on all the clusters
*/
private fun registerSnapshotRepository(testCluster: TestCluster) {
// TODO: Skipping FS based snapshot registration for windows. We'll revisit & fix this later.
if (isWindowsPlatform()) return

val getResponse: Map<String, Any> = OpenSearchRestTestCase.entityAsMap(testCluster.lowLevelClient.performRequest(
Request("GET", "/_cluster/settings?include_defaults=true&flat_settings=true")))
val configuredRepositories = (getResponse["defaults"] as Map<*, *>)["path.repo"] as List<*>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,7 @@ class StartReplicationIT: MultiClusterRestTestCase() {
}

fun `test that snapshot on leader does not affect replication during bootstrap`() {
if(isWindowsPlatform()) return
val settings = Settings.builder()
.put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 20)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)
Expand All @@ -952,7 +953,6 @@ class StartReplicationIT: MultiClusterRestTestCase() {
createConnectionBetweenClusters(FOLLOWER, LEADER)

val repoPath = PathUtils.get(buildDir, repoPath)

val putRepositoryRequest = PutRepositoryRequest("my-repo")
.type(FsRepository.TYPE)
.settings("{\"location\": \"$repoPath\"}", XContentType.JSON)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ class StopReplicationIT: MultiClusterRestTestCase() {
}

fun `test stop replication with stale replication settings at leader cluster`() {
if(isWindowsPlatform()) return
val followerClient = getClientForCluster(FOLLOWER)
val leaderClient = getClientForCluster(LEADER)
createConnectionBetweenClusters(FOLLOWER, LEADER, "source")
Expand Down

0 comments on commit d8ec7ad

Please sign in to comment.