-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Test authentication via AssumeRole - Test `streamChanges: true` both with and without `skipInitialSnapshotTransfer`
- Loading branch information
Showing
25 changed files
with
562 additions
and
102 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Tests with AWS | ||
on: | ||
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.scala' | ||
- '**.sbt' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Cache Docker images | ||
uses: ScribeMD/[email protected] | ||
with: | ||
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose-tests.yml') }} | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
java-version: 8 | ||
cache: sbt | ||
- name: Build migrator | ||
run: ./build.sh | ||
- name: Set up services | ||
run: | | ||
docker compose -f docker-compose-tests.yml up -d scylla spark-master spark-worker | ||
.github/wait-for-port.sh 8000 # ScyllaDB Alternator | ||
.github/wait-for-cql.sh scylla | ||
.github/wait-for-port.sh 8080 # Spark master | ||
.github/wait-for-port.sh 8081 # Spark worker | ||
- name: Run tests accessing AWS | ||
run: sbt "testOnly -- --include-categories=com.scylladb.migrator.AWS" | ||
env: | ||
TEST_ON_AWS: true | ||
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }} | ||
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }} | ||
AWS_ROLE_ARN: ${{ secrets.AWS_ROLE_ARN }} | ||
- name: Stop services | ||
run: docker compose -f docker-compose-tests.yml down |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,13 @@ on: | |
push: | ||
branches: | ||
- master | ||
paths: | ||
- '**.scala' | ||
- '**.sbt' | ||
pull_request: | ||
paths: | ||
- '**.scala' | ||
- '**.sbt' | ||
|
||
env: | ||
TUTORIAL_DIR: docs/source/tutorials/dynamodb-to-scylladb-alternator | ||
|
@@ -17,7 +23,7 @@ jobs: | |
- name: Cache Docker images | ||
uses: ScribeMD/[email protected] | ||
with: | ||
key: docker-${{ runner.os }}-${{ hashFiles('docker-compose-tests.yml') }} | ||
key: docker-${{ runner.os }}-${{ hashFiles('docs/source/tutorials/dynamodb-to-scylladb-alternator/docker-compose.yaml') }} | ||
- uses: actions/setup-java@v4 | ||
with: | ||
distribution: temurin | ||
|
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
25 changes: 25 additions & 0 deletions
25
tests/src/test/configurations/dynamodb-to-alternator-assume-role.yaml
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,25 @@ | ||
source: | ||
type: dynamodb | ||
table: AssumeRoleTest | ||
region: us-west-1 | ||
credentials: | ||
accessKey: "{AWS_ACCESS_KEY}" | ||
secretKey: "{AWS_SECRET_KEY}" | ||
assumeRole: | ||
arn: "{AWS_ROLE_ARN}" | ||
|
||
target: | ||
type: dynamodb | ||
table: AssumeRoleTest | ||
region: dummy | ||
endpoint: | ||
host: http://scylla | ||
port: 8000 | ||
credentials: | ||
accessKey: dummy | ||
secretKey: dummy | ||
streamChanges: false | ||
|
||
savepoints: | ||
path: /app/savepoints | ||
intervalSeconds: 300 |
26 changes: 26 additions & 0 deletions
26
tests/src/test/configurations/dynamodb-to-alternator-streaming-skip-snapshot.yaml
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,26 @@ | ||
source: | ||
type: dynamodb | ||
table: StreamedItemsSkipSnapshotTest | ||
region: us-west-1 | ||
credentials: | ||
accessKey: "{AWS_ACCESS_KEY}" | ||
secretKey: "{AWS_SECRET_KEY}" | ||
assumeRole: | ||
arn: "{AWS_ROLE_ARN}" | ||
|
||
target: | ||
type: dynamodb | ||
table: StreamedItemsSkipSnapshotTest | ||
region: dummy | ||
endpoint: | ||
host: http://scylla | ||
port: 8000 | ||
credentials: | ||
accessKey: dummy | ||
secretKey: dummy | ||
streamChanges: true | ||
skipInitialSnapshotTransfer: true | ||
|
||
savepoints: | ||
path: /app/savepoints | ||
intervalSeconds: 300 |
25 changes: 25 additions & 0 deletions
25
tests/src/test/configurations/dynamodb-to-alternator-streaming.yaml
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,25 @@ | ||
source: | ||
type: dynamodb | ||
table: StreamedItemsTest | ||
region: us-west-1 | ||
credentials: | ||
accessKey: "{AWS_ACCESS_KEY}" | ||
secretKey: "{AWS_SECRET_KEY}" | ||
assumeRole: | ||
arn: "{AWS_ROLE_ARN}" | ||
|
||
target: | ||
type: dynamodb | ||
table: StreamedItemsTest | ||
region: dummy | ||
endpoint: | ||
host: http://scylla | ||
port: 8000 | ||
credentials: | ||
accessKey: dummy | ||
secretKey: dummy | ||
streamChanges: true | ||
|
||
savepoints: | ||
path: /app/savepoints | ||
intervalSeconds: 300 |
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,4 @@ | ||
package com.scylladb.migrator | ||
|
||
/** Used for tagging test suites that require AWS access */ | ||
class AWS extends munit.Tag("AWS") |
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
30 changes: 30 additions & 0 deletions
30
tests/src/test/scala/com/scylladb/migrator/alternator/AssumeRoleTest.scala
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,30 @@ | ||
package com.scylladb.migrator.alternator | ||
|
||
import com.scylladb.migrator.SparkUtils.successfullyPerformMigration | ||
import software.amazon.awssdk.services.dynamodb.model.{AttributeValue, PutItemRequest} | ||
|
||
import scala.jdk.CollectionConverters._ | ||
|
||
/** Basic migration that uses the real AWS DynamoDB as a source and AssumeRole for authentication */ | ||
class AssumeRoleTest extends MigratorSuiteWithAWS { | ||
|
||
withTable("AssumeRoleTest").test("Read from source and write to target") { tableName => | ||
val configFileName = "dynamodb-to-alternator-assume-role.yaml" | ||
|
||
setupConfigurationFile(configFileName) | ||
|
||
// Insert some items | ||
val keys = Map("id" -> AttributeValue.fromS("12345")) | ||
val attrs = Map("foo" -> AttributeValue.fromS("bar")) | ||
val itemData = keys ++ attrs | ||
sourceDDb().putItem(PutItemRequest.builder().tableName(tableName).item(itemData.asJava).build()) | ||
|
||
// Perform the migration | ||
successfullyPerformMigration(configFileName) | ||
|
||
checkSchemaWasMigrated(tableName) | ||
|
||
checkItemWasMigrated(tableName, keys, itemData) | ||
} | ||
|
||
} |
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
Oops, something went wrong.