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

functional-tester: move checker logic to cluster #6666

Merged
merged 1 commit into from
Oct 18, 2016

Conversation

fanminshi
Copy link
Member

I move the checker logic from tester to cluster so that stressers and checkers can be initialized at the same time.
this is useful because some checker depends on stressers.

}

func newHashChecker(tt *tester) Checker { return &hashChecker{tt} }
func newHashChecker(c *cluster) Checker { return &hashChecker{hashAndRevGetter(c)} }
Copy link
Contributor

Choose a reason for hiding this comment

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

change this to newHashChecker(hrg hashAndRevGetter) convert cluster to hrg outside the new func. it is cleaner.


func (hc *hashChecker) Check() (err error) {
plog.Printf("%s fetching current revisions...", hc.tt.logPrefix())
Copy link
Contributor

Choose a reason for hiding this comment

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

@gyuho do we still want this log prefix thing?

Members []*member

stressBuilder stressBuilder
agents []agentConfig
Copy link
Contributor

Choose a reason for hiding this comment

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

still keep the empty space between different fields sections?

@xiang90
Copy link
Contributor

xiang90 commented Oct 18, 2016

LGTM. defer to @gyuho

@@ -24,14 +24,18 @@ type Checker interface {
Check() error
}

type hashAndRevGetter interface {
getRevisionHash() (map[string]int64, map[string]int64, error)
Copy link
Contributor

Choose a reason for hiding this comment

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

probably name the returned stuff.

@@ -109,6 +101,12 @@ func (c *cluster) bootstrap() error {
go c.Stressers[i].Stress()
}

if c.consistencyCheck && !c.v2Only {
c.Checker = newHashChecker(c)
Copy link
Contributor

Choose a reason for hiding this comment

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

newHashChecker(hashAndRevGetter(c)) so you know that you do not give the hashchecker access to all methods on cluster.

Copy link
Member Author

Choose a reason for hiding this comment

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

got it

I move the checker logic from tester to cluster so that stressers and checkers can be initialized at the same time.
this is useful because some checker depends on stressers.
@fanminshi fanminshi force-pushed the function-tester-refractor branch from f3b4344 to 7d86d10 Compare October 18, 2016 18:17
@fanminshi
Copy link
Member Author

All fixed. PTAL @xiang90 @gyuho

@gyuho
Copy link
Contributor

gyuho commented Oct 18, 2016

lgtm. thanks!

@fanminshi fanminshi merged commit ed75d93 into etcd-io:master Oct 18, 2016
@fanminshi fanminshi deleted the function-tester-refractor branch October 20, 2016 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants