whisper: Integrate Vlad's comments on PR #15165

- Reduce the waiting time, as it should not make a difference except stall the
  tests for longer.
- Verify both message and envelopes on both filters when testing identical
  filters.
This commit is contained in:
Guillaume Ballet 2017-09-28 15:12:14 +02:00
parent d52ab80028
commit 2d0c32149d
2 changed files with 11 additions and 3 deletions

View file

@ -216,6 +216,14 @@ func TestInstallIdenticalFilters(t *testing.T) {
t.Fatalf("failed matching with the first filter") t.Fatalf("failed matching with the first filter")
} }
if ! filter2.MatchEnvelope(env) {
t.Fatalf("failed matching with the first filter")
}
if ! filter1.MatchMessage(msg) {
t.Fatalf("failed matching with the second filter")
}
if ! filter2.MatchMessage(msg) { if ! filter2.MatchMessage(msg) {
t.Fatalf("failed matching with the second filter") t.Fatalf("failed matching with the second filter")
} }

View file

@ -704,7 +704,7 @@ func TestSymmetricSendCycle(t *testing.T) {
} }
// check w.messages() // check w.messages()
time.Sleep(100 * time.Millisecond) time.Sleep(5 * time.Millisecond)
mail1 := filter1.Retrieve() mail1 := filter1.Retrieve()
mail2 := filter2.Retrieve() mail2 := filter2.Retrieve()
if len(mail2) == 0 { if len(mail2) == 0 {
@ -777,7 +777,7 @@ func TestSymmetricSendWithoutAKey(t *testing.T) {
} }
// check w.messages() // check w.messages()
time.Sleep(100 * time.Millisecond) time.Sleep(5 * time.Millisecond)
mail := filter.Retrieve() mail := filter.Retrieve()
if len(mail) == 0 { if len(mail) == 0 {
t.Fatalf("did not receive message in spite of not setting a public key") t.Fatalf("did not receive message in spite of not setting a public key")
@ -843,7 +843,7 @@ func TestSymmetricSendKeyMismatch(t *testing.T) {
} }
// check w.messages() // check w.messages()
time.Sleep(100 * time.Millisecond) time.Sleep(5 * time.Millisecond)
mail := filter.Retrieve() mail := filter.Retrieve()
if len(mail) > 0 { if len(mail) > 0 {
t.Fatalf("received a message when keys weren't matching") t.Fatalf("received a message when keys weren't matching")