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

TestStreamStress doesn't wait for the test to finish #672

Closed
Stebalien opened this issue Jul 5, 2019 · 0 comments · Fixed by #674
Closed

TestStreamStress doesn't wait for the test to finish #672

Stebalien opened this issue Jul 5, 2019 · 0 comments · Fixed by #674

Comments

@Stebalien
Copy link
Member

makePinger and makePonger shouldn't launch goroutines as we don't end up waiting for these goroutines which means we finish the test before it's actually done.

func makePinger(st string, n int) func(network.Stream) {
return func(s network.Stream) {
go func() {
defer helpers.FullClose(s)
for i := 0; i < n; i++ {
b := make([]byte, 4+len(st))
if _, err := s.Write([]byte("ping" + st)); err != nil {
panic(err)
}
if _, err := io.ReadFull(s, b); err != nil {
panic(err)
}
if !bytes.Equal(b, []byte("pong"+st)) {
panic("bytes mismatch")
}
}
}()
}
}
func makePonger(st string) func(network.Stream) {
return func(s network.Stream) {
go func() {
defer helpers.FullClose(s)
for {
b := make([]byte, 4+len(st))
if _, err := io.ReadFull(s, b); err != nil {
if err == io.EOF {
return
}
panic(err)
}
if !bytes.Equal(b, []byte("ping"+st)) {
panic("bytes mismatch")
}
if _, err := s.Write([]byte("pong" + st)); err != nil {
panic(err)
}
}
}()
}
}

t4n6a1ka pushed a commit to t4n6a1ka/go-libp2p that referenced this issue Sep 5, 2019
t4n6a1ka pushed a commit to t4n6a1ka/go-libp2p that referenced this issue Sep 5, 2019
t4n6a1ka added a commit to t4n6a1ka/go-libp2p that referenced this issue Sep 5, 2019
* TestStreamsStress: reduce node count, increase stream density.

* upgrade peerstore.

* fix libp2p#672: wait until done; fix ponger response.

* remove superfluous goroutine; avoid t.Fatal from goroutines.

* mdns: always use interface addresses

We don't want to use the transformed/munged host addresses for local
announcements. Ideally, we'd take a more scientific approach to this (i.e.,
"host, please give me addresses relative to X") but we can't do that yet.

* Removed ineffectual assignments

We don't use `cs` here, drop it.

* Fixed typos (libp2p#680)

Just a few nit-picky typo fixes.

* Make use of time.Until & time.Since (libp2p#681)

No need to manually subtract timestamps.

* Simplify increments (libp2p#684)

* Avoid unnecessary conversions (libp2p#685)

No need to convert these types.

* Added missing error check in test (libp2p#683)

* gomod: update go-libp2p-circuit

* autorelay: ensure candidate relays can hop

* Update deps, mocknet tests

* Adjust test timings for Ed25519

* Bump secio

* Bump swarm version

* new: allow overriding the user-agent with an option

Instead of using a global variable.

This also:

* Adds an option to the identify service to set the user agent.
* Removes the ability to pass an identify service to NewHost as any reasonable
  Identify service already needs to be constructed with an instance of the host.

* set a default client-version using go modules

This should help us improve network stats on who's using libp2p.

* ci: bump go to 1.12

* README: bump to go 1.12

* dep: update go-libp2p-swarm

Fixes a race condition when a user modifies the address list returned by InterfaceListenAddresses.

* use new constructor for insecure transport (libp2p#706)

* dep: upgrade eventbus to v0.1.0 (libp2p#709)

* add godocs.

* Update main.yml

* Add Filters option (libp2p#717)

The new `Filters` option allows users to take ownership of the `Filters` struct, and is suitable for cases where the addresses you want to accept/deny change dynamically.

* Rename main.yml to : [^main.yml]

* mdns: always use interface addresses

We don't want to use the transformed/munged host addresses for local
announcements. Ideally, we'd take a more scientific approach to this (i.e.,
"host, please give me addresses relative to X") but we can't do that yet.

* TestStreamsStress: reduce node count, increase stream density.

* upgrade peerstore.

* fix libp2p#672: wait until done; fix ponger response.

* remove superfluous goroutine; avoid t.Fatal from goroutines.

* Removed ineffectual assignments

We don't use `cs` here, drop it.

* Fixed typos (libp2p#680)

Just a few nit-picky typo fixes.

* Make use of time.Until & time.Since (libp2p#681)

No need to manually subtract timestamps.

* Simplify increments (libp2p#684)

* Avoid unnecessary conversions (libp2p#685)

No need to convert these types.

* Added missing error check in test (libp2p#683)

* gomod: update go-libp2p-circuit

* autorelay: ensure candidate relays can hop

* Update deps, mocknet tests

* Adjust test timings for Ed25519

* Bump secio

* Bump swarm version

* new: allow overriding the user-agent with an option

Instead of using a global variable.

This also:

* Adds an option to the identify service to set the user agent.
* Removes the ability to pass an identify service to NewHost as any reasonable
  Identify service already needs to be constructed with an instance of the host.

* set a default client-version using go modules

This should help us improve network stats on who's using libp2p.

* ci: bump go to 1.12

* README: bump to go 1.12

* dep: update go-libp2p-swarm

Fixes a race condition when a user modifies the address list returned by InterfaceListenAddresses.

* use new constructor for insecure transport (libp2p#706)

* dep: upgrade eventbus to v0.1.0 (libp2p#709)

* add godocs.

* Add Filters option (libp2p#717)

The new `Filters` option allows users to take ownership of the `Filters` struct, and is suitable for cases where the addresses you want to accept/deny change dynamically.

* Rename : [^main.yml] to `.'yml*go (sawi)

* Rename `.'yml*go (sawi) to `.'yml*go #(sawi)

* Rename `.'yml*go #(sawi) to `.'yml*go
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 a pull request may close this issue.

1 participant