Skip to content

Commit

Permalink
all: resolve failing test and data race (#501)
Browse files Browse the repository at this point in the history
  • Loading branch information
arekkas authored Jun 14, 2017
1 parent fa46dbd commit ab573c8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ func TestExecute(t *testing.T) {
var osArgs = make([]string, len(os.Args))
var path = filepath.Join(os.TempDir(), fmt.Sprintf("hydra-%s.yml", uuid.New()))
os.Setenv("DATABASE_URL", "memory")
os.Setenv("FORCE_ROOT_CLIENT_CREDENTIALS", "admin:pw")
copy(osArgs, os.Args)

for _, c := range []struct {
Expand All @@ -32,10 +33,13 @@ func TestExecute(t *testing.T) {
_, err := os.Stat(path)
if err != nil {
t.Logf("Could not stat path %s because %s", path, err)
} else {
time.Sleep(time.Second * 5)
}
return err != nil
},
},
{args: []string{"connect", "--id", "admin", "--secret", "pw", "--url", "https://127.0.0.1:4444/"}},
{args: []string{"clients", "create", "--id", "foobarbaz"}},
{args: []string{"clients", "create", "--id", "public-foo", "--is-public"}},
{args: []string{"clients", "delete", "foobarbaz"}},
Expand Down
4 changes: 2 additions & 2 deletions health/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (h *Handler) SetRoutes(r *httprouter.Router) {
func (h *Handler) Health(rw http.ResponseWriter, r *http.Request, _ httprouter.Params) {
h.Metrics.Update()

h.Metrics.RLock()
defer h.Metrics.RUnlock()
h.Metrics.Lock()
defer h.Metrics.Unlock()
h.H.Write(rw, r, h.Metrics)
}

0 comments on commit ab573c8

Please sign in to comment.