11import { wait } from 'streamr-test-utils'
22import { MessageLayer } from 'streamr-client-protocol'
33
4- import { fakePrivateKey , uid , Msg , getPublishTestMessages } from '../utils'
4+ import { describeRepeats , fakePrivateKey , uid , Msg , getPublishTestMessages } from '../utils'
55import { Defer } from '../../src/utils'
66import { StreamrClient } from '../../src/StreamrClient'
77import { GroupKey } from '../../src/stream/Encryption'
@@ -10,11 +10,11 @@ import { StorageNode } from '../../src/stream/StorageNode'
1010
1111import config from './config'
1212
13- const TIMEOUT = 30 * 1000
13+ const TIMEOUT = 10 * 1000
1414
1515const { StreamMessage } = MessageLayer
1616
17- describe ( 'decryption' , ( ) => {
17+ describeRepeats ( 'decryption' , ( ) => {
1818 let publishTestMessages
1919 let expectErrors = 0 // check no errors by default
2020 let errors = [ ]
@@ -178,7 +178,7 @@ describe('decryption', () => {
178178 await onEncryptionMessageErr
179179 // All good, unsubscribe
180180 await client . unsubscribe ( sub )
181- } , 2 * TIMEOUT )
181+ } , TIMEOUT )
182182
183183 it ( 'changing group key injects group key into next stream message' , async ( ) => {
184184 const done = Defer ( )
@@ -242,7 +242,7 @@ describe('decryption', () => {
242242 await onEncryptionMessageErr
243243 // All good, unsubscribe
244244 await client . unsubscribe ( sub )
245- } , 2 * TIMEOUT )
245+ } , TIMEOUT )
246246
247247 it ( 'errors if rotating group key for no stream' , async ( ) => {
248248 expect ( async ( ) => (
@@ -306,7 +306,7 @@ describe('decryption', () => {
306306 await otherClient . logout ( )
307307 }
308308 }
309- } , 2 * TIMEOUT )
309+ } , TIMEOUT )
310310
311311 it ( 'does not encrypt messages in stream without groupkey' , async ( ) => {
312312 const name = uid ( 'stream' )
@@ -379,7 +379,7 @@ describe('decryption', () => {
379379 onEncryptionMessageErr . resolve ( ) // will be ignored if errored
380380 await onEncryptionMessageErr
381381 expect ( didFindStream2 ) . toBeTruthy ( )
382- } , 2 * TIMEOUT )
382+ } , TIMEOUT )
383383
384384 it ( 'sets group key per-stream' , async ( ) => {
385385 const name = uid ( 'stream' )
@@ -452,7 +452,7 @@ describe('decryption', () => {
452452 ] )
453453 onEncryptionMessageErr . resolve ( ) // will be ignored if errored
454454 await onEncryptionMessageErr
455- } , 2 * TIMEOUT )
455+ } , TIMEOUT )
456456
457457 it ( 'client.subscribe can get the group key and decrypt multiple encrypted messages using an RSA key pair' , async ( ) => {
458458 // subscribe without knowing the group key to decrypt stream messages
@@ -476,7 +476,7 @@ describe('decryption', () => {
476476
477477 // All good, unsubscribe
478478 await client . unsubscribe ( sub )
479- } , 2 * TIMEOUT )
479+ } , TIMEOUT )
480480
481481 it ( 'subscribe with changing group key' , async ( ) => {
482482 // subscribe without knowing the group key to decrypt stream messages
@@ -502,7 +502,7 @@ describe('decryption', () => {
502502
503503 // All good, unsubscribe
504504 await client . unsubscribe ( sub )
505- } , 2 * TIMEOUT )
505+ } , TIMEOUT )
506506
507507 it ( 'client.resend last can get the historical keys for previous encrypted messages' , async ( ) => {
508508 // Publish encrypted messages with different keys
@@ -525,7 +525,7 @@ describe('decryption', () => {
525525
526526 expect ( received ) . toEqual ( published . slice ( - 2 ) )
527527 await client . unsubscribe ( sub )
528- } , 2 * TIMEOUT )
528+ } , TIMEOUT )
529529
530530 it ( 'client.subscribe with resend last can get the historical keys for previous encrypted messages' , async ( ) => {
531531 // Publish encrypted messages with different keys
@@ -554,7 +554,7 @@ describe('decryption', () => {
554554
555555 expect ( received ) . toEqual ( published . slice ( - 2 ) )
556556 await client . unsubscribe ( sub )
557- } , 2 * TIMEOUT )
557+ } , TIMEOUT )
558558
559559 it ( 'fails gracefully if cannot decrypt' , async ( ) => {
560560 const MAX_MESSAGES = 10
0 commit comments