Skip to content
42 changes: 16 additions & 26 deletions .github/actions/contract-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ inputs:
required: false
default: ''
run_fdv2_tests:
description: 'Whether to run contract tests from the v3.0.0-alpha.6 tag'
description: 'Whether to run contract tests from the latest v3 release'
required: false
default: 'false'

Expand Down Expand Up @@ -43,40 +43,30 @@ runs:

- name: Suppression Path
shell: bash
run: echo "SUPPRESSION_FILE=$(dirname ./${{ inputs.service_project_file }})/test-supressions.txt" >> $GITHUB_ENV
run: |
echo "SUPPRESSION_FILE=$(dirname ./${{ inputs.service_project_file }})/test-supressions.txt" >> $GITHUB_ENV
echo "SUPPRESSION_FILE_FDV2=$(dirname ./${{ inputs.service_project_file }})/test-supressions-fdv2.txt" >> $GITHUB_ENV

- name: Run Contract Tests
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1.0.2
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
test_service_port: 8000
enable_persistence_tests: 'false'
# Leave the service up for the FDv2 run that follows.
stop_service: ${{ inputs.run_fdv2_tests == 'true' && 'false' || 'true' }}
extra_params: '-status-timeout=360 -skip-from=${{ env.SUPPRESSION_FILE }}'
token: ${{ inputs.token }}

- name: Setup Go
- name: Run Contract Tests FDv2 Flavor
if: inputs.run_fdv2_tests == 'true'
uses: actions/setup-go@v5
uses: launchdarkly/gh-actions/actions/contract-tests@contract-tests-v1
with:
go-version: '1.21'

- name: Launch Contract Tests FDv2 Flavor
if: inputs.run_fdv2_tests == 'true'
id: launch-contract-tests-fdv2
shell: bash
run: dotnet ${{ inputs.service_dll_file }} > test-service.log 2>&1 & disown

- name: Clone and run contract tests from v3.0.0-alpha.6 tag
if: inputs.run_fdv2_tests == 'true'
shell: bash
run: |
mkdir -p /tmp/sdk-test-harness
git clone https://github.com/launchdarkly/sdk-test-harness.git /tmp/sdk-test-harness
cp $(dirname ./${{ inputs.service_project_file }})/test-supressions-fdv2.txt /tmp/sdk-test-harness/testharness-suppressions-fdv2.txt
cd /tmp/sdk-test-harness
git checkout v3.0.0-alpha.6
go build -o test-harness .
./test-harness -url http://localhost:8000 -debug -status-timeout=360 --skip-from=testharness-suppressions-fdv2.txt --stop-service-at-end
env:
GITHUB_TOKEN: ${{ inputs.token }}
test_service_port: 8000
version: 'v3'
debug_logging: 'true'
enable_persistence_tests: 'false'
extra_params: '-status-timeout=360 -skip-from=${{ env.SUPPRESSION_FILE_FDV2 }}'
token: ${{ inputs.token }}

- name: Upload test service log on failure
if: failure() && inputs.run_fdv2_tests == 'true'
Expand Down
Loading