Skip to content

Commit

Permalink
apply a 5x scaling factor to all max allowed run times if CI is found…
Browse files Browse the repository at this point in the history
… in env vars

called ci_max_time_multiplier
  • Loading branch information
janosh committed Jun 27, 2024
1 parent 03bd3aa commit f83df24
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tests/unit/bonding.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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`, () => {
Expand Down

0 comments on commit f83df24

Please sign in to comment.