Skip to content

Commit

Permalink
wip: now tests should pass in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
dbolotin committed Sep 6, 2024
1 parent d0910f2 commit a85c181
Show file tree
Hide file tree
Showing 10 changed files with 109 additions and 123 deletions.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,12 @@
"@milaboratory/tengo-sdk": "file:/Volumes/Data/Projects/MiLaboratory/blocks-beta/tengo-sdk",
"@milaboratory/pl-middle-layer": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-pl-middle-layer",
"@milaboratory/sdk-ui": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-sdk-ui",
"@milaboratory/sdk-test": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-sdk-test"
"@milaboratory/sdk-test": "file:/Volumes/Data/Projects/MiLaboratory/platforma/ts-sdk-test",
"@milaboratory/milaboratories.samples-and-data.workflow": "file:/Volumes/Data/Projects/MiLaboratory/blocks-beta/block-samples-and-data/workflow"
}
}
},
"pnpm": {
"overrides": {
"@milaboratory/milaboratories.samples-and-data.workflow": "file:/Volumes/Data/Projects/MiLaboratory/blocks-beta/block-samples-and-data/workflow"
}
"overrides": {}
}
}
163 changes: 69 additions & 94 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ catalog:
'@milaboratory/sdk-ui': ^0.12.21
'@milaboratory/sdk-test': ^1.5.5

'@milaboratory/tengo-sdk': ~1.1.8
'@milaboratory/tengo-sdk': ^1.2.1
'@milaboratory/pframes-conv': ^0.4.25

'@milaboratory/platforma-uikit': ^1.1.0
'@milaboratory/sdk-vue': ^1.0.42
'@milaboratory/mixcr': 4.7.0-68-develop

'@milaboratory/platforma-uikit': ^1.1.2
'@milaboratory/sdk-vue': ^1.1.1
'@milaboratory/helpers': ^1.5.3

'vue': ^3.4.38
'vue-tsc': ^2.1.4
'vue-tsc': ^2.1.6

'zod': ^3.23.8
'utility-types': ^3.11.0
Expand All @@ -40,8 +43,8 @@ catalog:
'@ag-grid-community/styles': ^32.1.0

'@changesets/cli': ^2.27.8

# other blocks used in tests

'@milaboratory/milaboratories.samples-and-data': 1.1.5
'@milaboratory/milaboratories.samples-and-data': 1.1.6
'@milaboratory/milaboratories.samples-and-data.model': 1.1.1
19 changes: 8 additions & 11 deletions test/src/wf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@ blockTest('empty imputs', { timeout: 10000 }, async ({ rawPrj: project, ml, help
5000
)) as InferBlockState<typeof platforma>;
expect(stableState.outputs).toMatchObject({ inputOptions: { ok: true, value: [] } });
const presetsOutput = wrapOutputs(stableState.outputs).presets;
const presetsStr = Buffer.from(
await ml.driverKit.blobDriver.getContent(presetsOutput!.handle)
).toString();
const presets = JSON.parse(presetsStr);
const presets = wrapOutputs(stableState.outputs).presets;
expect(presets).length.gt(10);
});

Expand All @@ -36,15 +32,16 @@ blockTest(
} satisfies BlockArgs);
const stableState = (await awaitStableState(
project.getBlockState(blockId),
5000
10000
)) as InferBlockState<typeof platforma>;
expect(stableState.outputs).toMatchObject({ preset: { ok: true } });
const preset = wrapOutputs(stableState.outputs).preset;
expect(preset).toBeTypeOf('object');
}
);

blockTest(
'simple project',
{ timeout: 25000 },
{ timeout: 30000 },
async ({ rawPrj: project, ml, helpers, expect }) => {
const sndBlockId = await project.addBlock('Samples & Data', samplesAndDataBlockSpec);
const clonotypingBlockId = await project.addBlock('MiXCR Clonotyping', myBlockSpec);
Expand Down Expand Up @@ -101,7 +98,7 @@ blockTest(

const clonotypingStableState1 = (await awaitStableState(
clonotypingBlockState,
5000
15000
)) as InferBlockState<typeof platforma>;

expect(clonotypingStableState1.outputs).toMatchObject({
Expand All @@ -127,7 +124,7 @@ blockTest(

const clonotypingStableState2 = (await awaitStableState(
project.getBlockState(clonotypingBlockId),
10000
15000
)) as InferBlockState<typeof platforma>;

const outputs2 = wrapOutputs<BlockOutputs>(clonotypingStableState2.outputs);
Expand All @@ -138,7 +135,7 @@ blockTest(
await project.runBlock(clonotypingBlockId);
const clonotypingStableState3 = (await helpers.awaitBlockDoneAndGetStableBlockState(
clonotypingBlockId,
10000
15000
)) as InferBlockState<typeof platforma>;
const outputs3 = wrapOutputs<BlockOutputs>(clonotypingStableState3.outputs);

Expand Down
2 changes: 2 additions & 0 deletions workflow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"devDependencies": {
"@milaboratory/tengo-template-builder": "catalog:",
"@milaboratory/tengo-sdk": "catalog:",
"@milaboratory/pframes-conv": "catalog:",
"@milaboratory/mixcr": "catalog:",
"@milaboratory/sdk-test": "catalog:",
"vitest": "catalog:",
"typescript": "catalog:"
Expand Down
5 changes: 4 additions & 1 deletion workflow/src/get-preset.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
self := import("@milaboratory/tengo-sdk:tpl")
ll := import("@milaboratory/tengo-sdk:ll")
exec := import("@milaboratory/tengo-sdk:exec")
assets := import("@milaboratory/tengo-sdk:assets")

self.validateInputs({
"__options__,closed": "",
Expand All @@ -13,15 +14,17 @@ self.validateInputs({
}
})

mixcrSw := assets.importSoftware("@milaboratory/mixcr:main")

self.defineOutputs("preset")

self.body(func(inputs) {
presetName := inputs.request.presetName
species := inputs.request.species

mixcrCmdBuilder := exec.builder().
software(mixcrSw).
printErrStreamToStdout().
cmd("mixcr").
arg("exportPreset").
arg("--preset-name").
arg(presetName)
Expand Down
5 changes: 4 additions & 1 deletion workflow/src/list-presets.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,15 @@ self := import("@milaboratory/tengo-sdk:tpl")
ll := import("@milaboratory/tengo-sdk:ll")
exec := import("@milaboratory/tengo-sdk:exec")
file := import("@milaboratory/tengo-sdk:file")
assets := import("@milaboratory/tengo-sdk:assets")

self.defineOutputs("presets")

mixcrSw := assets.importSoftware("@milaboratory/mixcr:main")

self.body(func(inputs) {
listPresets := exec.builder().
cmd("mixcr").
software(mixcrSw).
arg("listPresetSpecificationsForUI").
arg("presets.json").
inUiQueue().
Expand Down
7 changes: 4 additions & 3 deletions workflow/src/mixcr-analyze.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ render := import("@milaboratory/tengo-sdk:render")

json := import("json")

exportClonesTpl := assets.importTemplate(":export-clones")

self.defineOutputs("qc", "reports", "clones", "log")

exportClonesTpl := assets.importTemplate(":export-clones")
mixcrSw := assets.importSoftware("@milaboratory/mixcr:main")

progressPrefix := "[==PROGRESS==]"

self.body(func(inputs) {
Expand Down Expand Up @@ -42,7 +43,7 @@ self.body(func(inputs) {
mixcrCmdBuilder := exec.builder().
printErrStreamToStdout().
env("MI_PROGRESS_PREFIX", progressPrefix).
cmd("mixcr").
software(mixcrSw).
arg("analyze")

if !is_undefined(species) {
Expand Down
5 changes: 4 additions & 1 deletion workflow/src/prerun.tpl.tengo
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ wf.body(func(args) {

if !is_undefined(args.preset) {
getPreset := render.create(getPresetTpl, {
preset: args.preset
request: {
presetName: args.preset,
species: args.species
}
})
outputs.preset = getPreset.output("preset", 24 * 60 * 60 * 1000)
}
Expand Down
4 changes: 2 additions & 2 deletions workflow/src/test/columns.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const testCases: TestCase[] = [

tplTest.for(testCases)(
'checking preset for $presetName',
{ timeout: 10000 },
{ timeout: 20000 },
async ({ presetName, species, check }, { helper, expect }) => {
const resultC = (
await helper.renderTemplate(true, 'test.columns.test', ['conf'], (tx) => {
Expand All @@ -44,7 +44,7 @@ tplTest.for(testCases)(
};
})
).computeOutput('conf', (c) => c?.getDataAsJson());
const result = await awaitStableState(resultC, 10000);
const result = await awaitStableState(resultC, 15000);
check(expect, result);
}
);

0 comments on commit a85c181

Please sign in to comment.