mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Fix flappers
- TestResponsePermissions: ensure subscription for service is registered by server before sending requests. - TestReloadDoesNotWipeAccountsWithOperatorMode: wait for subject propagation. Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
This commit is contained in:
@@ -381,6 +381,7 @@ func TestReloadDoesNotWipeAccountsWithOperatorMode(t *testing.T) {
|
||||
|
||||
// Use this to check for message.
|
||||
checkForMsg := func() {
|
||||
t.Helper()
|
||||
select {
|
||||
case <-ch:
|
||||
case <-time.After(2 * time.Second):
|
||||
@@ -388,6 +389,9 @@ func TestReloadDoesNotWipeAccountsWithOperatorMode(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// Wait for "foo" interest to be propagated to s2's account `accPub`
|
||||
checkSubInterest(t, s2, accPub, "foo", 2*time.Second)
|
||||
|
||||
// Create second client and send message from this one. Interest should be here.
|
||||
url2 := fmt.Sprintf("nats://%s:%d/", opts2.Host, opts2.Port)
|
||||
nc2, err := nats.Connect(url2, createUserCreds(t, s2, accKP))
|
||||
@@ -423,6 +427,8 @@ func TestReloadDoesNotWipeAccountsWithOperatorMode(t *testing.T) {
|
||||
|
||||
checkClusterFormed(t, s, s2)
|
||||
|
||||
checkSubInterest(t, s2, accPub, "foo", 2*time.Second)
|
||||
|
||||
// Reconnect and make sure this works. If accounts blown away this will fail.
|
||||
url2 = fmt.Sprintf("nats://%s:%d/", opts2.Host, opts2.Port)
|
||||
nc2, err = nats.Connect(url2, createUserCreds(t, s2, accKP))
|
||||
|
||||
Reference in New Issue
Block a user