-
Notifications
You must be signed in to change notification settings - Fork 177
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
Add foundation for E2E Tests + First E2E Scenario: Register Orchestrator #2383
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2383 +/- ##
===================================================
+ Coverage 54.50763% 54.98627% +0.47863%
===================================================
Files 93 93
Lines 19467 19303 -164
===================================================
+ Hits 10611 10614 +3
+ Misses 8267 8100 -167
Partials 589 589
Continue to review full report at Codecov.
|
test/e2e/e2e.go
Outdated
ContainerRequest: req, | ||
Started: true, | ||
}) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can trim the code down a bit with require.NoError(t, err)
rather than this conditional pattern
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6064454
If the devtool_utils are only going to be used in the tests then could we move them over to some more specific files/packages within the E2E code? |
Not specific to this PR, but we should look at moving the M1 image to a livepeer-owned repo |
I tried running the tests (M1 MacOS. I updated the image name to the darkdragon one) and it seems to hang after this point:
After a while, it eventually errors:
|
It's actually not only used in tests, but also in the |
There is a dedicated GH Issue which will address this one: #2316 |
Right, I had the same. And the reason of that is that I rebased to master and there was a bug in master 😱 And for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review @thomshutt
I addressed your comments. PTAL
test/e2e/e2e.go
Outdated
ContainerRequest: req, | ||
Started: true, | ||
}) | ||
if err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 6064454
"amount": {fmt.Sprintf("%d", lptStake)}, | ||
} | ||
|
||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this infinitely loop in the case where there's something wrong with the activation endpoint?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point! Yes, we actually don't use any timeouts in any tests. The full/complete solution we can consider at some point is to use context everywhere with the proper timeout. Saying that it'd slightly complicate the code. I think that for now it's good enough to add -timeout
to go test
. Added here: 6acddeb
func (d *Devtool) InitializeRound() error { | ||
// XXX TODO curl -X "POST" http://localhost:$transcoderCliPort/initializeRound | ||
time.Sleep(7 * time.Second) | ||
for { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, should we have a timeout?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above ⬆️
tx, err := d.Client.InitializeRound() | ||
// ErrRoundInitialized | ||
if err != nil { | ||
if err.Error() != "ErrRoundInitialized" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to handle the case where err != nil
but it's not this type of error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, if the error is "ErrRoundInitialized"
, then no problem. We don't need to initialize it, because it's already initialized (potentially by someone else).
Saying that, in devtool_util.go
, there are a lot of places which could be improved in terms of the code quality, but I don't want to do it this PR. Maybe we can send some following PR, just with the refactoring.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad, I'd read err.Error() != "ErrRoundInitialized"
as err.Error() == "ErrRoundInitialized"
Overall looks great, really nice and neat - I played around with making the test fail and added another (duplicate) test to try and check there weren't any race conditions around setup and teardown etc. Some general thoughts for the future:
|
Thanks for the review!
I think we should convert it to Cucumber (should be quick), send a PR and discuss if we like it more than pure Golang tests.
Yes, we can consider it. TBH I'd start without it, because producing log files also have drawbacks. Maybe let's check in practice if that's really an issue.
Yes, good idea. Let's wait until we have more E2E Test scenarios and then we can decide if we should run multiple tests (and if yes, then which tests) using the same started Orchestrator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thomshutt Addressed your comments. PTAL.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well Done!
ready := make(chan struct{}) | ||
go func() { | ||
statusEndpoint := fmt.Sprintf("http://%s/status", *lpCfg.CliAddr) | ||
var statusCode int | ||
for statusCode != 200 { | ||
time.Sleep(200 * time.Millisecond) | ||
resp, err := http.Get(statusEndpoint) | ||
if err == nil { | ||
statusCode = resp.StatusCode | ||
} | ||
} | ||
ready <- struct{}{} | ||
}() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome! I was wondering how to get a signal when node is ready.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, also for the context, this is probably good enough for E2E Tests, but we plan to add better health checks to Livepeer:
6acddeb
to
e34e65f
Compare
e34e65f
to
fa4bdbc
Compare
What does this pull request do? Explain your changes. (required)
Create first E2E Scenario which registers an orchestrator using local chain.
How to run the test:
Image
ine2e.go
todarkdragon/geth-with-livepeer-protocol:streamflow
./test_e2e.sh
For more details about next steps, please check E2E Tests Epic
Specific updates (required)
devtool
package fromdevtool.go
to make the devtool code reusablestarter
package fromlivepeer.go
to make the livepeer code reusablee2e.go
with the reusable utils for E2E Testsregister_orchestrator_test.go
with the first E2E Test scenariotest.sh
/test_e2e.sh
How did you test each of these updates (required)
./test-e2e.sh
Does this pull request close any open issues?
fix #2317
Checklist:
make
runs successfully./test.sh
passREADME and other documentation updated