-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make scheduler really skip invalid sessions (#163)
The scheduler expected that invalid sessions would be flagged with a `blockingErrors` property, but that property was never set. The schedule command now sets a `blockingError` flag, and the scheduler is slightly more resilient on invalid sessions.
- Loading branch information
Showing
5 changed files
with
55 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import * as assert from 'node:assert'; | ||
import { initTestEnv } from './init-test-env.mjs'; | ||
import { getEnvKey, setEnvKey } from '../tools/lib/envkeys.mjs'; | ||
import { fetchProject } from '../tools/lib/project.mjs'; | ||
import { validateGrid } from '../tools/lib/validate.mjs'; | ||
import { suggestSchedule } from '../tools/lib/schedule.mjs'; | ||
import { convertProjectToHTML } from '../tools/lib/project2html.mjs'; | ||
|
||
async function fetchTestProject() { | ||
const project = await fetchProject( | ||
await getEnvKey('PROJECT_OWNER'), | ||
await getEnvKey('PROJECT_NUMBER')); | ||
return project; | ||
} | ||
|
||
function stripDetails(errors) { | ||
return errors.map(err => { | ||
if (err.details) { | ||
delete err.details; | ||
} | ||
return err; | ||
}); | ||
} | ||
|
||
describe('When given invalid sessions, the scheduler', function () { | ||
before(function () { | ||
initTestEnv(); | ||
setEnvKey('PROJECT_NUMBER', 'session-validation'); | ||
setEnvKey('ISSUE_TEMPLATE', 'test/data/template-breakout.yml'); | ||
}); | ||
|
||
it('skips invalid sessions', async function () { | ||
const project = await fetchTestProject(); | ||
project.sessions = project.sessions.filter(s => [1, 2, 3].includes(s.number)); | ||
await validateGrid(project); | ||
|
||
const session1 = project.sessions.find(s => s.number === 1); | ||
const session2 = project.sessions.find(s => s.number === 2); | ||
const session3 = project.sessions.find(s => s.number === 3); | ||
session2.blockingError = true; | ||
suggestSchedule(project, { seed: 'schedule' }); | ||
|
||
assert.deepStrictEqual(session1.meetings, undefined); | ||
assert.deepStrictEqual(session2.meetings, undefined); | ||
assert.deepStrictEqual(session3.meetings?.length, 1); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters