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

backend: add tests for BackendConnMgr #41

Merged
merged 3 commits into from
Aug 19, 2022
Merged

backend: add tests for BackendConnMgr #41

merged 3 commits into from
Aug 19, 2022

Conversation

djshow832
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #40

Problem Summary:
Add tests for BackendConnMgr.

What is changed and how it works:
Add unit tests and update some comments.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Notable changes

  • Has configuration change
  • Has HTTP API interfaces change (Don't forget to add the declarative for API)
  • Has weirctl change
  • Other user behavior changes

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@djshow832 djshow832 requested a review from xhebox August 17, 2022 07:57
Copy link
Collaborator

@xhebox xhebox left a comment

Choose a reason for hiding this comment

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

Test cases LGTM

pkg/proxy/backend/backend_conn_mgr_test.go Outdated Show resolved Hide resolved
pkg/proxy/backend/backend_conn_mgr_test.go Show resolved Hide resolved
Comment on lines +112 to +114
conn, err := ts.tc.backendListener.Accept()
require.NoError(ts.t, err)
ts.tc.backendIO = pnet.NewPacketIO(conn)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We don't really need to bypass this by WithBackend. All test cases will accept the handshake.

Only TestRedirectFail is re-accepting the conenction after the first handshake. So maybe wrap this pattern in to a method ts.BackendAccept().

@xhebox xhebox merged commit ed53270 into pingcap:main Aug 19, 2022
@djshow832 djshow832 deleted the backend_mgr branch August 19, 2022 07:26
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.

Add tests for backend manager
2 participants