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

transport integration tests: add tests for resource manager #2285

Merged
merged 9 commits into from
Jun 1, 2023

Conversation

MarcoPolo
Copy link
Collaborator

@MarcoPolo MarcoPolo commented May 11, 2023

  • Remove duplicate SetProtocol call
  • Don't log if transport ErrListenerClosed
  • Close the conn scope in webtransport dial
  • Mock resource scope span
  • Add transport rcmgr integration test

Related to #2194

@MarcoPolo MarcoPolo changed the title transport integration tests: Resource manager Transport integration tests: Resource manager May 11, 2023
@MarcoPolo MarcoPolo marked this pull request as ready for review May 11, 2023 23:16
Copy link
Contributor

@marten-seemann marten-seemann left a comment

Choose a reason for hiding this comment

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

This is fantastic! This flow is not immediately obvious, and it's great to have a test that makes sure that we're actually calling the right methods on the resource manager.

Just some super minor nits.

p2p/test/transport/rcmgr_test.go Outdated Show resolved Hide resolved
for _, tc := range transportsToTest {
t.Run(tc.Name, func(t *testing.T) {
for _, testDialer := range []bool{true, false} {
t.Run(tc.Name+fmt.Sprintf(" test_dialer=%v", testDialer), func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it ok to capture the loop variable here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think so because t.Run blocks on f https://pkg.go.dev/[email protected]#T.Run. Would not be safe if we did t.Parallel in here. But I don't think we would. It would be a bit annoying to have f be returned from a func to get the closured variables in there. So I'm leaning towards leaving it, unless you prefer to change it.

p2p/test/transport/rcmgr_test.go Outdated Show resolved Hide resolved
p2p/test/transport/rcmgr_test.go Outdated Show resolved Hide resolved
p2p/test/transport/rcmgr_test.go Show resolved Hide resolved
@MarcoPolo
Copy link
Collaborator Author

Possibly flaky test here, will investigate

@marten-seemann marten-seemann changed the title Transport integration tests: Resource manager transport integration tests: add tests for resource manager Jun 1, 2023
@marten-seemann marten-seemann merged commit 1f7b0d2 into master Jun 1, 2023
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