fix: bad assumption about tls in server tests (#915)

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.
This commit is contained in:
Luca Casonato 2021-05-11 22:33:28 +02:00 committed by GitHub
parent 1b4eff019b
commit db348ae388
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 9 deletions

View File

@ -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:

View File

@ -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({