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 test in CI #6297

Merged
merged 81 commits into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
81 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
89b47d1
offer custom test directory
carlydf Oct 4, 2024
20e1f1e
offer n-times run for unit test also
carlydf Oct 4, 2024
b70af29
print test command in run
carlydf Oct 4, 2024
cb7d6c1
take dbs as list
carlydf Oct 9, 2024
c857565
make misc-checks a no-op in single test mode
carlydf Oct 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
59 changes: 54 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,21 @@ 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
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 suite to run, include -testify.m flag here if desired (i.e. 'TestAcquireShard_DeadlineExceededErrorSuite' or 'TestFunctionalSuite -testify.m=TestUpdateWorkflow')"
carlydf marked this conversation as resolved.
Show resolved Hide resolved
type: string
timeout_minutes:
description: "[Single Test Only] Github Action timeout in minutes"
type: number
default: 120

concurrency: # Auto-cancel existing runs in the PR when a new commit is pushed
group: run-tests-${{ github.head_ref || github.run_id }}
Expand All @@ -29,7 +44,9 @@ env:
BUILDKITE_ANALYTICS_TOKEN: ${{ secrets.BUILDKITE_ANALYTICS_TOKEN }}

jobs:

misc-checks:
if: ${{ inputs.run_single_functional_test != true }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to quote the boolean values.

Suggested change
if: ${{ inputs.run_single_functional_test != true }}
if: ${{ github.event.inputs.run_single_functional_test != 'true' }}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried it with quoting the boolean value and it didn't work, whereas what is currently in the PR works. Not sure why, but I've tried both ways multiple times and I'm very sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm.. actually, I need to test this more

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok yeah, it has to be != true

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/temporalio/temporal/actions/runs/9961930639 this run is with the single_test input boolean checked, and != 'true', and the unit tests and integration tests run, which is not what I want

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/temporalio/temporal/actions/runs/9962244076 this run is with the single_test input boolean checked and != true, and the unit tests and integration tests are correctly skipped

Copy link
Collaborator

@rodrigozhou rodrigozhou Jul 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be clear, did you try with single quote? Strings in GHA expressions must be in single quotes, not double quotes:
'true' works
"true" does not work

See actions/runner#1483 and actions/runner#2238.

name: Misc checks
strategy:
fail-fast: false
Expand Down Expand Up @@ -79,6 +96,7 @@ jobs:
- run: docker compose -f ${{ env.DOCKER_COMPOSE_FILE }} pull

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:
Expand Down Expand Up @@ -106,6 +124,7 @@ 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, cache-docker-images]
strategy:
Expand Down Expand Up @@ -145,21 +164,47 @@ jobs:
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 }}
single_test_args: ${{ steps.generate_output.outputs.single_test_args }}
functional_test_timeout: ${{ steps.generate_output.outputs.timeout }}
steps:
- id: generate_output
run: |
shards=3
timeout=30
if [[ "${{ inputs.run_single_functional_test }}" == "true" ]]; then
shards=1
timeout=${{ inputs.timeout_minutes }}
single_test_args="-test.run ${{ inputs.test_name }} -count ${{ inputs.n_runs }}"
carlydf marked this conversation as resolved.
Show resolved Hide resolved
fi
{
echo "shard_indices=[$(seq -s, 0 $((shards-1)))]"
echo "shards=$shards"
echo "timeout=$timeout"
echo "single_test_args=$single_test_args"
} >> "$GITHUB_OUTPUT"

functional-test:
name: Functional test
needs: [misc-checks, cache-docker-images]
needs: [cache-docker-images, set-up-functional-test]
carlydf marked this conversation as resolved.
Show resolved Hide resolved
strategy:
fail-fast: false
matrix:
runs-on: [ubuntu-20.04]
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 @@ -187,10 +232,12 @@ 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 }}
FUNCTIONAL_TEST_TIMEOUT: ${{ needs.set-up-functional-test.outputs.functional_test_timeout }}
steps:
- uses: ScribeMD/[email protected]
with:
Expand All @@ -212,7 +259,7 @@ jobs:
docker compose -f ${{ env.DOCKER_COMPOSE_FILE }} up -d ${{ join(matrix.containers, ' ') }}

- name: Run functional test
timeout-minutes: 30 # make sure this is larger than the test timeout in the Makefile
timeout-minutes: ${{ fromJSON(env.FUNCTIONAL_TEST_TIMEOUT) }} # make sure this is larger than the test timeout in the Makefile
carlydf marked this conversation as resolved.
Show resolved Hide resolved
run: make functional-test-coverage

- name: Upload test results
Expand All @@ -225,6 +272,7 @@ jobs:
docker compose -f ${{ env.DOCKER_COMPOSE_FILE }} down -v

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, cache-docker-images]
strategy:
Expand Down Expand Up @@ -292,6 +340,7 @@ jobs:
docker compose -f ${{ env.DOCKER_COMPOSE_FILE }} down -v

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, cache-docker-images]
strategy:
Expand Down Expand Up @@ -359,6 +408,7 @@ jobs:
docker compose -f ${{ env.DOCKER_COMPOSE_FILE }} down -v

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 @@ -367,7 +417,6 @@ jobs:
- functional-test-xdc
- functional-test-ndc
runs-on: ubuntu-20.04
if: always()
env:
RESULTS: ${{ toJSON(needs.*.result) }}
steps:
Expand Down
9 changes: 8 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -386,8 +386,15 @@ 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) $(SINGLE_TEST_ARGS) $(TEST_TAG_FLAG) \
-persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER) \
$(FUNCTIONAL_TEST_COVERPKG) -coverprofile=$(NEW_COVER_PROFILE)

functional-test-n-times: prepare-coverage-test
carlydf marked this conversation as resolved.
Show resolved Hide resolved
@printf $(COLOR) "Run functional test $(TEST_NAME) $(N_RUNS) times 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)
$(FUNCTIONAL_TEST_ROOT) -shuffle on -timeout=$(TEST_TIMEOUT) $(TEST_ARGS) -test.run $(TEST_NAME) -count $(N_TEST_RUNS) $(TEST_TAG_FLAG) -persistenceType=$(PERSISTENCE_TYPE) -persistenceDriver=$(PERSISTENCE_DRIVER)

functional-test-xdc-coverage: prepare-coverage-test
@printf $(COLOR) "Run functional test for cross DC with coverage with $(PERSISTENCE_DRIVER) driver..."
Expand Down
Loading