Skip to content

Commit

Permalink
fix: bad assumption about tls in server tests (#915)
Browse files Browse the repository at this point in the history
This commit fixes a bad assumption that `connectTls` will throw on a
handshaking error. Really the TLS conn will only fail on first read or
write.
  • Loading branch information
lucacasonato authored May 11, 2021
1 parent 1b4eff0 commit db348ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ jobs:
strategy:
fail-fast: false
matrix:
deno: [stable, canary]
# TODO(lucacasonato): reenable stable after 1.10 release
deno: [canary] # [stable, canary]
os: [macOS-latest, ubuntu-latest, windows-2019]

steps:
Expand Down
17 changes: 9 additions & 8 deletions http/server_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -720,17 +720,18 @@ Deno.test({
const p = iteratorReq(server);

try {
// Invalid certificate, connection should throw
// Invalid certificate, connection should throw on first read or write
// but should not crash the server
assertThrowsAsync(
() =>
Deno.connectTls({
hostname: "localhost",
port,
// certFile
}),
const badConn = await Deno.connectTls({
hostname: "localhost",
port,
// certFile
});
await assertThrowsAsync(
() => badConn.read(new Uint8Array(1)),
Deno.errors.InvalidData,
);
badConn.close();

// Valid request after invalid
const conn = await Deno.connectTls({
Expand Down

0 comments on commit db348ae

Please sign in to comment.