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

Mark flaky tests #813

Merged
merged 28 commits into from
May 10, 2024
Merged

Mark flaky tests #813

merged 28 commits into from
May 10, 2024

Conversation

mikealfare
Copy link
Contributor

@mikealfare mikealfare commented May 6, 2024

resolves #770

Problem

We have a handful of flaky tests in dbt-redshift that routinely prevent CI from passing. It's not always the same test that fails. After a few runs, all tests have passed at least once, but it's rare that they all pass at the same time.

Solution

  • mark flaky tests using pytest.mark (e.g. @pytest.mark.flaky)
  • update the existing integration tests to only run non-flaky tests
  • add a new set of integration tests that only run flaky tests
    • re-running duration is greatly reduced
  • reduce collisions from tests running at the same time
    • run these specifically after the non-flaky tests
    • run them in series according to GHA
    • run them in series according to pytest
  • only require non-flaky tests
  • only alert on failed non-flaky tests
  • identify similar characteristics across flaky tests to troubleshoot the source

Checklist

  • I have read the contributing guide and understand what's expected of me
  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX

@mikealfare mikealfare self-assigned this May 6, 2024
@cla-bot cla-bot bot added the cla:yes label May 6, 2024
@mikealfare mikealfare added Skip Changelog Skips GHA to check for changelog file and removed cla:yes labels May 6, 2024
Copy link
Contributor

github-actions bot commented May 6, 2024

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the dbt-redshift contributing guide.

@mikealfare
Copy link
Contributor Author

mikealfare commented May 6, 2024

The integration tests workflow is updated as part of this PR. Here's a run against this branch:
https://github.com/dbt-labs/dbt-redshift/actions/runs/8990807294

@cla-bot cla-bot bot added the cla:yes label May 6, 2024
@mikealfare
Copy link
Contributor Author

Here's the latest integration tests run against this branch:
https://github.com/dbt-labs/dbt-redshift/actions/runs/9011428584

@colin-rogers-dbt colin-rogers-dbt merged commit b57890e into main May 10, 2024
26 of 28 checks passed
@colin-rogers-dbt colin-rogers-dbt deleted the mark-flaky-tests branch May 10, 2024 15:36
Copy link
Contributor

The backport to 1.8.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.8.latest 1.8.latest
# Navigate to the new working tree
cd .worktrees/backport-1.8.latest
# Create a new branch
git switch --create backport-813-to-1.8.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b57890e3503928ced7dfd75de6985b348f0e7307
# Push it to GitHub
git push --set-upstream origin backport-813-to-1.8.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.8.latest

Then, create a pull request where the base branch is 1.8.latest and the compare/head branch is backport-813-to-1.8.latest.

Copy link
Contributor

The backport to 1.7.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.7.latest 1.7.latest
# Navigate to the new working tree
cd .worktrees/backport-1.7.latest
# Create a new branch
git switch --create backport-813-to-1.7.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b57890e3503928ced7dfd75de6985b348f0e7307
# Push it to GitHub
git push --set-upstream origin backport-813-to-1.7.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.7.latest

Then, create a pull request where the base branch is 1.7.latest and the compare/head branch is backport-813-to-1.7.latest.

Copy link
Contributor

The backport to 1.6.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.6.latest 1.6.latest
# Navigate to the new working tree
cd .worktrees/backport-1.6.latest
# Create a new branch
git switch --create backport-813-to-1.6.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b57890e3503928ced7dfd75de6985b348f0e7307
# Push it to GitHub
git push --set-upstream origin backport-813-to-1.6.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.6.latest

Then, create a pull request where the base branch is 1.6.latest and the compare/head branch is backport-813-to-1.6.latest.

Copy link
Contributor

The backport to 1.6.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.6.latest 1.6.latest
# Navigate to the new working tree
cd .worktrees/backport-1.6.latest
# Create a new branch
git switch --create backport-813-to-1.6.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b57890e3503928ced7dfd75de6985b348f0e7307
# Push it to GitHub
git push --set-upstream origin backport-813-to-1.6.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.6.latest

Then, create a pull request where the base branch is 1.6.latest and the compare/head branch is backport-813-to-1.6.latest.

Copy link
Contributor

The backport to 1.7.latest failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-1.7.latest 1.7.latest
# Navigate to the new working tree
cd .worktrees/backport-1.7.latest
# Create a new branch
git switch --create backport-813-to-1.7.latest
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 b57890e3503928ced7dfd75de6985b348f0e7307
# Push it to GitHub
git push --set-upstream origin backport-813-to-1.7.latest
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-1.7.latest

Then, create a pull request where the base branch is 1.7.latest and the compare/head branch is backport-813-to-1.7.latest.

mikealfare added a commit that referenced this pull request May 14, 2024
* mark flaky tests using pytest.mark

* split integration test runs by flaky and non-flaky

* fix the posargs syntax for tox

* force flaky tests to run in series, fix python version getting truncated

* revert the integration test job name to match the existing names

* separate flaky tests as a separate matrix of jobs

* recombine the integration tests

* allow integration tests to run fully in parallel for non-flaky tests

* remove windows from integration test matrix since we weren't originally testing on windows anyway

* add windows back in

* register the custom marker with pytest

* revert the combination of integration tests

* configure a pytest return of 5 to be 0

* fix test order to avoid unnecessary change

* mark more flaky tests

* mark more flaky tests

* pin windows images to 2019 to avoid datadog traceport failures

* pinning windows images to 2019 didn't solve datadog issue, updating pin to the most recent version

* turn off telemetry warnings (and telemetry)

* mark more tests as flaky

* mark more tests as flaky

* incorporate feedback

* incorporate feedback

(cherry picked from commit b57890e)
mikealfare added a commit that referenced this pull request May 14, 2024
backport #813

(cherry picked from commit b57890e)
mikealfare added a commit that referenced this pull request May 14, 2024
Backport #813

(cherry picked from commit b57890e)
colin-rogers-dbt pushed a commit that referenced this pull request May 14, 2024
* mark flaky tests using pytest.mark

* split integration test runs by flaky and non-flaky

* fix the posargs syntax for tox

* force flaky tests to run in series, fix python version getting truncated

* revert the integration test job name to match the existing names

* separate flaky tests as a separate matrix of jobs

* recombine the integration tests

* allow integration tests to run fully in parallel for non-flaky tests

* remove windows from integration test matrix since we weren't originally testing on windows anyway

* add windows back in

* register the custom marker with pytest

* revert the combination of integration tests

* configure a pytest return of 5 to be 0

* fix test order to avoid unnecessary change

* mark more flaky tests

* mark more flaky tests

* pin windows images to 2019 to avoid datadog traceport failures

* pinning windows images to 2019 didn't solve datadog issue, updating pin to the most recent version

* turn off telemetry warnings (and telemetry)

* mark more tests as flaky

* mark more tests as flaky

* incorporate feedback

* incorporate feedback

(cherry picked from commit b57890e)
colin-rogers-dbt pushed a commit that referenced this pull request May 14, 2024
backport #813

(cherry picked from commit b57890e)
mikealfare added a commit that referenced this pull request May 15, 2024
* Mark flaky tests (#813)

Backport #813

(cherry picked from commit b57890e)

* remove artifact from cherry picking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla:yes Skip Changelog Skips GHA to check for changelog file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spike] Debug Redshift CI/CD failures
3 participants