Skip to content

test(e2e): make plugin e2e tests pass on a fresh database - #9224

Open
chenwei791129 wants to merge 1 commit into
apache:mainfrom
chenwei791129:fix/e2e-missing-domain-tables
Open

chenwei791129 wants to merge 1 commit into
apache:mainfrom
chenwei791129:fix/e2e-missing-domain-tables

Conversation

@chenwei791129

Copy link
Copy Markdown
Contributor

Summary

e2ehelper.DataFlowTester runs no migrations, so a test only has the tables it flushes or imports. Several plugin e2e tests ran subtasks that read or write other tables. Those tables existed only because an earlier test, in the same package or in another plugin, created them on the shared CI database. On a fresh database these tests fail with Error 1146: Table ... doesn't exist. Details are in the issue.

This PR changes only test code and fixtures:

  • Missing tables: before each subtask runs, the test flushes the tables that subtask writes or deletes from (board_issues, board_sprints, sprint_issues, issue_labels, issue_assignees, pull_request_labels/assignees/reviewers, and tool tables such as _tool_gitlab_reviewers, _tool_github_repo_accounts, _tool_jira_issue_fields). The lists match what sibling tests in the same package already flush for the same subtasks.
  • Data left by earlier tests: where a test used data an earlier test left behind, it now imports the same snapshot itself. This affects the bitbucket comment test (_tool_bitbucket_issues) and the tapd due date tests (statuses and workitem types). Each test now sees the same data whether it runs alone or in sequence.
  • DORA: new change_lead_time/accounts.csv with a normal account and a bot account. A bot comment on pr1, earlier than its first human review, is added to pull_request_comments.csv. The expected project_pr_metrics.csv does not change, so the test now checks that a bot comment is not counted as the first review (feat(dora): exclude bot/automation accounts from PR Pickup Time calcu… #9000).

Does this close any open issues?

Closes #9223

Other Information

FlushTabler drops and recreates the table. None of the added flushes removes data that a later test needs: every test that reads one of these tables sets it up itself. The runs below confirm this.

Tests

All Go plugin e2e tests on MySQL 8 (schema_e2e was not run locally because it needs libgit2):

Run main this PR
Each package on its own fresh database 6 packages fail all pass
Each test function on its own fresh database — 208 / 208 pass
All packages in sequence on one shared database (as in CI) pass pass

Mutation check: with the is_bot condition removed from change_lead_time_calculator.go, the DORA test fails (expected "comment02", actual "comment01_bot").

golangci-lint reports 0 issues on the changed packages.

DataFlowTester runs no migrations, so a test only has the tables it
flushes or imports. Several e2e tests ran subtasks that read or write
other tables, which only existed because an earlier test (in the same
package or another plugin) had created them on the shared CI database.

Flush the tables those subtasks touch, and import the existing snapshots
where a test relied on data left by an earlier test. Give the DORA
change lead time test its own accounts fixture with a bot account, so
the bot exclusion for the first review is now covered.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][e2e] Several plugin e2e tests fail on a fresh database because they depend on tables created by other tests

1 participant