From f83df24a4c05ead46e7d0b10afe4f91883d341d9 Mon Sep 17 00:00:00 2001 From: Janosh Riebesell Date: Thu, 27 Jun 2024 17:12:19 -0400 Subject: [PATCH] apply a 5x scaling factor to all max allowed run times if CI is found in env vars called ci_max_time_multiplier --- tests/unit/bonding.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/unit/bonding.test.ts b/tests/unit/bonding.test.ts index 6719d8a..2950dda 100644 --- a/tests/unit/bonding.test.ts +++ b/tests/unit/bonding.test.ts @@ -4,6 +4,8 @@ import { max_dist, nearest_neighbor } from '$lib/structure/bonding' import { performance } from 'perf_hooks' import { describe, expect, test } from 'vitest' +const ci_max_time_multiplier = process.env.CI ? 5 : 1 + // Function to generate a random structure function make_rand_structure(numAtoms: number) { return { @@ -29,8 +31,8 @@ function perf_test(func: BondingAlgo, atom_count: number, max_time: number) { expect( avg_time, - `average run time: ${Math.ceil(avg_time)}, max expected: ${max_time}`, - ).toBeLessThanOrEqual(max_time) + `average run time: ${Math.ceil(avg_time)}, max expected: ${max_time * ci_max_time_multiplier}`, // Apply scaling factor + ).toBeLessThanOrEqual(max_time * ci_max_time_multiplier) } describe(`Bonding Functions Performance Tests`, () => {