Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(660)

Issue 6244060: Allow dummy environs to use zookeeper state

Can't Edit
Can't Publish+Mail
Start Review
Created:
11 years, 11 months ago by fwereade
Modified:
11 years, 11 months ago
Reviewers:
mp+107795
Visibility:
Public.

Description

Allow dummy environs to use zookeeper state As in python, we don't want to have to bring up and tear down a zookeeper server for every test we run against a dummy environment, so this CL provides a mechanism for sharing a single zookeeper across multiple tests against "different" environments. This is done with a SetZookeeper func in the dummy package, which allows the environ's StateInfo method to return a *state.Info pointing at that zookeeper. Assuming the "zookeeper" config setting is set, and "isBroken" is not, Bootstrap will initialize state and Reset will clear it; when "zookeeper" is set to false, it should act entirely as before. https://code.launchpad.net/~fwereade/juju/go-dummy-environ-state/+merge/107795 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 4

Patch Set 2 : Allow dummy environs to use zookeeper state #

Patch Set 3 : Allow dummy environs to use zookeeper state #

Total comments: 7

Patch Set 4 : Allow dummy environs to use zookeeper state #

Unified diffs Side-by-side diffs Delta from patch set Stats (+95 lines, -14 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M environs/config_test.go View 2 chunks +4 lines, -4 lines 0 comments Download
M environs/dummy/environs.go View 1 2 3 7 chunks +52 lines, -3 lines 0 comments Download
M environs/dummy/environs_test.go View 1 2 3 chunks +12 lines, -6 lines 0 comments Download
M environs/open_test.go View 1 chunk +1 line, -1 line 0 comments Download
M testing/zk.go View 1 2 3 1 chunk +24 lines, -0 lines 0 comments Download

Messages

Total messages: 8
fwereade
Please take a look.
11 years, 11 months ago (2012-05-29 14:20:45 UTC) #1
rog
LGTM modulo the below, and a slight glimmer of a feeling that maybe ResetZkServer isn't ...
11 years, 11 months ago (2012-05-29 15:35:40 UTC) #2
niemeyer
https://codereview.appspot.com/6244060/diff/1/environs/dummy/environs.go File environs/dummy/environs.go (right): https://codereview.appspot.com/6244060/diff/1/environs/dummy/environs.go#newcode40 environs/dummy/environs.go:40: func SetZookeeper(srv *zookeeper.Server) { Dummy environments are now named ...
11 years, 11 months ago (2012-05-29 18:16:17 UTC) #3
fwereade
Please take a look. https://codereview.appspot.com/6244060/diff/1/environs/dummy/environs.go File environs/dummy/environs.go (right): https://codereview.appspot.com/6244060/diff/1/environs/dummy/environs.go#newcode40 environs/dummy/environs.go:40: func SetZookeeper(srv *zookeeper.Server) { On ...
11 years, 11 months ago (2012-05-30 08:52:46 UTC) #4
fwereade
Please take a look.
11 years, 11 months ago (2012-05-30 10:18:22 UTC) #5
rog
LGTM https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go File environs/dummy/environs.go (right): https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go#newcode252 environs/dummy/environs.go:252: panic(errors.New("cannot share a zookeeper between two dummy environs")) ...
11 years, 11 months ago (2012-05-30 10:40:39 UTC) #6
niemeyer
LGTM with some details. https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go File environs/dummy/environs.go (right): https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go#newcode48 environs/dummy/environs.go:48: panic(errors.New("SetZookeeper not called")) errors.New not ...
11 years, 11 months ago (2012-05-30 22:49:44 UTC) #7
fwereade
11 years, 11 months ago (2012-05-31 07:37:12 UTC) #8
*** Submitted:

Allow dummy environs to use zookeeper state

As in python, we don't want to have to bring up and tear down a zookeeper
server for every test we run against a dummy environment, so this CL
provides a mechanism for sharing a single zookeeper across multiple tests
against "different" environments.

This is done with a SetZookeeper func in the dummy package, which allows
the environ's StateInfo method to return a *state.Info pointing at that
zookeeper. Assuming the "zookeeper" config setting is set, and "isBroken"
is not, Bootstrap will initialize state and Reset will clear it; when
"zookeeper" is set to false, it should act entirely as before.

R=rog, niemeyer
CC=
https://codereview.appspot.com/6244060

https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go
File environs/dummy/environs.go (right):

https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go#n...
environs/dummy/environs.go:48: panic(errors.New("SetZookeeper not called"))
On 2012/05/30 22:49:44, niemeyer wrote:
> errors.New not needed here too.

Done.

https://codereview.appspot.com/6244060/diff/7001/environs/dummy/environs.go#n...
environs/dummy/environs.go:252: panic(errors.New("cannot share a zookeeper
between two dummy environs"))
On 2012/05/30 10:40:39, rog wrote:
> no particular need for the errors.New here. a string is a legitimate panic
> argument.

Done.

https://codereview.appspot.com/6244060/diff/7001/testing/zk.go
File testing/zk.go (right):

https://codereview.appspot.com/6244060/diff/7001/testing/zk.go#newcode63
testing/zk.go:63: }
On 2012/05/30 22:49:44, niemeyer wrote:
> defer zk.Close()?

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b