Skip to content

Commit 51776fe

Browse files
committed
Integration tests for the S3 sink.
Signed-off-by: David Venable <dlv@amazon.com>
1 parent d4b8363 commit 51776fe

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
#
2+
# Copyright OpenSearch Contributors
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# The OpenSearch Contributors require contributions made to
6+
# this file be licensed under the Apache-2.0 license or a
7+
# compatible open source license.
8+
#
9+
10+
name: Integration Tests - S3 Sink
11+
12+
on:
13+
push:
14+
paths:
15+
- 'data-prepper-plugins/s3-sink/**'
16+
- '*gradle*'
17+
pull_request_target:
18+
paths:
19+
- 'data-prepper-plugins/s3-sink/**'
20+
- '*gradle*'
21+
22+
workflow_dispatch:
23+
24+
jobs:
25+
build:
26+
strategy:
27+
matrix:
28+
java: [ 11, 17, 21, docker ]
29+
fail-fast: false
30+
31+
runs-on: ubuntu-latest
32+
33+
steps:
34+
- name: Configure AWS Credentials
35+
id: creds
36+
uses: aws-actions/configure-aws-credentials@v5
37+
with:
38+
role-to-assume: ${{ secrets.TEST_IAM_ROLE_ARN }}
39+
aws-region: ${{ secrets.TEST_REGION }}
40+
output-credentials: true
41+
42+
- name: Configure AWS Credentials file
43+
run: |
44+
aws configure set default.region ${{ secrets.TEST_REGION }}
45+
aws configure set default.aws_access_key_id ${{ steps.creds.outputs.aws-access-key-id }}
46+
aws configure set default.aws_secret_access_key ${{ steps.creds.outputs.aws-secret-access-key }}
47+
aws configure set default.aws_session_token ${{ steps.creds.outputs.aws-session-token }}
48+
49+
- name: Set up JDK ${{ matrix.java }}
50+
uses: actions/setup-java@v4
51+
with:
52+
java-version: ${{ matrix.java }}
53+
distribution: temurin
54+
55+
- name: Checkout Data Prepper
56+
uses: actions/checkout@v6
57+
with:
58+
ref: ${{ github.event.pull_request.head.sha }}
59+
60+
- name: Get resources from CDK stacks
61+
id: cdk-resources
62+
run: |
63+
echo "bucket=$(aws cloudformation describe-stacks --stack-name S3SinkStack --query 'Stacks[0].Outputs[?ExportName==`DataPrepperAwsTesting-S3SinkBucketName`].OutputValue' --output text)" >> "$GITHUB_OUTPUT"
64+
echo "kms_key=$(aws cloudformation describe-stacks --stack-name CommonKmsStack --query 'Stacks[0].Outputs[?ExportName==`DataPrepperAwsTesting-KmsKeyId`].OutputValue' --output text)" >> "$GITHUB_OUTPUT"
65+
66+
- name: Run S3 Sink integration tests
67+
run: |
68+
./gradlew data-prepper-plugins:s3-sink:integrationTest \
69+
-Dtests.s3sink.region=${{ secrets.TEST_REGION }} \
70+
-Dtests.s3sink.bucket=${{ steps.cdk-resources.outputs.bucket }} \
71+
-Dtests.s3sink.kms_key=${{ steps.cdk-resources.outputs.kms_key }}
72+
73+
- name: Upload Unit Test Results
74+
if: always()
75+
uses: actions/upload-artifact@v4
76+
with:
77+
name: data-prepper-integration-tests-s3-sink-java-${{ matrix.java }}
78+
path: '**/test-results/**/*.xml'
79+
80+
publish-test-results:
81+
name: "Publish Unit Tests Results"
82+
needs: build
83+
runs-on: ubuntu-latest
84+
if: always()
85+
86+
steps:
87+
- name: Download Artifacts
88+
uses: actions/download-artifact@v4
89+
with:
90+
path: test-results
91+
92+
- name: Publish Unit Test Results
93+
uses: EnricoMi/publish-unit-test-result-action@v1
94+
with:
95+
files: "test-results/**/*.xml"

0 commit comments

Comments
 (0)