Skip to content

Commit 20c585a

Browse files
committed
Use different ports in mocks to avoid node18 issues
1 parent 33f51a2 commit 20c585a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/collections/backup/unit.test.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class CancelMock {
2626
this.http = http;
2727
}
2828

29-
public static use = async (version: string, port: number) => {
29+
public static use = async (version: string, httpPort: number, grpcPort: number) => {
3030
const httpApp = express();
3131
// Meta endpoint required for client instantiation
3232
httpApp.get('/v1/meta', (req, res) => res.send({ version }));
@@ -94,8 +94,10 @@ class CancelMock {
9494
const grpc = createServer();
9595
grpc.add(HealthDefinition, healthMockImpl);
9696

97-
await grpc.listen(`localhost:${port + 1}`);
98-
const http = await httpApp.listen(port);
97+
httpApp.on('error', (error) => console.error('HTTP Server Error:', error));
98+
99+
await grpc.listen(`localhost:${grpcPort}`);
100+
const http = await httpApp.listen(httpPort);
99101
return new CancelMock(grpc, http);
100102
};
101103

@@ -107,8 +109,8 @@ describe('Mock testing of backup cancellation', () => {
107109
let mock: CancelMock;
108110

109111
beforeAll(async () => {
110-
mock = await CancelMock.use('1.27.0', 8954);
111-
client = await weaviate.connectToLocal({ port: 8954, grpcPort: 8955 });
112+
mock = await CancelMock.use('1.27.0', 8958, 8959);
113+
client = await weaviate.connectToLocal({ port: 8958, grpcPort: 8959 });
112114
});
113115

114116
it('should throw while waiting for creation if backup is cancelled in the meantime', async () => {

0 commit comments

Comments
 (0)