Skip to content

p2p/simulations: add mocker functionality#15207

Merged
fjl merged 4 commits into
ethereum:masterfrom
holisticode:p2p-simulation-mocker
Dec 12, 2017
Merged

p2p/simulations: add mocker functionality#15207
fjl merged 4 commits into
ethereum:masterfrom
holisticode:p2p-simulation-mocker

Conversation

@holisticode
Copy link
Copy Markdown
Contributor

This PR adds mocker functionality to the simulations package. This allows to start/stop nodes via HTTP API.

It also brings back the state.go file into p2p/simulations/adatpers, which got lost during merge.

Finally, also fixes a bug on snapshot upload to the simulation, in that the upload would fail if there was a node in "down" state in the snapshot, but a "up" state connection would point to it.

@zelig
Copy link
Copy Markdown
Contributor

zelig commented Sep 28, 2017

looks good to me but let's approve this after the demo on Monday

Comment thread p2p/simulations/http.go Outdated
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.

Add a return after rendering the error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

added

Comment thread p2p/simulations/http.go Outdated
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.

This should be a 400 Bad Request.

Comment thread p2p/simulations/http.go Outdated
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.

This should be a 400 Bad Request.

Comment thread p2p/simulations/mocker.go Outdated
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.

s/mokcer/mocker

Comment thread p2p/simulations/mocker.go Outdated
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.

Why is this in a goroutine?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

that's probably a remnant of the time where there was no ticker to determine start/stop.

Comment thread p2p/simulations/mocker_test.go Outdated
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.

This should wait for the expected node up events (it isn't guaranteed that 3s is long enough to wait).

Comment thread p2p/simulations/mocker_test.go Outdated
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.

Check the status of the returned HTTP response.

Comment thread p2p/simulations/mocker_test.go Outdated
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.

Check the status of the returned HTTP response.

Comment thread p2p/simulations/mocker_test.go Outdated
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.

This should be in a defer right after starting the network so it is stopped if the test fails.

Comment thread p2p/simulations/network.go Outdated
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.

Just re-initialize the two maps.

@fjl
Copy link
Copy Markdown
Contributor

fjl commented Dec 11, 2017

Rebased, lint issues fixed.

@fjl fjl changed the title P2p simulation mocker p2p/simulations: add mocker functionality Dec 11, 2017
Copy link
Copy Markdown
Contributor

@cobordism cobordism left a comment

Choose a reason for hiding this comment

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

re-approved after rebase

@fjl fjl merged commit fd777bb into ethereum:master Dec 12, 2017
@karalabe karalabe added this to the 1.8.0 milestone Dec 14, 2017
b00ris pushed a commit to b00ris/go-ethereum that referenced this pull request Jan 19, 2018
This commit adds mocker functionality to p2p/simulations. A
mocker allows to starting/stopping of nodes via the HTTP API.
mariameda pushed a commit to NiluPlatform/go-nilu that referenced this pull request Aug 23, 2018
This commit adds mocker functionality to p2p/simulations. A
mocker allows to starting/stopping of nodes via the HTTP API.
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.

6 participants