|
| 1 | +name: Test ADOT X-Ray UDP Exporter |
| 2 | +on: |
| 3 | + workflow_call: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + |
| 8 | +permissions: |
| 9 | + id-token: write |
| 10 | + |
| 11 | +jobs: |
| 12 | + udp-exporter-e2e-test: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - name: Checkout Repo @ SHA - ${{ github.sha }} |
| 16 | + uses: actions/checkout@v4 |
| 17 | + |
| 18 | + # Install ruby and bundle dependencies and cache! |
| 19 | + - name: Install Ruby ${{ env.RUBY_VERSION }} with dependencies |
| 20 | + |
| 21 | + with: |
| 22 | + ruby-version: "${{ env.RUBY_VERSION }}" |
| 23 | + working-directory: "exporter/xray-udp" |
| 24 | + bundler: "latest" |
| 25 | + bundler-cache: true |
| 26 | + cache-version: "v1-ruby-xray-udp" |
| 27 | + |
| 28 | + - name: Configure AWS credentials for Testing Tracing |
| 29 | + uses: aws-actions/configure-aws-credentials@v4 |
| 30 | + with: |
| 31 | + role-to-assume: ${{ secrets.XRAY_UDP_EXPORTER_TEST_ROLE }} |
| 32 | + aws-region: 'us-east-1' |
| 33 | + |
| 34 | + - name: Download and run X-Ray Daemon |
| 35 | + run: | |
| 36 | + mkdir xray-daemon |
| 37 | + cd xray-daemon |
| 38 | + wget https://s3.us-east-2.amazonaws.com/aws-xray-assets.us-east-2/xray-daemon/aws-xray-daemon-linux-3.x.zip |
| 39 | + unzip aws-xray-daemon-linux-3.x.zip |
| 40 | + ./xray -o -n us-east-2 -f ./daemon-logs.log --log-level debug & |
| 41 | +
|
| 42 | + - name: Setup Sample App |
| 43 | + run: | |
| 44 | + cd .github/test-sample-apps/integ-test-http-server/ruby-on-rails |
| 45 | + bundle install |
| 46 | +
|
| 47 | + - name: Run Sample App in Background |
| 48 | + run: | |
| 49 | + cd .github/test-sample-apps/integ-test-http-server/ruby-on-rails |
| 50 | + LISTEN_ADDRESS=127.0.0.1:8080 rails server & |
| 51 | + # Wait for test server to initialize |
| 52 | + sleep 5 |
| 53 | +
|
| 54 | + - name: Call Sample App Endpoint |
| 55 | + id: call-endpoint |
| 56 | + run: | |
| 57 | + echo "traceId=$(curl localhost:8080/test)" >> $GITHUB_OUTPUT |
| 58 | +
|
| 59 | + - name: Check if traces are successfully sent to AWS X-Ray |
| 60 | + run: | |
| 61 | + sleep 20 |
| 62 | + # # Print Daemon Logs for debugging |
| 63 | + # cat xray-daemon/daemon-logs.log |
| 64 | +
|
| 65 | + traceId=${{ steps.call-endpoint.outputs.traceId }} |
| 66 | + numTracesFound=$(aws xray batch-get-traces --trace-ids $traceId --region us-east-2 | jq '.Traces' | jq length) |
| 67 | + if [[ numTracesFound -ne "1" ]]; then |
| 68 | + echo "TraceId $traceId not found in X-Ray." |
| 69 | + exit 1 |
| 70 | + else |
| 71 | + echo "TraceId $traceId found in X-Ray." |
| 72 | + fi |
0 commit comments