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

Test improvements #814

Merged
merged 28 commits into from
Sep 28, 2021
Merged

Test improvements #814

merged 28 commits into from
Sep 28, 2021

Conversation

emmanuelm41
Copy link
Contributor

In the PR, test improvements where applied. A list of them is write below:

  • Renaming was applied to improve test readability
  • Use Ping control message to get drand status. We use that data to remove sleeps on tests
  • Remove sleeps on some tests

@@ -468,7 +468,7 @@ func TestBeaconSimple(t *testing.T) {
bt.nodes[i].handler.Lock()
started := bt.nodes[i].handler.started
bt.nodes[i].handler.Unlock()
require.False(t, started, "handler %d has started?", i)
require.True(t, started, "handler %d has started?", i)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Im not 100% sure anymore but I think this test was to make sure none started before genesis time - here it should not have started since genesis is at "now() + 2s" and current time is only "now() + 1s". What am i missing ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked every piece of code looking for the started var. I could not find any place where that var is set to true. I made a change to set it to true when calling the function StartBeacon().

core/drand_control.go Outdated Show resolved Hide resolved
core/drand_control.go Show resolved Hide resolved
core/drand_test.go Outdated Show resolved Hide resolved
core/drand_test.go Outdated Show resolved Hide resolved
core/drand_test.go Show resolved Hide resolved
core/drand_test.go Show resolved Hide resolved
gp, err := controlClient.InitDKGLeader(d.n, d.thr, d.period, d.catchupPeriod, testDkgTimeout, nil, secret, testBeaconOffset)
d.t.Log("[RunDKG] Leader init")

// TODO: Control Client needs every single parameter, not a protobuf type. This means that it will be difficult to extend
Copy link
Collaborator

Choose a reason for hiding this comment

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

Well actually there is the control client struct which is only a wrapper around the protobuf - we could use directly here the protobuf and send it via the generic client.

core/util_test.go Outdated Show resolved Hide resolved
@nikkolasg
Copy link
Collaborator

nikkolasg commented Sep 23, 2021 via email

@emmanuelm41
Copy link
Contributor Author

Ok but nonetheless in this part of the test the beacon should NOT have started I believe, do you agree ? It should only be from genesis time that this variable is set to true no?

I think we should create a new flag to indicates the beacon is running or not. I have created three flags: started, running and stopped. I want to detect when I gave the order to start, but it is still not running as the genesis time has not passed. Please check the last commit!

@emmanuelm41
Copy link
Contributor Author

Some notes about CI:

  • I am not sure what is happening with lint CI job. It is not being run correctly.
  • I tried to install exactly the same protobuf, proto-go and proto-go-grpc version use on CI, but the outcome is not the same. That is why the job is failing.

Copy link
Collaborator

@nikkolasg nikkolasg left a comment

Choose a reason for hiding this comment

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

LGTM

@yiannisbot yiannisbot merged commit b4378a5 into drand:master Sep 28, 2021
@emmanuelm41 emmanuelm41 deleted the test-improvements branch September 28, 2021 15:31
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.

None yet

4 participants