1- /*
21import {
32 before ,
43 after ,
54 defaultCluster as servers ,
65 waitForConsistentState ,
7- wait,
86 addNodeToDefaultCluster ,
97} from "@cocalc/backend/conat/test/setup" ;
108import { STICKY_QUEUE_GROUP } from "@cocalc/conat/core/client" ;
@@ -47,9 +45,6 @@ describe("ensure sticky state sync and use is working properly", () => {
4745 ) ;
4846 // publishing causes a choice to be made and saved on servers[0]
4947 await clients [ 0 ] . publish ( `subject.${ i } .foo` , "hello" ) ;
50- expect(servers[0].sticky[`subject.${i}.*`]).not.toBe(undefined);
51- // but no choice on servers[1]
52- expect(servers[1].sticky[`subject.${i}.*`]).toBe(undefined);
5348 }
5449 } ) ;
5550
@@ -66,51 +61,12 @@ describe("ensure sticky state sync and use is working properly", () => {
6661 chosen = await Promise . race ( [ p0 ( ) , p1 ( ) ] ) ;
6762 } ) ;
6863
69- it(`sticky on servers[0] should have ${count} entries starting in "subject".`, async () => {
70- const v = Object.keys(servers[0].sticky).filter((s) =>
71- s.startsWith("subject."),
72- );
73- expect(v.length).toBe(count);
74- });
75-
76- it(`sticky on servers[1] should have no entries starting in "subject".`, async () => {
77- const v = Object.keys(servers[1].sticky).filter((s) =>
78- s.startsWith("subject."),
79- );
80- expect(v.length).toBe(0);
81- });
82-
83- it(`servers[1]'s link to servers[0] should *eventually* have ${count} entries starting in "subject."`, async () => {
84- // @ts -ignore
85- const link = servers[1].clusterLinksByAddress[servers[0].address()];
86- let v;
87- await wait({
88- until: () => {
89- v = Object.keys(link.sticky).filter((s) => s.startsWith("subject."));
90- return v.length == count;
91- },
92- });
93- expect(v.length).toBe(count);
94- });
95-
9664 it ( "send message from clients[1] to each subject" , async ( ) => {
9765 for ( let i = 0 ; i < count ; i ++ ) {
9866 await clients [ 1 ] . publish ( `subject.${ i } .foo` ) ;
9967 }
10068 } ) ;
10169
102- // Sometimes this fails under very heavy load.
103- // It's not a good test, because it probably hits some timeouts sometimes, and
104- // it is testing internal structure/optimizations, not behavior.
105- // Note also that minimizing sticky state computation is just an optimization so even if this test were failing
106- // due to a bug, it might just mean things are slightly slower.
107- // it(`sticky on servers[1] should STILL have no entries starting in "subject", since no choices had to be made`, async () => {
108- // const v = Object.keys(servers[1].sticky).filter((s) =>
109- // s.startsWith("subject."),
110- // );
111- // expect(v.length).toBe(0);
112- // });
113-
11470 async function deliveryTest ( ) {
11571 const sub = chosen == 0 ? subs0 [ 0 ] : subs1 [ 0 ] ;
11672
@@ -155,17 +111,6 @@ describe("ensure sticky state sync and use is working properly", () => {
155111 await waitForConsistentState ( servers ) ;
156112 } ) ;
157113
158- it("double check the links have the sticky state", () => {
159- for (const server of servers.slice(1)) {
160- // @ts -ignore
161- const link = server.clusterLinksByAddress[servers[0].address()];
162- const v = Object.keys(link.sticky).filter((s) =>
163- s.startsWith("subject."),
164- );
165- expect(v.length).toBe(count);
166- }
167- });
168-
169114 it (
170115 "in bigger, cluster, publish from every node to subject.0.foo" ,
171116 deliveryTest ,
@@ -181,15 +126,6 @@ describe("ensure sticky state sync and use is working properly", () => {
181126 }
182127 sub . close ( ) ;
183128 } ) ;
184-
185- it("unjoining servers[0] from servers[1] should transfer the sticky state to servers[1]", async () => {
186- await servers[1].unjoin({ address: servers[0].address() });
187- const v = Object.keys(servers[1].sticky).filter((s) =>
188- s.startsWith("subject."),
189- );
190- expect(v.length).toBe(count);
191- });
192129} ) ;
193130
194131afterAll ( after ) ;
195- */
0 commit comments