Skip to content

Commit 26bc2bb

Browse files
Resolve some minor changes
Signed-off-by: Xavier Geerinck <[email protected]>
1 parent aef619a commit 26bc2bb

File tree

5 files changed

+4
-53
lines changed

5 files changed

+4
-53
lines changed

src/implementation/Server/GRPCServer/GRPCServer.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default class GRPCServer implements IServer {
1717
server: IServerType;
1818
serverImpl: IServerImplType;
1919
serverCredentials: grpc.ServerCredentials;
20-
serverStartupDelay = 1000;
20+
daprSidecarPollingDelayMs = 1000;
2121
client: DaprClient;
2222

2323
constructor(client: DaprClient) {
@@ -82,7 +82,7 @@ export default class GRPCServer implements IServer {
8282
console.log(`[Dapr-JS] Letting Dapr pick-up the server (Maximum 60s wait time)`);
8383
while (!isHealthy) {
8484
console.log(`[Dapr-JS] - Waiting till Dapr Started (#${isHealthyRetryCount})`);
85-
await NodeJSUtils.sleep(this.serverStartupDelay);
85+
await NodeJSUtils.sleep(this.daprSidecarPollingDelayMs);
8686
isHealthy = await this.client.health.isHealthy();
8787
isHealthyRetryCount++;
8888

src/implementation/Server/HTTPServer/HTTPServer.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default class HTTPServer implements IServer {
1818
server: IServerType;
1919
serverAddress: string;
2020
serverImpl: IServerImplType;
21-
serverStartupDelay = 1000;
21+
daprSidecarPollingDelayMs = 1000;
2222
client: DaprClient;
2323

2424
constructor(client: DaprClient) {
@@ -110,7 +110,7 @@ export default class HTTPServer implements IServer {
110110
console.log(`[Dapr-JS] Letting Dapr pick-up the server (Maximum 60s wait time)`);
111111
while (!isHealthy) {
112112
console.log(`[Dapr-JS] - Waiting till Dapr Started (#${isHealthyRetryCount})`);
113-
await NodeJSUtils.sleep(this.serverStartupDelay);
113+
await NodeJSUtils.sleep(this.daprSidecarPollingDelayMs);
114114
isHealthy = await this.client.health.isHealthy();
115115
isHealthyRetryCount++;
116116

@@ -125,7 +125,6 @@ export default class HTTPServer implements IServer {
125125
}
126126

127127
async stop(): Promise<void> {
128-
const s = this.server.getServer();
129128
const httpTerminator = createHttpTerminator({ server: this.server.getServer() });
130129
await httpTerminator.terminate();
131130
// await this.server.close();

test/e2e/actors.http.test.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,6 @@ describe('http/actors', () => {
5353
// await client.stop();
5454
});
5555

56-
describe('general', () => {
57-
it('should allow us to use promises as some testing libraries have issues within the Node Ecosystem', async () => {
58-
const mock = jest.fn(() => {
59-
return new Promise((resolve) => setTimeout(resolve, 500));
60-
});
61-
62-
const handler = jest.fn();
63-
64-
await mock().then(handler);
65-
66-
await (new Promise(resolve => setTimeout(resolve, 2000)));
67-
68-
expect(handler).toHaveBeenCalled();
69-
});
70-
});
71-
7256
describe('actorProxy', () => {
7357
it('should be able to create an actor object through the proxy', async () => {
7458
const builder = new ActorProxyBuilder<DemoActorCounterImpl>(DemoActorCounterImpl, client);

test/e2e/main.http.test.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { CommunicationProtocolEnum, DaprClient, DaprServer, HttpMethod } from '../../src';
2-
import DemoActorCounterImpl from '../actor/DemoActorCounterImpl';
32

43
const serverHost = '127.0.0.1';
54
const serverPort = '50001';
@@ -38,22 +37,6 @@ describe('http/main', () => {
3837
await client.stop();
3938
});
4039

41-
describe('general', () => {
42-
it('should allow us to use promises as some testing libraries have issues within the Node Ecosystem', async () => {
43-
const mock = jest.fn(() => {
44-
return new Promise((resolve) => setTimeout(resolve, 500));
45-
});
46-
47-
const handler = jest.fn();
48-
49-
await mock().then(handler);
50-
51-
await (new Promise(resolve => setTimeout(resolve, 2000)));
52-
53-
expect(handler).toHaveBeenCalled();
54-
});
55-
});
56-
5740
describe('metadata', () => {
5841
it('should be able to get the metadata of the Dapr sidecar', async () => {
5942
const res = await client.metadata.get();

test/unit/main/general.test.ts

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)