diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-11-24 20:56:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-24 12:56:05 -0700 |
commit | 998d9061ef05b3868d2ea5523317c94176498730 (patch) | |
tree | bf7afe4491d63637f41a1708e71d9537f77d3a50 /cli | |
parent | 57dc427c77b5220f9640c13b80c1736b1235d409 (diff) |
chore: deflake unit_node/crypto/crypto_key_test.ts (#21331)
Ref https://github.com/denoland/deno/issues/21187
On CI we are going to run only fast tests, with an option to
pass `SLOW_TESTS=1` env var to enable more comprehensive tests.
Diffstat (limited to 'cli')
-rw-r--r-- | cli/tests/unit_node/crypto/crypto_key_test.ts | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cli/tests/unit_node/crypto/crypto_key_test.ts b/cli/tests/unit_node/crypto/crypto_key_test.ts index 0e56d8255..e59874d7a 100644 --- a/cli/tests/unit_node/crypto/crypto_key_test.ts +++ b/cli/tests/unit_node/crypto/crypto_key_test.ts @@ -17,6 +17,8 @@ import { } from "../../../../test_util/std/testing/asserts.ts"; import { createHmac } from "node:crypto"; +const RUN_SLOW_TESTS = Deno.env.get("SLOW_TESTS") === "1"; + const generateKeyPairAsync = promisify( ( type: any, @@ -77,10 +79,12 @@ Deno.test({ }, }); +const modulusLengths = RUN_SLOW_TESTS ? [2048, 3072] : [2048]; + for (const type of ["rsa", "rsa-pss", "dsa"]) { - for (const modulusLength of [2048, 3072]) { + for (const modulusLength of modulusLengths) { Deno.test({ - name: `generate ${type} key`, + name: `generate ${type} key ${modulusLength}`, fn() { const { publicKey, privateKey } = generateKeyPairSync(type as any, { modulusLength, @@ -92,7 +96,7 @@ for (const type of ["rsa", "rsa-pss", "dsa"]) { }); Deno.test({ - name: `generate ${type} key async`, + name: `generate ${type} key async ${modulusLength}`, async fn() { const x = await generateKeyPairAsync(type as any, { modulusLength, @@ -174,7 +178,9 @@ for ( }); } -for (const primeLength of [1024, 2048, 4096]) { +const primeLengths = RUN_SLOW_TESTS ? [1024, 2048, 4096] : [1024]; + +for (const primeLength of primeLengths) { Deno.test({ name: `generate dh key ${primeLength}`, fn() { |