Skip to content

fix(vitess): avoid flaky TLS test by accepting alternate error - #22140

Open
jdoupe wants to merge 1 commit into
vitessio:mainfrom
jdoupe:fix-flaky-tls-test
Open

jdoupe wants to merge 1 commit into
vitessio:mainfrom
jdoupe:fix-flaky-tls-test

Conversation

@jdoupe

@jdoupe jdoupe commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Description

TestTLSRequired was flaky because a race condition between the server rejecting
the revoked certificate and the connection being reset could cause the client to
see "connection reset by peer" instead of "remote error: tls: bad certificate".

The test is updated to accept either error string, both of which indicate the
revoked certificate was properly rejected.

Motivation

How do you use Vitess? (pick one)

  • In production
  • In staging or development
  • Evaluating it
  • I don't use Vitess

Did you run this change against a real Vitess deployment?

Related Issue(s)

Fixes #17434

Checklist

  • "Backport to:" labels have been added if this change should be back-ported to release branches
  • If this change is to be back-ported to previous releases, a justification is included in the PR description
  • Tests were added or are not required
  • Did the new or modified tests pass consistently locally and on CI?
  • Documentation was added or is not required

Deployment Notes

AI Disclosure

Copilot AI balanced review requested due to automatic review settings November 23, 2026 14:51
@github-actions github-actions Bot added this to the v25.0.0 milestone Nov 23, 2026
@vitess-bot vitess-bot Bot added NeedsWebsiteDocsUpdate What it says NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Nov 23, 2026
@vitess-bot

vitess-bot Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Review Checklist

Hello reviewers! 👋 Please follow this checklist when reviewing this Pull Request.

General

  • Ensure that the Pull Request has a descriptive title.
  • Ensure there is a link to an issue (except for internal cleanup and flaky test fixes), new features should have an RFC that documents use cases and test cases.

Tests

  • Bug fixes should have at least one unit or end-to-end test, enhancement and new features should have a sufficient number of tests.

Documentation

  • Apply the release notes (needs details) label if users need to know about this change.
  • New features should be documented.
  • There should be some code comments as to why things are implemented the way they are.
  • There should be a comment at the top of each new or modified test to explain what the test does.

New flags

  • Is this flag really necessary?
  • Flag names must be clear and intuitive, use dashes (-), and have a clear help text.

If a workflow is added or modified:

  • Each item in Jobs should be named in order to mark it as required.
  • If the workflow needs to be marked as required, the maintainer team must be notified.

Backward compatibility

  • Protobuf changes should be wire-compatible.
  • Changes to _vt tables and RPCs need to be backward compatible.
  • RPC changes should be compatible with vitess-operator
  • If a flag is removed, then it should also be removed from vitess-operator and arewefastyet, if used there.
  • vtctl command output order should be stable and awk-able.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

There are no active review issues for the test-only change addressing revoked-certificate error variability.

No open issues 🎉

What changed in this PR

This test-only change addresses the TestTLSRequired flakiness reported in #17434 by accepting either observed error when connecting with a revoked client certificate.

Changes:

  • Accepts both the TLS “bad certificate” error and “connection reset by peer.”
  • Still requires a connection error and reports unexpected error text.
File Description
go/​mysql/​server_test.go Updates the revoked-certificate assertion to tolerate either observed failure.

Review effort: Balanced

@codecov

codecov Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.13%. Comparing base (70c7a72) to head (ff5d8d8).
⚠️ Report is 843 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main   #22140       +/-   ##
===========================================
+ Coverage   69.67%   72.13%    +2.46%     
===========================================
  Files        1614      354     -1260     
  Lines      216793    62222   -154571     
===========================================
- Hits       151044    44884   -106160     
+ Misses      65749    17338    -48411     
Flag Coverage Δ
partial 72.13% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mattlord mattlord added Component: Build/CI Type: CI/Build and removed NeedsDescriptionUpdate The description is not clear or comprehensive enough, and needs work NeedsWebsiteDocsUpdate What it says NeedsIssue A linked issue is missing for this Pull Request NeedsBackportReason If backport labels have been applied to a PR, a justification is required labels Nov 23, 2026
mattlord
mattlord previously approved these changes Nov 23, 2026

@mattlord mattlord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for picking this up! I think that it'd be worth adding a short comment above the assertion in go/mysql/server_test.go:1258 that says why a reset counts as a rejection. With TLS 1.3, the client finishes its handshake before the server checks the client certificate. So when the server rejects the revoked cert and closes the connection first, the client's write of the handshake response fails with connection reset by peer before it can read the server's bad certificate alert. Without that comment, accepting the reset looks like it could hide an unrelated failure.

Looks good to me.

@mattlord
mattlord requested a review from a team November 23, 2026 16:59
Signed-off-by: Jeremy Doupe <jeremy@doupe.com>
@jdoupe
jdoupe force-pushed the fix-flaky-tls-test branch from da41c5b to ff5d8d8 Compare November 23, 2026 23:53
Copilot AI balanced review requested due to automatic review settings November 23, 2026 23:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified in the test-only update to accept both expected revoked-certificate connection errors.

No open issues 🎉

Review effort: Balanced

@jdoupe

jdoupe commented Nov 23, 2026

Copy link
Copy Markdown
Contributor Author

THanke @mattlord! Added comment for assertion.

@mattlord mattlord left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding the comment! Looks good to me.

@mattlord
mattlord requested a review from a team November 24, 2026 01:54

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Flaky TestTLSRequired

3 participants