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

e2e: etcdctl test for proxy no-sync #4330

Merged
merged 1 commit into from
Jan 29, 2016
Merged

e2e: etcdctl test for proxy no-sync #4330

merged 1 commit into from
Jan 29, 2016

Conversation

gyuho
Copy link
Contributor

@gyuho gyuho commented Jan 28, 2016

For #3894.

@gyuho gyuho changed the title e2e: etcdctl test for proxy no-sync [wip] e2e: etcdctl test for proxy no-sync Jan 28, 2016
@gyuho gyuho force-pushed the proxy_e2e branch 3 times, most recently from 8197ae7 to a4660e7 Compare January 28, 2016 22:51
@gyuho gyuho changed the title [wip] e2e: etcdctl test for proxy no-sync e2e: etcdctl test for proxy no-sync Jan 28, 2016
@gyuho
Copy link
Contributor Author

gyuho commented Jan 28, 2016

/cc @heyitsanthony @xiang90 Please review. This only test #3894 but I can add more etcdctl operations later.

}
defer func() {
if errC := epc.Close(); errC != nil {
if !strings.Contains(errC.Error(), "os: process already finished") {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is not needed. Will remove.

@@ -305,3 +330,91 @@ func spawnWithExpect(args []string, expected string) error {
}
return proc.Close()
}

func TestBasicOpsV2CtlWatchWithProxy(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

move the etcdctl stuff to etcdctl_test.go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure.

@gyuho
Copy link
Contributor Author

gyuho commented Jan 28, 2016

@heyitsanthony Just moved to etcdctl_test.go. PTAL. Thanks,

}()

endpoint, be := "", ""
for _, p := range epc.procs {
Copy link
Contributor

Choose a reason for hiding this comment

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

probably worth extending etcdProcessCluster so it's possible to do this instead of the confusing loop thing:

if proxies := epc.Proxies(); len(proxies) != 0 {
endpoint = proxies[0].cfg.acurl.String()
} else if backends := epc.Backends(); len(backends) != 0 {
endpoint = backends[0].cfg.acurl.String()
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok good idea. Will try that. Thanks

@heyitsanthony
Copy link
Contributor

lgtm aside from comments

@gyuho gyuho force-pushed the proxy_e2e branch 2 times, most recently from 4ca02a7 to c700ff7 Compare January 28, 2016 23:53
@gyuho
Copy link
Contributor Author

gyuho commented Jan 28, 2016

@heyitsanthony Just updated. Thanks!

@@ -289,6 +313,27 @@ func (epc *etcdProcessCluster) Close() (err error) {
return err
}

// proxies returns only the proxy etcdProcess.
func (epc *etcdProcessCluster) proxies() []*etcdProcess {
Copy link
Contributor

Choose a reason for hiding this comment

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

return epc.procs[epc.cfg.clusterSize:]

return spawnWithExpect(putArgs, value)
}

func etcdctlWatch(epc *etcdProcessCluster, key, value string, noSync bool, done chan struct{}, errChan chan error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this only needs errChan since donec <- struct{}{} can be replaced with errChan <- nil

Copy link
Contributor

Choose a reason for hiding this comment

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

up to you if you think it's worth doing this one

@gyuho
Copy link
Contributor Author

gyuho commented Jan 29, 2016

Just updated with leaky goroutine checks added.

@heyitsanthony
Copy link
Contributor

lgtm

@gyuho
Copy link
Contributor Author

gyuho commented Jan 29, 2016

Thanks. Will merge after green lights.

gyuho added a commit that referenced this pull request Jan 29, 2016
e2e: etcdctl test for proxy no-sync
@gyuho gyuho merged commit 7b8cd27 into etcd-io:master Jan 29, 2016
@gyuho gyuho deleted the proxy_e2e branch January 29, 2016 05:38
@gyuho gyuho mentioned this pull request Jan 29, 2016
6 tasks
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.

None yet

2 participants