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

proxy: extract tcp logic out further #24

Merged
merged 2 commits into from
Aug 3, 2022
Merged

proxy: extract tcp logic out further #24

merged 2 commits into from
Aug 3, 2022

Conversation

xhebox
Copy link
Collaborator

@xhebox xhebox commented Aug 3, 2022

What problem does this PR solve?

Issue Number: ref #23

Problem Summary: An effort to make tests cleaner.

What is changed and how it works:

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

reduce logic need in `*testSuite` and  `TestXXX`

Signed-off-by: xhe <xw897002528@gmail.com>
@xhebox xhebox requested a review from djshow832 August 3, 2022 05:30
@xhebox xhebox mentioned this pull request Aug 3, 2022
2 tasks
pkg/proxy/backend/common_test.go Outdated Show resolved Hide resolved
Comment on lines +94 to +96
if cerr != nil {
require.NoError(t, tc.clientIO.Close())
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

It should be closed even if cerr==nil. Why not close them all at last?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Because you may want to call tc.run() again to combine multiple methods into one test. For example, handshakeFirstTime and handshakeSecondTime.

pkg/proxy/backend/testsuite_test.go Outdated Show resolved Hide resolved
Signed-off-by: xhe <xw897002528@gmail.com>
@djshow832 djshow832 merged commit bc0f00e into pingcap:main Aug 3, 2022
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.

2 participants