Skip to content

Commit

Permalink
Test node server
Browse files Browse the repository at this point in the history
Signed-off-by: Timo Stamm <ts@timostamm.de>
  • Loading branch information
timostamm committed Aug 30, 2024
1 parent 8b527fa commit 29b3f69
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions packages/connect-node/conformance/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,16 @@ main();
* server's port and other details to stdout.
*/
function main() {
console.error("connect-node/conformance/server.ts main()");

Check failure on line 50 in packages/connect-node/conformance/server.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
const stdinAll = readFileSync(process.stdin.fd);
const stdinMsgLen = stdinAll.readUint32BE();
if (stdinAll.byteLength != stdinMsgLen + 4) {
throw new Error("unexpected input on stdin");
}
const req = ServerCompatRequest.fromBinary(
readFileSync(process.stdin.fd).subarray(4),
stdinAll.subarray(4),

Check failure on line 57 in packages/connect-node/conformance/server.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
);
console.error("connect-node/conformance/server.ts compat req", req);

const adapter = connectNodeAdapter({
routes,
Expand Down Expand Up @@ -107,12 +114,14 @@ function main() {
}

Check failure on line 115 in packages/connect-node/conformance/server.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
process.on("SIGTERM", () => {
console.error("connect-node/conformance/server.ts SIGTERM");
if ("closeAllConnections" in server) {
server.closeAllConnections();
}
server.close();
});

Check failure on line 122 in packages/connect-node/conformance/server.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
server.listen(0, "127.0.0.1", () => {
console.error("connect-node/conformance/server.ts listening");
const addrInfo = server.address() as net.AddressInfo;
const res = new ServerCompatResponse({
pemCert:
Expand All @@ -122,6 +131,7 @@ function main() {
host: addrInfo.address,
port: addrInfo.port,
});

Check failure on line 133 in packages/connect-node/conformance/server.ts

View workflow job for this annotation

GitHub Actions / lint

Unexpected console statement
process.stdout.write(writeSizeDelimitedBuffer(res.toBinary()));
process.stdout.end(writeSizeDelimitedBuffer(res.toBinary()));
console.error("connect-node/conformance/server.ts wrote compat resp");
});
}

0 comments on commit 29b3f69

Please sign in to comment.