multidim-interop: Add name ignore option (#225)

* Add name ignore option

* Update multidim-interop/testplans.ts

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
This commit is contained in:
Marco Munizaga 2023-07-10 16:49:46 -07:00 committed by GitHub
parent ba8169f189
commit 81e78aed34
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 6 deletions

View File

@ -8,7 +8,7 @@ function buildExtraEnv(timeoutOverride: { [key: string]: number }, test1ID: stri
return maxTimeout > 0 ? { "test_timeout_seconds": maxTimeout.toString(10) } : {}
}
export async function buildTestSpecs(versions: Array<Version>, nameFilter: string | null): Promise<Array<ComposeSpecification>> {
export async function buildTestSpecs(versions: Array<Version>, nameFilter: string | null, nameIgnore: string | null): Promise<Array<ComposeSpecification>> {
const containerImages: { [key: string]: () => string } = {}
const timeoutOverride: { [key: string]: number } = {}
versions.forEach(v => containerImages[v.id] = () => {
@ -86,7 +86,7 @@ export async function buildTestSpecs(versions: Array<Version>, nameFilter: strin
muxer: test.muxer,
security: test.sec,
extraEnv: buildExtraEnv(timeoutOverride, test.id1, test.id2)
}, nameFilter)
}, nameFilter, nameIgnore)
)).concat(
standaloneTransportsQueryResults
.map((test): ComposeSpecification => buildSpec(containerImages, {
@ -95,15 +95,18 @@ export async function buildTestSpecs(versions: Array<Version>, nameFilter: strin
listenerID: test.id2,
transport: test.transport,
extraEnv: buildExtraEnv(timeoutOverride, test.id1, test.id2)
}, nameFilter))).filter((spec): spec is ComposeSpecification => spec !== null)
}, nameFilter, nameIgnore))).filter((spec): spec is ComposeSpecification => spec !== null)
return testSpecs
}
function buildSpec(containerImages: { [key: string]: () => string }, { name, dialerID, listenerID, transport, muxer, security, extraEnv }: { name: string, dialerID: string, listenerID: string, transport: string, muxer?: string, security?: string, extraEnv?: { [key: string]: string } }, nameFilter: string | null): ComposeSpecification | null {
function buildSpec(containerImages: { [key: string]: () => string }, { name, dialerID, listenerID, transport, muxer, security, extraEnv }: { name: string, dialerID: string, listenerID: string, transport: string, muxer?: string, security?: string, extraEnv?: { [key: string]: string } }, nameFilter: string | null, nameIgnore: string | null): ComposeSpecification | null {
if (nameFilter && !name.includes(nameFilter)) {
return null
}
if (nameIgnore && name.includes(nameIgnore)) {
return null
}
return {
name,
services: {

View File

@ -12,7 +12,11 @@ import path from "path";
const argv = await yargs(process.argv.slice(2))
.options({
'name-filter': {
description: 'Only run named test',
description: 'Only run tests including this name',
default: "",
},
'name-ignore': {
description: 'Do not run any tests including this name ',
default: "",
},
'emit-only': {
@ -60,7 +64,11 @@ import path from "path";
if (nameFilter === "") {
nameFilter = null
}
let testSpecs = await buildTestSpecs(versions.concat(extraVersions), nameFilter)
let nameIgnore: string | null = argv["name-ignore"]
if (nameIgnore === "") {
nameIgnore = null
}
let testSpecs = await buildTestSpecs(versions.concat(extraVersions), nameFilter, nameIgnore)
if (argv["emit-only"]) {