diff --git a/server/configs/srv_a_bcrypt.conf b/server/configs/srv_a_bcrypt.conf index 2de4622c..c5c52fcf 100644 --- a/server/configs/srv_a_bcrypt.conf +++ b/server/configs/srv_a_bcrypt.conf @@ -16,7 +16,7 @@ cluster { authorization { user: ruser # bcrypt version of 'bar' - password: $2a$11$lnaSz3ya7RQ3QK9T9pBPyen1WRLz4QGLu6mI3kC701NUWcBO0bml6 + password: $2a$10$LoRPzN3GtF2pNX5QgCBBHeUr6/zVN./RVGOu5U8SpHyg2sfzvfXji timeout: 2 } diff --git a/server/configs/srv_b_bcrypt.conf b/server/configs/srv_b_bcrypt.conf index c1bbd947..4d2b534e 100644 --- a/server/configs/srv_b_bcrypt.conf +++ b/server/configs/srv_b_bcrypt.conf @@ -16,7 +16,7 @@ cluster { authorization { user: ruser # bcrypt version of 'bar' - password: $2a$11$lnaSz3ya7RQ3QK9T9pBPyen1WRLz4QGLu6mI3kC701NUWcBO0bml6 + password: $2a$10$LoRPzN3GtF2pNX5QgCBBHeUr6/zVN./RVGOu5U8SpHyg2sfzvfXji timeout: 2 } diff --git a/server/routes_test.go b/server/routes_test.go index 5fbe5117..343f640c 100644 --- a/server/routes_test.go +++ b/server/routes_test.go @@ -97,8 +97,11 @@ func TestServerRoutesWithAuthAndBCrypt(t *testing.T) { optsA, _ := ProcessConfigFile("./configs/srv_a_bcrypt.conf") optsB, _ := ProcessConfigFile("./configs/srv_b_bcrypt.conf") - optsA.NoSigs, optsA.NoLog = true, true - optsB.NoSigs, optsB.NoLog = true, true + optsA.NoSigs, optsA.NoLog = true, false + optsB.NoSigs, optsB.NoLog = true, false + + optsA.Debug, optsA.Trace = true, true + optsB.Debug, optsB.Trace = true, true srvA := RunServer(optsA) defer srvA.Shutdown() @@ -106,11 +109,11 @@ func TestServerRoutesWithAuthAndBCrypt(t *testing.T) { srvB := RunServer(optsB) defer srvB.Shutdown() - urlA := fmt.Sprintf("nats://%s:%d/", optsA.Host, optsA.Port) - urlB := fmt.Sprintf("nats://%s:%d/", optsB.Host, optsB.Port) + urlA := fmt.Sprintf("nats://%s:%s@%s:%d/", optsA.Username, optsA.Password, optsA.Host, optsA.Port) + urlB := fmt.Sprintf("nats://%s:%s@%s:%d/", optsB.Username, optsB.Password, optsB.Host, optsB.Port) // Wait for route to form. - time.Sleep(250 * time.Millisecond) + time.Sleep(1 * time.Second) nc1, err := nats.Connect(urlA) if err != nil { @@ -120,7 +123,10 @@ func TestServerRoutesWithAuthAndBCrypt(t *testing.T) { // Test that we are connected. ch := make(chan bool) - sub, _ := nc1.Subscribe("foo", func(m *nats.Msg) { ch <- true }) + sub, err := nc1.Subscribe("foo", func(m *nats.Msg) { ch <- true }) + if err != nil { + t.Fatalf("Error creating subscription: %v\n", err) + } nc1.Flush() defer sub.Unsubscribe() @@ -130,6 +136,7 @@ func TestServerRoutesWithAuthAndBCrypt(t *testing.T) { } defer nc2.Close() nc2.Publish("foo", []byte("Hello")) + nc2.Flush() // Wait for message select {