Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action inputs to dispatch n-runs of a single functional test #6297

Open
wants to merge 76 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
76 commits
Select commit Hold shift + click to select a range
f5301c6
create Run Test N-times gh action
carlydf Jul 10, 2024
377d713
change name of step
carlydf Jul 10, 2024
c05a1a1
make existing test workflow allow single test run
carlydf Jul 11, 2024
6fb13fd
fix false check syntax
carlydf Jul 11, 2024
82acc5c
don't run unit tests in single functional test mode
carlydf Jul 11, 2024
56b97cf
fix needs
carlydf Jul 11, 2024
320ed3d
hardcode single test mode
carlydf Jul 11, 2024
94a6f2c
run functional-test always()
carlydf Jul 11, 2024
774403d
print what the makefile runs
carlydf Jul 12, 2024
cd5160b
temporary code change to test flaky test
carlydf Jul 12, 2024
f055929
add db options
carlydf Jul 12, 2024
451f80c
hard code sqlite and postgres12
carlydf Jul 13, 2024
ceeaca4
delete comment below runs-on
carlydf Jul 13, 2024
6ddda0b
fix db issue?
carlydf Jul 13, 2024
fc7ead3
removed duplicate matrix step, updated options
carlydf Jul 15, 2024
ce29c65
define setup job outputs
carlydf Jul 15, 2024
8fbe6df
configurable timeout
carlydf Jul 15, 2024
bc76889
test string timeout
carlydf Jul 16, 2024
69a0a37
fix timeout pipe
carlydf Jul 16, 2024
ee8e476
try dynamic shard matrix
carlydf Jul 16, 2024
be78354
try other dynamic matrix format
carlydf Jul 16, 2024
0a9d473
add db matrix
carlydf Jul 16, 2024
f6b52ea
fix misuse of single quotes
carlydf Jul 16, 2024
5647d44
hard-code sqlite for single test mode
carlydf Jul 16, 2024
dd629bc
quote the db names
carlydf Jul 16, 2024
9a78b44
remove comment above runs-on and dynamically config test_db
carlydf Jul 16, 2024
a129047
Merge branch 'main' into cdf/rerun-functional-test
carlydf Jul 16, 2024
7292977
change job if condition so steps run when needed
carlydf Jul 16, 2024
4980a86
Merge branch 'cdf/rerun-functional-test' of github.com:temporalio/tem…
carlydf Jul 16, 2024
189b6a9
fix lint and clean code
carlydf Jul 16, 2024
241cf33
remove db configuration
carlydf Jul 16, 2024
9c1f858
change if condition syntax and pipe in timeout
carlydf Jul 16, 2024
f4f8752
give up on configuring test db
carlydf Jul 16, 2024
b29a900
specify # of times per db
carlydf Jul 16, 2024
2eacb72
Revert "specify # of times per db"
carlydf Jul 16, 2024
8d05095
Revert "give up on configuring test db"
carlydf Jul 16, 2024
537294b
try db config again with new json formatting
carlydf Jul 16, 2024
e9d8f11
go back tp unquoted != true
carlydf Jul 16, 2024
c33c0a4
run functional-test always
carlydf Jul 16, 2024
56e19ef
give up on one-db-at-a-time
carlydf Jul 16, 2024
8278452
uncomment real functional test work
carlydf Jul 16, 2024
1ae8df0
clean up extra files
carlydf Jul 16, 2024
2a95b20
pass timeout to makefile
carlydf Jul 16, 2024
3ef7261
pass timeouts correctly
carlydf Jul 16, 2024
945dc27
use TEST_TIMEOUT variable in makefile
carlydf Jul 16, 2024
5470ba7
remove unused make target, try == false syntax for if:
carlydf Jul 16, 2024
55962e8
go back to != true
carlydf Jul 16, 2024
f9f1533
try != 'true'
carlydf Jul 16, 2024
09d7fe6
Merge branch 'main' of github.com:temporalio/temporal into cdf/rerun-…
carlydf Jul 16, 2024
532c0a9
try != true again
carlydf Jul 16, 2024
07ce206
remove extra file
carlydf Jul 16, 2024
3d226a4
improve test flag consistency
carlydf Jul 16, 2024
7824291
change wording
carlydf Jul 16, 2024
3acb316
fix TestWorkflowTaskRedirectInRetryFirstTask flake
carlydf Jul 16, 2024
e525fd4
add buildkite message
carlydf Jul 16, 2024
c74c23d
try configurable runner size
carlydf Jul 16, 2024
fe5c796
add configurable db via if
carlydf Jul 16, 2024
b4ff739
run job set up conditionally based on db as well
carlydf Jul 16, 2024
3e826a3
only tear down docker compose if we made it
carlydf Jul 16, 2024
a082423
revert test flake fix
carlydf Jul 16, 2024
a31d78b
fix cassandra db input
carlydf Jul 17, 2024
f6f6873
multi-select test db
carlydf Jul 24, 2024
e2e0d15
remove postgres12_pgx test db
carlydf Jul 24, 2024
2540f46
fix bash syntax error
carlydf Jul 24, 2024
e9ce2a7
try a different jq syntax
carlydf Jul 24, 2024
ed9233b
merge in main
carlydf Jul 24, 2024
fdcaa7f
delete bad mktemp --tmpdir flag
carlydf Jul 24, 2024
b7d9ccc
revert --tempdir flag change
carlydf Jul 24, 2024
fc558d9
put back newlines
carlydf Jul 24, 2024
2db8d87
temporarily remove make ci-build-misc
carlydf Jul 24, 2024
5951bb3
remove cache-docker-images dependency
carlydf Jul 24, 2024
7417f3d
add prints
carlydf Jul 24, 2024
16ee81e
save changes
carlydf Jul 25, 2024
edb5343
echo vars then run functional test n times
carlydf Sep 9, 2024
90c4962
fix syntax
carlydf Sep 9, 2024
f16eb70
Merge branch 'main' of github.com:temporalio/temporal into cdf/rerun-…
carlydf Sep 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 123 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,45 @@ on:
commit:
description: "Commit SHA"
required: true
run_single_functional_test:
description: "Whether to run a single test. If so, the rest of the input fields are required."
type: boolean
default: false
cassandra:
description: "cassandra"
type: boolean
default: false
sqlite:
description: "sqlite"
type: boolean
default: false
mysql8:
description: "mysql8"
type: boolean
default: false
postgres12:
description: "postgres12"
type: boolean
default: false
n_runs:
description: "[Single Test Only] Number of times to repeat the single test per database type"
type: number
default: 1
test_name:
description: "[Single Test Only] Name of the test to run (i.e. 'TestAcquireShard_DeadlineExceededErrorSuite' or 'TestFunctionalSuite/TestUpdateWorkflow')"
type: string
timeout_minutes:
description: "[Single Test Only] Test timeout in minutes"
type: number
default: 120
test_runner:
description: "[Single Test Only] Which runner to use. Choose higher RAM if your n_runs is high."
type: choice
default: "16GB RAM (ubuntu-20.04)"
options:
- "16GB RAM (ubuntu-20.04)"
- "64GB RAM (ubuntu-22.04)"


concurrency: # Auto-cancel existing runs in the PR when a new commit is pushed
group: run-tests-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -60,13 +99,16 @@ jobs:
- run: make build-tests

unit-test:
if: ${{ inputs.run_single_functional_test != true }}
carlydf marked this conversation as resolved.
Show resolved Hide resolved
name: Unit test
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ matrix.runs-on }}
env:
BUILDKITE_MESSAGE: "{\"job\": \"unit-test\"}"
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -87,13 +129,16 @@ jobs:
run: make upload-test-results

integration-test:
if: ${{ inputs.run_single_functional_test != true }}
carlydf marked this conversation as resolved.
Show resolved Hide resolved
name: Integration test
needs: misc-checks
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ matrix.runs-on }}
env:
BUILDKITE_MESSAGE: "{\"job\": \"integration-test\"}"
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -123,21 +168,75 @@ jobs:
if: ${{ !cancelled() }}
run: make upload-test-results

- name: Tear down docker compose
if: ${{ always() }}
run: |
docker compose -f ${{ env.DOCKER_COMPOSE_FILE }} down -v


set-up-functional-test:
name: Set up functional test
runs-on: ubuntu-20.04
outputs:
shard_indices: ${{ steps.generate_output.outputs.shard_indices }}
total_shards: ${{ steps.generate_output.outputs.shards }}
github_timeout: ${{ steps.generate_output.outputs.github_timeout }}
test_timeout: ${{ steps.generate_output.outputs.test_timeout }}
single_test_args: ${{ steps.generate_output.outputs.single_test_args }}
runs_on: ${{ steps.generate_output.outputs.runs_on }}
dbs: ${{ steps.generate_output.outputs.dbs }}
steps:
- id: generate_output
run: |
shards=3
timeout=30
runs_on='["ubuntu-20.04"]'
if [[ "${{ inputs.run_single_functional_test }}" == "true" ]]; then
shards=1
timeout=${{ inputs.timeout_minutes }}
single_test_args="-run ${{ inputs.test_name }} -count ${{ inputs.n_runs }}"
if [[ "${{ inputs.test_runner }}" == "64GB RAM (ubuntu-22.04)" ]]; then
runs_on='["ubuntu-latest-16-cores"]'
fi
dbs_arr=()
if [[ "${{ inputs.cassandra }}" == "true" ]]; then dbs_arr+=("cassandra"); fi
if [[ "${{ inputs.sqlite }}" == "true" ]]; then dbs_arr+=("sqlite"); fi
if [[ "${{ inputs.mysql8 }}" == "true" ]]; then dbs_arr+=("mysql8"); fi
if [[ "${{ inputs.postgres12 }}" == "true" ]]; then dbs_arr+=("postgres12"); fi
if [[ ${#dbs_arr[@]} == 0 ]]; then
dbs='["sqlite"]'
else
dbs=$(jq -c -n '$ARGS.positional' --args "${dbs_arr[@]}")
fi
fi
{
echo "shard_indices=[$(seq -s, 0 $((shards-1)))]"
echo "shards=$shards"
echo "github_timeout=$((timeout+5))"
echo "test_timeout=${timeout}m"
echo "single_test_args=$single_test_args"
echo "runs_on=$runs_on"
echo "dbs=$dbs"
} >> "$GITHUB_OUTPUT"
- id: cat_output
run: |
cat "$GITHUB_OUTPUT"

functional-test:
name: Functional test
needs: misc-checks
needs: [misc-checks, set-up-functional-test]
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
runs-on: ${{ fromJson(needs.set-up-functional-test.outputs.runs_on) }}
shard_index: ${{ fromJson(needs.set-up-functional-test.outputs.shard_indices) }}
name:
- cass_es
- cass_es8
- sqlite
- mysql8
- postgres12
- postgres12_pgx
shard_index: [0, 1, 2]
include:
- name: cass_es
persistence_type: nosql
Expand Down Expand Up @@ -167,38 +266,52 @@ jobs:
containers: [postgresql]
runs-on: ${{ matrix.runs-on }}
env:
TEST_TOTAL_SHARDS: 3
TEST_TOTAL_SHARDS: ${{ needs.set-up-functional-test.outputs.total_shards }}
TEST_SHARD_INDEX: ${{ matrix.shard_index }}
PERSISTENCE_TYPE: ${{ matrix.persistence_type }}
PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }}
SINGLE_TEST_ARGS: ${{ needs.set-up-functional-test.outputs.single_test_args }}
TEST_TIMEOUT: ${{ needs.set-up-functional-test.outputs.test_timeout }}
BUILDKITE_MESSAGE: "{\"job\": \"functional-test\", \"db\": \"${{ matrix.persistence_driver }}\"}"
steps:
- name: Print functional test
run: echo "${{ needs.set-up-functional-test.outputs.dbs }}" && echo "$SINGLE_TEST_ARGS"
- uses: ScribeMD/[email protected]
if: ${{ inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-functional-test.outputs.dbs), env.PERSISTENCE_DRIVER)) }}
with:
key: docker-${{ runner.os }}-${{ hashFiles(env.DOCKER_COMPOSE_FILE) }}

- uses: actions/checkout@v4
if: ${{ inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-functional-test.outputs.dbs), env.PERSISTENCE_DRIVER)) }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ env.COMMIT }}

- uses: actions/setup-go@v5
if: ${{ inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-functional-test.outputs.dbs), env.PERSISTENCE_DRIVER)) }}
with:
go-version-file: 'go.mod'
check-latest: true

- name: Start containerized dependencies
if: ${{ toJson(matrix.containers) != '[]' }}
if: ${{ toJson(matrix.containers) != '[]' && (inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-functional-test.outputs.dbs), env.PERSISTENCE_DRIVER))) }}
uses: hoverkraft-tech/[email protected]
with:
compose-file: ${{ env.DOCKER_COMPOSE_FILE }}
services: "${{ join(matrix.containers, '\n') }}"
down-flags: -v

- name: Run functional test
timeout-minutes: 30 # make sure this is larger than the test timeout in the Makefile
if: ${{ inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-functional-test.outputs.dbs), env.PERSISTENCE_DRIVER)) }}
timeout-minutes: ${{ fromJSON(needs.set-up-functional-test.outputs.github_timeout) }} # make sure this is larger than the test timeout in the Makefile
run: make functional-test-coverage

- name: Upload test results
if: ${{ !cancelled() }}
if: ${{ !cancelled() && (inputs.run_single_functional_test != true || (inputs.run_single_functional_test == true && contains(fromJSON(needs.set-up-functional-test.outputs.dbs), env.PERSISTENCE_DRIVER))) }}
run: make upload-test-results

functional-test-xdc:
if: ${{ inputs.run_single_functional_test != true }}
carlydf marked this conversation as resolved.
Show resolved Hide resolved
name: Functional test xdc
needs: misc-checks
strategy:
Expand Down Expand Up @@ -232,6 +345,7 @@ jobs:
env:
PERSISTENCE_TYPE: ${{ matrix.persistence_type }}
PERSISTENCE_DRIVER: ${{ matrix.persistence_driver }}
BUILDKITE_MESSAGE: "{\"job\": \"functional-test-xdc\", \"db\": \"${{ matrix.persistence_driver }}\"}"
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -260,6 +374,7 @@ jobs:
run: make upload-test-results

functional-test-ndc:
if: ${{ inputs.run_single_functional_test != true }}
carlydf marked this conversation as resolved.
Show resolved Hide resolved
name: Functional test ndc
needs: misc-checks
strategy:
Expand Down Expand Up @@ -324,6 +439,7 @@ jobs:
run: make functional-test-ndc-coverage

test-status:
if: ${{ inputs.run_single_functional_test != true }}
carlydf marked this conversation as resolved.
Show resolved Hide resolved
name: Test Status
needs:
- unit-test
Expand All @@ -332,7 +448,6 @@ jobs:
- functional-test-xdc
- functional-test-ndc
runs-on: ubuntu-20.04
if: always()
env:
RESULTS: ${{ toJSON(needs.*.result) }}
steps:
Expand Down
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ define NEWLINE

endef

TEST_TIMEOUT := 25m
TEST_TIMEOUT ?= 25m

PROTO_ROOT := proto
PROTO_FILES = $(shell find ./$(PROTO_ROOT)/internal -name "*.proto")
Expand Down Expand Up @@ -391,8 +391,10 @@ pre-build-functional-test-coverage: prepare-coverage-test

functional-test-coverage: prepare-coverage-test
@printf $(COLOR) "Run functional tests with coverage with $(PERSISTENCE_DRIVER) driver..."
@$(GOTESTSUM) --junitfile $(NEW_REPORT) -- \
$(FUNCTIONAL_TEST_ROOT) -shuffle on -timeout=$(TEST_TIMEOUT) $(TEST_ARGS) $(TEST_TAG_FLAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) $(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)
$(GOTESTSUM) --junitfile $(NEW_REPORT) -- \
$(FUNCTIONAL_TEST_ROOT) -shuffle on -timeout=$(TEST_TIMEOUT) $(TEST_ARGS) $(SINGLE_TEST_ARGS) $(TEST_TAG_FLAG) \
-persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) \
$(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)

functional-test-xdc-coverage: prepare-coverage-test
@printf $(COLOR) "Run functional test for cross DC with coverage with $(PERSISTENCE_DRIVER) driver..."
Expand Down
3 changes: 2 additions & 1 deletion develop/upload-test-results.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ for file in *.junit.xml; do
-F "run_env[branch]=${GITHUB_REF}" \
-F "run_env[commit_sha]=${GITHUB_SHA}" \
-F "run_env[url]=https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}" \
-F "run_env[message]=${BUILDKITE_MESSAGE}" \
https://analytics-api.buildkite.com/v1/uploads
done
done
Loading