git.iko.soy/typeable/oauth2-proxy
on master help sign in
Ensure watcher tests don't block during shutdown
5f2df71Mike Bland
validator_test.go+7−1
@@ -10,6 +10,7 @@ import (
10type ValidatorTest struct {
10type ValidatorTest struct {
11 auth_email_file *os.File
11 auth_email_file *os.File
12 done chan bool
12 done chan bool
13+ update_seen bool
13}
14}
14
15
15func NewValidatorTest(t *testing.T) *ValidatorTest {
16func NewValidatorTest(t *testing.T) *ValidatorTest {
@@ -31,7 +32,12 @@ func (vt *ValidatorTest) TearDown() {
31func (vt *ValidatorTest) NewValidator(domains []string,
32func (vt *ValidatorTest) NewValidator(domains []string,
32 updated chan<- bool) func(string) bool {
33 updated chan<- bool) func(string) bool {
33 return newValidatorImpl(domains, vt.auth_email_file.Name(),
34 return newValidatorImpl(domains, vt.auth_email_file.Name(),
35+ vt.done, func() {
36+ if vt.update_seen == false {
34− vt.done, func() { updated <- true })
37+ updated <- true
38+ vt.update_seen = true
39+ }
40+ })
35}
41}
36
42
37// This will close vt.auth_email_file.
43// This will close vt.auth_email_file.