mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
@@ -1,7 +1,7 @@
|
||||
language: go
|
||||
go:
|
||||
- 1.9.x
|
||||
- 1.10.x
|
||||
- 1.9.6
|
||||
- 1.10.2
|
||||
install:
|
||||
- go get github.com/nats-io/go-nats
|
||||
- go get github.com/mattn/goveralls
|
||||
|
||||
@@ -122,6 +122,14 @@ func (s *Server) checkAuthorization(c *client) bool {
|
||||
}
|
||||
}
|
||||
|
||||
// hasUsers leyt's us know if we have a users array.
|
||||
func (s *Server) hasUsers() bool {
|
||||
s.mu.Lock()
|
||||
hu := s.users != nil
|
||||
s.mu.Unlock()
|
||||
return hu
|
||||
}
|
||||
|
||||
// isClientAuthorized will check the client against the proper authorization method and data.
|
||||
// This could be token or username/password based.
|
||||
func (s *Server) isClientAuthorized(c *client) bool {
|
||||
@@ -131,7 +139,7 @@ func (s *Server) isClientAuthorized(c *client) bool {
|
||||
// Check custom auth first, then multiple users, then token, then single user/pass.
|
||||
if opts.CustomClientAuthentication != nil {
|
||||
return opts.CustomClientAuthentication.Check(c)
|
||||
} else if s.users != nil {
|
||||
} else if s.hasUsers() {
|
||||
user, ok := s.users[c.opts.Username]
|
||||
if !ok {
|
||||
return false
|
||||
|
||||
@@ -943,7 +943,7 @@ func TestRoutedQueueAutoUnsubscribe(t *testing.T) {
|
||||
c.Flush()
|
||||
}
|
||||
|
||||
wait := time.Now().Add(5 * time.Second)
|
||||
wait := time.Now().Add(10 * time.Second)
|
||||
for time.Now().Before(wait) {
|
||||
nbar := atomic.LoadInt32(&rbar)
|
||||
nbaz := atomic.LoadInt32(&rbaz)
|
||||
@@ -962,7 +962,7 @@ func TestRoutedQueueAutoUnsubscribe(t *testing.T) {
|
||||
}
|
||||
return
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
t.Fatalf("Did not receive all %d queue messages, received %d for 'bar' and %d for 'baz'\n",
|
||||
expected, atomic.LoadInt32(&rbar), atomic.LoadInt32(&rbaz))
|
||||
|
||||
@@ -515,23 +515,9 @@ func TestRouteFormTimeWithHighSubscriptions(t *testing.T) {
|
||||
checkClusterFormed(t, srvA, srvB)
|
||||
|
||||
// Now wait for all subscriptions to be processed.
|
||||
|
||||
if err := checkExpectedSubs(subsTotal, srvB); err != nil {
|
||||
t.Fatalf("%v", err)
|
||||
}
|
||||
|
||||
/*
|
||||
maxTime := time.Now().Add(5 * time.Second)
|
||||
for time.Now().Before(maxTime) {
|
||||
if srvB.NumSubscriptions() == subsTotal {
|
||||
break
|
||||
}
|
||||
time.Sleep(10 * time.Millisecond)
|
||||
}
|
||||
if srvB.NumSubscriptions() != subsTotal {
|
||||
t.Fatalf("srvB did not receive all subscriptions in allocated time: %d",
|
||||
srvB.NumSubscriptions())
|
||||
}
|
||||
*/
|
||||
fmt.Printf("Cluster formed after %v\n", time.Since(now))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user