@@ -10,11 +10,11 @@ describe("Super Stream", () => {
1010 const rabbit = new Rabbit ( username , password )
1111 const streamName = `test-stream-${ randomUUID ( ) } `
1212 const payload = {
13- "x- queue-leader-locator" : "test" ,
14- "x- max-age" : "test " ,
15- "x- stream-max-segment-size-bytes" : 42 ,
16- "x- initial-cluster-size" : 42 ,
17- "x- max-length-bytes" : 42 ,
13+ "queue-leader-locator" : "random" as const ,
14+ "max-age" : "120s " ,
15+ "stream-max-segment-size-bytes" : 1000 ,
16+ "initial-cluster-size" : 5 ,
17+ "max-length-bytes" : 20000 ,
1818 }
1919 let client : Client
2020
@@ -47,6 +47,27 @@ describe("Super Stream", () => {
4747 expect ( result . map ( ( r ) => r . name ) ) . to . have . members ( Array . from ( Array ( 3 ) . keys ( ) ) . map ( ( n ) => `${ streamName } -${ n } ` ) )
4848 } )
4949
50+ it ( "Should create a new Super Stream with 3 partitions by default with the given arguments" , async ( ) => {
51+ const resp = await client . createSuperStream ( { streamName, arguments : payload } )
52+
53+ expect ( resp ) . to . be . true
54+ const result = await rabbit . getSuperStreamQueues ( "%2F" , streamName )
55+ expect ( result . map ( ( r ) => r . name ) ) . to . have . members ( Array . from ( Array ( 3 ) . keys ( ) ) . map ( ( n ) => `${ streamName } -${ n } ` ) )
56+ await Promise . all (
57+ Array . from ( Array ( 3 ) . keys ( ) ) . map ( async ( n ) => {
58+ const queue = await rabbit . getQueueInfo ( `${ streamName } -${ n } ` )
59+ expect ( queue . arguments ) . to . be . eql ( {
60+ "x-queue-type" : "stream" ,
61+ "x-queue-leader-locator" : payload [ "queue-leader-locator" ] ,
62+ "x-max-age" : payload [ "max-age" ] ,
63+ "x-stream-max-segment-size-bytes" : payload [ "stream-max-segment-size-bytes" ] ,
64+ "x-initial-cluster-size" : payload [ "initial-cluster-size" ] ,
65+ "x-max-length-bytes" : payload [ "max-length-bytes" ] ,
66+ } )
67+ } )
68+ )
69+ } )
70+
5071 it ( "Should create a new Super Stream with 2 partitions" , async ( ) => {
5172 const resp = await client . createSuperStream ( { streamName, arguments : payload } , undefined , 2 )
5273
0 commit comments