@elaraai/e3-api-tests 0.0.2-beta.13 → 0.0.2-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/cli.d.ts +71 -0
- package/dist/src/cli.d.ts.map +1 -0
- package/dist/src/cli.js +139 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/context.d.ts +49 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +108 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/fixtures.d.ts +61 -0
- package/dist/src/fixtures.d.ts.map +1 -0
- package/dist/src/fixtures.js +107 -0
- package/dist/src/fixtures.js.map +1 -0
- package/dist/src/index.d.ts +65 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +85 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/suites/cli.d.ts +15 -0
- package/dist/src/suites/cli.d.ts.map +1 -0
- package/dist/src/suites/cli.js +152 -0
- package/dist/src/suites/cli.js.map +1 -0
- package/dist/src/suites/dataflow.d.ts +12 -0
- package/dist/src/suites/dataflow.d.ts.map +1 -0
- package/dist/src/suites/dataflow.js +167 -0
- package/dist/src/suites/dataflow.js.map +1 -0
- package/dist/src/suites/datasets.d.ts +12 -0
- package/dist/src/suites/datasets.d.ts.map +1 -0
- package/dist/src/suites/datasets.js +88 -0
- package/dist/src/suites/datasets.js.map +1 -0
- package/dist/src/suites/packages.d.ts +12 -0
- package/dist/src/suites/packages.d.ts.map +1 -0
- package/dist/src/suites/packages.js +86 -0
- package/dist/src/suites/packages.js.map +1 -0
- package/dist/src/suites/platform.d.ts +12 -0
- package/dist/src/suites/platform.d.ts.map +1 -0
- package/dist/src/suites/platform.js +114 -0
- package/dist/src/suites/platform.js.map +1 -0
- package/dist/src/suites/repository.d.ts +12 -0
- package/dist/src/suites/repository.d.ts.map +1 -0
- package/dist/src/suites/repository.js +93 -0
- package/dist/src/suites/repository.js.map +1 -0
- package/dist/src/suites/workspaces.d.ts +12 -0
- package/dist/src/suites/workspaces.d.ts.map +1 -0
- package/dist/src/suites/workspaces.js +127 -0
- package/dist/src/suites/workspaces.js.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* e3 API Compliance Tests
|
|
7
|
+
*
|
|
8
|
+
* Shared test suites for verifying e3 API implementations.
|
|
9
|
+
* Works with both local (e3-api-server) and cloud (e3-aws) deployments.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```typescript
|
|
13
|
+
* import { describe, before, after } from 'node:test';
|
|
14
|
+
* import { createServer } from '@elaraai/e3-api-server';
|
|
15
|
+
* import { allTests, createTestContext } from '@elaraai/e3-api-tests';
|
|
16
|
+
*
|
|
17
|
+
* describe('API compliance', () => {
|
|
18
|
+
* let server: Server;
|
|
19
|
+
* let context: TestContext;
|
|
20
|
+
*
|
|
21
|
+
* before(async () => {
|
|
22
|
+
* server = await createServer({ reposDir: tempDir, port: 0 });
|
|
23
|
+
* await server.start();
|
|
24
|
+
* context = await createTestContext({
|
|
25
|
+
* baseUrl: `http://localhost:${server.port}`,
|
|
26
|
+
* getToken: async () => 'test-token',
|
|
27
|
+
* });
|
|
28
|
+
* });
|
|
29
|
+
*
|
|
30
|
+
* after(async () => {
|
|
31
|
+
* await context.cleanup();
|
|
32
|
+
* await server.stop();
|
|
33
|
+
* });
|
|
34
|
+
*
|
|
35
|
+
* allTests(() => context);
|
|
36
|
+
* });
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
// Context and configuration
|
|
40
|
+
export { createTestContext } from './context.js';
|
|
41
|
+
// Fixture creation utilities
|
|
42
|
+
export { createPackageZip, createMultiInputPackageZip, createStringPackageZip, createDiamondPackageZip, } from './fixtures.js';
|
|
43
|
+
// CLI utilities
|
|
44
|
+
export { runE3Command, spawnE3Command, getE3CliPath, waitFor, } from './cli.js';
|
|
45
|
+
// Test suites
|
|
46
|
+
export { repositoryTests } from './suites/repository.js';
|
|
47
|
+
export { packageTests } from './suites/packages.js';
|
|
48
|
+
export { workspaceTests } from './suites/workspaces.js';
|
|
49
|
+
export { datasetTests } from './suites/datasets.js';
|
|
50
|
+
export { dataflowTests } from './suites/dataflow.js';
|
|
51
|
+
export { platformTests } from './suites/platform.js';
|
|
52
|
+
export { cliTests } from './suites/cli.js';
|
|
53
|
+
import { repositoryTests } from './suites/repository.js';
|
|
54
|
+
import { packageTests } from './suites/packages.js';
|
|
55
|
+
import { workspaceTests } from './suites/workspaces.js';
|
|
56
|
+
import { datasetTests } from './suites/datasets.js';
|
|
57
|
+
import { dataflowTests } from './suites/dataflow.js';
|
|
58
|
+
import { platformTests } from './suites/platform.js';
|
|
59
|
+
import { cliTests } from './suites/cli.js';
|
|
60
|
+
/**
|
|
61
|
+
* Register all API test suites (excluding CLI tests).
|
|
62
|
+
*
|
|
63
|
+
* CLI tests require additional credentials setup and are registered separately.
|
|
64
|
+
*
|
|
65
|
+
* @param getContext - Function that returns the current test context
|
|
66
|
+
*/
|
|
67
|
+
export function allApiTests(getContext) {
|
|
68
|
+
repositoryTests(getContext);
|
|
69
|
+
packageTests(getContext);
|
|
70
|
+
workspaceTests(getContext);
|
|
71
|
+
datasetTests(getContext);
|
|
72
|
+
dataflowTests(getContext);
|
|
73
|
+
platformTests(getContext);
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Register all test suites including CLI tests.
|
|
77
|
+
*
|
|
78
|
+
* @param getContext - Function that returns the current test context
|
|
79
|
+
* @param getCredentialsEnv - Function that returns env vars for CLI auth
|
|
80
|
+
*/
|
|
81
|
+
export function allTests(getContext, getCredentialsEnv) {
|
|
82
|
+
allApiTests(getContext);
|
|
83
|
+
cliTests(getContext, getCredentialsEnv);
|
|
84
|
+
}
|
|
85
|
+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B;IACvD,eAAe,CAAC,UAAU,CAAC,CAAC;IAC5B,YAAY,CAAC,UAAU,CAAC,CAAC;IACzB,cAAc,CAAC,UAAU,CAAC,CAAC;IAC3B,YAAY,CAAC,UAAU,CAAC,CAAC;IACzB,aAAa,CAAC,UAAU,CAAC,CAAC;IAC1B,aAAa,CAAC,UAAU,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,QAAQ,CACtB,UAA6B,EAC7B,iBAA+C;IAE/C,WAAW,CAAC,UAAU,CAAC,CAAC;IACxB,QAAQ,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { TestContext } from '../context.js';
|
|
6
|
+
/**
|
|
7
|
+
* Register CLI operation tests.
|
|
8
|
+
*
|
|
9
|
+
* These tests run CLI commands against a remote URL and verify output.
|
|
10
|
+
*
|
|
11
|
+
* @param getContext - Function that returns the current test context
|
|
12
|
+
* @param getCredentialsEnv - Function that returns env vars for auth (E3_CREDENTIALS_PATH, etc.)
|
|
13
|
+
*/
|
|
14
|
+
export declare function cliTests(getContext: () => TestContext, getCredentialsEnv: () => Record<string, string>): void;
|
|
15
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../../src/suites/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAaH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD;;;;;;;GAOG;AACH,wBAAgB,QAAQ,CACtB,UAAU,EAAE,MAAM,WAAW,EAC7B,iBAAiB,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9C,IAAI,CAmKN"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* CLI operations test suite.
|
|
7
|
+
*
|
|
8
|
+
* Tests CLI commands against remote URLs.
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it, beforeEach } from 'node:test';
|
|
11
|
+
import assert from 'node:assert/strict';
|
|
12
|
+
import { mkdirSync } from 'node:fs';
|
|
13
|
+
import { join } from 'node:path';
|
|
14
|
+
import { runE3Command } from '../cli.js';
|
|
15
|
+
import { createPackageZip } from '../fixtures.js';
|
|
16
|
+
/**
|
|
17
|
+
* Register CLI operation tests.
|
|
18
|
+
*
|
|
19
|
+
* These tests run CLI commands against a remote URL and verify output.
|
|
20
|
+
*
|
|
21
|
+
* @param getContext - Function that returns the current test context
|
|
22
|
+
* @param getCredentialsEnv - Function that returns env vars for auth (E3_CREDENTIALS_PATH, etc.)
|
|
23
|
+
*/
|
|
24
|
+
export function cliTests(getContext, getCredentialsEnv) {
|
|
25
|
+
describe('cli', () => {
|
|
26
|
+
let remoteUrl;
|
|
27
|
+
let workDir;
|
|
28
|
+
beforeEach(async () => {
|
|
29
|
+
const ctx = getContext();
|
|
30
|
+
remoteUrl = `${ctx.config.baseUrl}/repos/${ctx.repoName}`;
|
|
31
|
+
workDir = join(ctx.tempDir, 'cli-work');
|
|
32
|
+
mkdirSync(workDir, { recursive: true });
|
|
33
|
+
});
|
|
34
|
+
describe('repo commands', () => {
|
|
35
|
+
it('repo status via remote URL', async () => {
|
|
36
|
+
const result = await runE3Command(['repo', 'status', remoteUrl], workDir, { env: getCredentialsEnv() });
|
|
37
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
38
|
+
assert.match(result.stdout, /Repository:/);
|
|
39
|
+
assert.match(result.stdout, /Objects:/);
|
|
40
|
+
assert.match(result.stdout, /Packages:/);
|
|
41
|
+
assert.match(result.stdout, /Workspaces:/);
|
|
42
|
+
});
|
|
43
|
+
it('repo gc via remote URL', async () => {
|
|
44
|
+
const result = await runE3Command(['repo', 'gc', remoteUrl], workDir, { env: getCredentialsEnv() });
|
|
45
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
46
|
+
assert.match(result.stdout, /Running garbage collection/);
|
|
47
|
+
assert.match(result.stdout, /Garbage collection complete/);
|
|
48
|
+
});
|
|
49
|
+
it('repo gc --dry-run via remote URL', async () => {
|
|
50
|
+
const result = await runE3Command(['repo', 'gc', remoteUrl, '--dry-run'], workDir, { env: getCredentialsEnv() });
|
|
51
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
52
|
+
assert.match(result.stdout, /Dry run/);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
describe('workspace commands', () => {
|
|
56
|
+
it('workspace list via remote URL', async () => {
|
|
57
|
+
const result = await runE3Command(['workspace', 'list', remoteUrl], workDir, { env: getCredentialsEnv() });
|
|
58
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
59
|
+
// Initially empty or has workspaces from other tests
|
|
60
|
+
assert.ok(result.stdout.length > 0);
|
|
61
|
+
});
|
|
62
|
+
it('workspace create via remote URL', async () => {
|
|
63
|
+
const wsName = `cli-test-ws-${Date.now()}`;
|
|
64
|
+
const result = await runE3Command(['workspace', 'create', remoteUrl, wsName], workDir, { env: getCredentialsEnv() });
|
|
65
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
66
|
+
assert.match(result.stdout, new RegExp(`Created workspace: ${wsName}`));
|
|
67
|
+
// Clean up
|
|
68
|
+
await runE3Command(['workspace', 'remove', remoteUrl, wsName], workDir, { env: getCredentialsEnv() });
|
|
69
|
+
});
|
|
70
|
+
it('workspace remove via remote URL', async () => {
|
|
71
|
+
const wsName = `cli-remove-ws-${Date.now()}`;
|
|
72
|
+
// Create first
|
|
73
|
+
await runE3Command(['workspace', 'create', remoteUrl, wsName], workDir, { env: getCredentialsEnv() });
|
|
74
|
+
// Remove
|
|
75
|
+
const result = await runE3Command(['workspace', 'remove', remoteUrl, wsName], workDir, { env: getCredentialsEnv() });
|
|
76
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
77
|
+
assert.match(result.stdout, new RegExp(`Removed workspace: ${wsName}`));
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
describe('package commands', () => {
|
|
81
|
+
let packageZipPath;
|
|
82
|
+
beforeEach(async () => {
|
|
83
|
+
const ctx = getContext();
|
|
84
|
+
packageZipPath = await createPackageZip(ctx.tempDir, 'cli-test-pkg', '1.0.0');
|
|
85
|
+
});
|
|
86
|
+
it('package list via remote URL', async () => {
|
|
87
|
+
const result = await runE3Command(['package', 'list', remoteUrl], workDir, { env: getCredentialsEnv() });
|
|
88
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
89
|
+
// Either "No packages" or list of packages
|
|
90
|
+
assert.ok(result.stdout.length > 0);
|
|
91
|
+
});
|
|
92
|
+
it('package import via remote URL', async () => {
|
|
93
|
+
const result = await runE3Command(['package', 'import', remoteUrl, packageZipPath], workDir, { env: getCredentialsEnv() });
|
|
94
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
95
|
+
assert.match(result.stdout, /Imported cli-test-pkg@1.0.0/);
|
|
96
|
+
});
|
|
97
|
+
it('package remove via remote URL', async () => {
|
|
98
|
+
// Import first
|
|
99
|
+
await runE3Command(['package', 'import', remoteUrl, packageZipPath], workDir, { env: getCredentialsEnv() });
|
|
100
|
+
// Remove
|
|
101
|
+
const result = await runE3Command(['package', 'remove', remoteUrl, 'cli-test-pkg@1.0.0'], workDir, { env: getCredentialsEnv() });
|
|
102
|
+
assert.strictEqual(result.exitCode, 0, `Failed: ${result.stderr}`);
|
|
103
|
+
assert.match(result.stdout, /Removed cli-test-pkg@1.0.0/);
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
describe('full workflow via CLI', () => {
|
|
107
|
+
it('imports package, creates workspace, deploys, and shows tree', async () => {
|
|
108
|
+
const ctx = getContext();
|
|
109
|
+
const packageZipPath = await createPackageZip(ctx.tempDir, 'workflow-pkg', '1.0.0');
|
|
110
|
+
const wsName = `workflow-ws-${Date.now()}`;
|
|
111
|
+
const env = getCredentialsEnv();
|
|
112
|
+
// Import package
|
|
113
|
+
let result = await runE3Command(['package', 'import', remoteUrl, packageZipPath], workDir, { env });
|
|
114
|
+
assert.strictEqual(result.exitCode, 0, `Import failed: ${result.stderr}`);
|
|
115
|
+
// Create workspace
|
|
116
|
+
result = await runE3Command(['workspace', 'create', remoteUrl, wsName], workDir, { env });
|
|
117
|
+
assert.strictEqual(result.exitCode, 0, `Create workspace failed: ${result.stderr}`);
|
|
118
|
+
// Deploy
|
|
119
|
+
result = await runE3Command(['workspace', 'deploy', remoteUrl, wsName, 'workflow-pkg@1.0.0'], workDir, { env });
|
|
120
|
+
assert.strictEqual(result.exitCode, 0, `Deploy failed: ${result.stderr}`);
|
|
121
|
+
assert.match(result.stdout, new RegExp(`Deployed workflow-pkg@1.0.0 to workspace: ${wsName}`));
|
|
122
|
+
// Tree
|
|
123
|
+
result = await runE3Command(['tree', remoteUrl, wsName], workDir, { env });
|
|
124
|
+
assert.strictEqual(result.exitCode, 0, `Tree failed: ${result.stderr}`);
|
|
125
|
+
assert.match(result.stdout, new RegExp(wsName));
|
|
126
|
+
assert.match(result.stdout, /inputs/);
|
|
127
|
+
// Clean up
|
|
128
|
+
await runE3Command(['workspace', 'remove', remoteUrl, wsName], workDir, { env });
|
|
129
|
+
});
|
|
130
|
+
it('executes dataflow via CLI and shows logs', async () => {
|
|
131
|
+
const ctx = getContext();
|
|
132
|
+
const packageZipPath = await createPackageZip(ctx.tempDir, 'exec-cli-pkg', '1.0.0');
|
|
133
|
+
const wsName = `exec-cli-ws-${Date.now()}`;
|
|
134
|
+
const env = getCredentialsEnv();
|
|
135
|
+
// Setup
|
|
136
|
+
await runE3Command(['package', 'import', remoteUrl, packageZipPath], workDir, { env });
|
|
137
|
+
await runE3Command(['workspace', 'create', remoteUrl, wsName], workDir, { env });
|
|
138
|
+
await runE3Command(['workspace', 'deploy', remoteUrl, wsName, 'exec-cli-pkg@1.0.0'], workDir, { env });
|
|
139
|
+
// Execute
|
|
140
|
+
const startResult = await runE3Command(['start', remoteUrl, wsName], workDir, { env });
|
|
141
|
+
assert.strictEqual(startResult.exitCode, 0, `Start failed: ${startResult.stderr}`);
|
|
142
|
+
// Show logs
|
|
143
|
+
const logsResult = await runE3Command(['logs', remoteUrl, `${wsName}.compute`], workDir, { env });
|
|
144
|
+
assert.strictEqual(logsResult.exitCode, 0, `Logs failed: ${logsResult.stderr}`);
|
|
145
|
+
assert.match(logsResult.stdout, /Task:/);
|
|
146
|
+
// Clean up
|
|
147
|
+
await runE3Command(['workspace', 'remove', remoteUrl, wsName], workDir, { env });
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../../src/suites/cli.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD;;;;;;;GAOG;AACH,MAAM,UAAU,QAAQ,CACtB,UA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AC,MAAM,EAAE,CAAC,CAAC;gBAEnF,YAAY;gBACZ,MAAM,UAAU,GAAG,MAAM,YAAY,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,UAAU,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;gBAClG,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,gBAAgB,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC;gBAChF,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEzC,WAAW;gBACX,MAAM,YAAY,CAAC,CAAC,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;YACnF,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { TestContext } from '../context.js';
|
|
6
|
+
/**
|
|
7
|
+
* Register dataflow execution tests.
|
|
8
|
+
*
|
|
9
|
+
* @param getContext - Function that returns the current test context
|
|
10
|
+
*/
|
|
11
|
+
export declare function dataflowTests(getContext: () => TestContext): void;
|
|
12
|
+
//# sourceMappingURL=dataflow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../../src/suites/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAiMjE"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Dataflow execution test suite.
|
|
7
|
+
*
|
|
8
|
+
* Tests: start, execute (blocking), poll for completion, logs
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it, beforeEach } from 'node:test';
|
|
11
|
+
import assert from 'node:assert/strict';
|
|
12
|
+
import { readFileSync } from 'node:fs';
|
|
13
|
+
import { packageImport, workspaceCreate, workspaceDeploy, workspaceStatus, dataflowStart, dataflowExecute, dataflowExecution, taskLogs, } from '@elaraai/e3-api-client';
|
|
14
|
+
import { createPackageZip, createDiamondPackageZip } from '../fixtures.js';
|
|
15
|
+
/**
|
|
16
|
+
* Register dataflow execution tests.
|
|
17
|
+
*
|
|
18
|
+
* @param getContext - Function that returns the current test context
|
|
19
|
+
*/
|
|
20
|
+
export function dataflowTests(getContext) {
|
|
21
|
+
describe('dataflow', () => {
|
|
22
|
+
describe('simple execution', () => {
|
|
23
|
+
beforeEach(async () => {
|
|
24
|
+
const ctx = getContext();
|
|
25
|
+
const opts = await ctx.opts();
|
|
26
|
+
// Create and import a simple package
|
|
27
|
+
const zipPath = await createPackageZip(ctx.tempDir, 'exec-pkg', '1.0.0');
|
|
28
|
+
const packageZip = readFileSync(zipPath);
|
|
29
|
+
await packageImport(ctx.config.baseUrl, ctx.repoName, packageZip, opts);
|
|
30
|
+
await workspaceCreate(ctx.config.baseUrl, ctx.repoName, 'exec-ws', opts);
|
|
31
|
+
await workspaceDeploy(ctx.config.baseUrl, ctx.repoName, 'exec-ws', 'exec-pkg@1.0.0', opts);
|
|
32
|
+
});
|
|
33
|
+
it('dataflowExecute runs tasks and returns result (blocking)', async () => {
|
|
34
|
+
const ctx = getContext();
|
|
35
|
+
const opts = await ctx.opts();
|
|
36
|
+
const result = await dataflowExecute(ctx.config.baseUrl, ctx.repoName, 'exec-ws', { force: true }, opts);
|
|
37
|
+
// Verify execution result
|
|
38
|
+
assert.strictEqual(result.success, true);
|
|
39
|
+
assert.strictEqual(result.executed, 1n);
|
|
40
|
+
assert.strictEqual(result.failed, 0n);
|
|
41
|
+
assert.strictEqual(result.tasks.length, 1);
|
|
42
|
+
assert.strictEqual(result.tasks[0].name, 'compute');
|
|
43
|
+
assert.strictEqual(result.tasks[0].state.type, 'success');
|
|
44
|
+
// Verify workspace status reflects completion
|
|
45
|
+
const status = await workspaceStatus(ctx.config.baseUrl, ctx.repoName, 'exec-ws', opts);
|
|
46
|
+
const task = status.tasks[0];
|
|
47
|
+
assert.strictEqual(task.name, 'compute');
|
|
48
|
+
assert.strictEqual(task.status.type, 'up-to-date');
|
|
49
|
+
const outputDataset = status.datasets.find(d => d.path === '.tasks.compute.output');
|
|
50
|
+
assert.ok(outputDataset, 'Output dataset .tasks.compute.output should exist');
|
|
51
|
+
assert.strictEqual(outputDataset.status.type, 'up-to-date');
|
|
52
|
+
});
|
|
53
|
+
it('dataflowStart triggers execution (non-blocking)', async () => {
|
|
54
|
+
const ctx = getContext();
|
|
55
|
+
const opts = await ctx.opts();
|
|
56
|
+
// Should return immediately
|
|
57
|
+
await dataflowStart(ctx.config.baseUrl, ctx.repoName, 'exec-ws', { force: true }, opts);
|
|
58
|
+
// Poll until execution completes
|
|
59
|
+
const maxWait = 10000;
|
|
60
|
+
const startTime = Date.now();
|
|
61
|
+
let status = await workspaceStatus(ctx.config.baseUrl, ctx.repoName, 'exec-ws', opts);
|
|
62
|
+
while (Date.now() - startTime < maxWait) {
|
|
63
|
+
status = await workspaceStatus(ctx.config.baseUrl, ctx.repoName, 'exec-ws', opts);
|
|
64
|
+
const { upToDate } = status.summary.tasks;
|
|
65
|
+
// Done when task is up-to-date
|
|
66
|
+
if (upToDate === 1n) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
await new Promise(r => setTimeout(r, 100));
|
|
70
|
+
}
|
|
71
|
+
// Verify execution completed
|
|
72
|
+
assert.strictEqual(status.tasks[0].status.type, 'up-to-date');
|
|
73
|
+
});
|
|
74
|
+
it('dataflowExecution returns execution state', async () => {
|
|
75
|
+
const ctx = getContext();
|
|
76
|
+
const opts = await ctx.opts();
|
|
77
|
+
// Start execution
|
|
78
|
+
await dataflowStart(ctx.config.baseUrl, ctx.repoName, 'exec-ws', { force: true }, opts);
|
|
79
|
+
// Poll execution state until complete
|
|
80
|
+
const maxWait = 10000;
|
|
81
|
+
const startTime = Date.now();
|
|
82
|
+
while (Date.now() - startTime < maxWait) {
|
|
83
|
+
const state = await dataflowExecution(ctx.config.baseUrl, ctx.repoName, 'exec-ws', {}, opts);
|
|
84
|
+
if (state.status.type === 'completed') {
|
|
85
|
+
assert.ok(state.summary, 'completed execution should have summary');
|
|
86
|
+
assert.strictEqual(state.summary.type, 'some');
|
|
87
|
+
if (state.summary.type === 'some') {
|
|
88
|
+
assert.strictEqual(state.summary.value.executed, 1n);
|
|
89
|
+
assert.strictEqual(state.summary.value.failed, 0n);
|
|
90
|
+
}
|
|
91
|
+
return; // Test passed
|
|
92
|
+
}
|
|
93
|
+
if (state.status.type === 'failed') {
|
|
94
|
+
assert.fail('Execution should not have failed');
|
|
95
|
+
}
|
|
96
|
+
await new Promise(r => setTimeout(r, 100));
|
|
97
|
+
}
|
|
98
|
+
assert.fail('Execution did not complete in time');
|
|
99
|
+
});
|
|
100
|
+
it('taskLogs returns logs after execution', async () => {
|
|
101
|
+
const ctx = getContext();
|
|
102
|
+
const opts = await ctx.opts();
|
|
103
|
+
// Execute first
|
|
104
|
+
await dataflowExecute(ctx.config.baseUrl, ctx.repoName, 'exec-ws', { force: true }, opts);
|
|
105
|
+
// Get logs
|
|
106
|
+
const logs = await taskLogs(ctx.config.baseUrl, ctx.repoName, 'exec-ws', 'compute', { stream: 'stdout' }, opts);
|
|
107
|
+
// Logs should be returned (may be empty for simple tasks)
|
|
108
|
+
assert.ok(typeof logs.data === 'string');
|
|
109
|
+
assert.ok(typeof logs.offset === 'bigint');
|
|
110
|
+
assert.ok(typeof logs.size === 'bigint');
|
|
111
|
+
assert.ok(typeof logs.totalSize === 'bigint');
|
|
112
|
+
assert.ok(typeof logs.complete === 'boolean');
|
|
113
|
+
});
|
|
114
|
+
});
|
|
115
|
+
describe('diamond dependency execution', () => {
|
|
116
|
+
beforeEach(async () => {
|
|
117
|
+
const ctx = getContext();
|
|
118
|
+
const opts = await ctx.opts();
|
|
119
|
+
// Create and import diamond package (left, right, merge tasks)
|
|
120
|
+
const zipPath = await createDiamondPackageZip(ctx.tempDir, 'diamond-pkg', '1.0.0');
|
|
121
|
+
const packageZip = readFileSync(zipPath);
|
|
122
|
+
await packageImport(ctx.config.baseUrl, ctx.repoName, packageZip, opts);
|
|
123
|
+
await workspaceCreate(ctx.config.baseUrl, ctx.repoName, 'diamond-ws', opts);
|
|
124
|
+
await workspaceDeploy(ctx.config.baseUrl, ctx.repoName, 'diamond-ws', 'diamond-pkg@1.0.0', opts);
|
|
125
|
+
});
|
|
126
|
+
it('executes diamond dependency graph correctly', async () => {
|
|
127
|
+
const ctx = getContext();
|
|
128
|
+
const opts = await ctx.opts();
|
|
129
|
+
const result = await dataflowExecute(ctx.config.baseUrl, ctx.repoName, 'diamond-ws', { force: true }, opts);
|
|
130
|
+
// Should execute all three tasks
|
|
131
|
+
assert.strictEqual(result.success, true);
|
|
132
|
+
assert.strictEqual(result.executed, 3n);
|
|
133
|
+
assert.strictEqual(result.failed, 0n);
|
|
134
|
+
assert.strictEqual(result.tasks.length, 3);
|
|
135
|
+
// Verify all tasks succeeded
|
|
136
|
+
for (const task of result.tasks) {
|
|
137
|
+
assert.strictEqual(task.state.type, 'success', `Task ${task.name} should succeed`);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
it('tracks events during execution', async () => {
|
|
141
|
+
const ctx = getContext();
|
|
142
|
+
const opts = await ctx.opts();
|
|
143
|
+
// Start execution
|
|
144
|
+
await dataflowStart(ctx.config.baseUrl, ctx.repoName, 'diamond-ws', { force: true }, opts);
|
|
145
|
+
// Poll and collect events
|
|
146
|
+
const events = [];
|
|
147
|
+
const maxWait = 10000;
|
|
148
|
+
const startTime = Date.now();
|
|
149
|
+
while (Date.now() - startTime < maxWait) {
|
|
150
|
+
const state = await dataflowExecution(ctx.config.baseUrl, ctx.repoName, 'diamond-ws', { offset: events.length }, opts);
|
|
151
|
+
// Collect new events
|
|
152
|
+
events.push(...state.events);
|
|
153
|
+
if (state.status.type === 'completed' || state.status.type === 'failed') {
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
await new Promise(r => setTimeout(r, 100));
|
|
157
|
+
}
|
|
158
|
+
// Should have events for all tasks (start + complete for each)
|
|
159
|
+
// Diamond has 3 tasks: left, right, merge
|
|
160
|
+
// Expect at least 3 complete events
|
|
161
|
+
const completeEvents = events.filter((e) => typeof e === 'object' && e !== null && 'type' in e && e.type === 'complete');
|
|
162
|
+
assert.ok(completeEvents.length >= 3, `Expected at least 3 complete events, got ${completeEvents.length}`);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=dataflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dataflow.js","sourceRoot":"","sources":["../../../src/suites/dataflow.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,eAAe,EACf,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,QAAQ,GACT,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,gB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K,CAAC,MAAM,CAAC,IAAI,KAAK,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;wBACxE,MAAM;oBACR,CAAC;oBAED,MAAM,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC;gBAC7C,CAAC;gBAED,+DAA+D;gBAC/D,0CAA0C;gBAC1C,oCAAoC;gBACpC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAU,EAAE,EAAE,CAClD,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,IAAI,MAAM,IAAI,CAAC,IAAK,CAAsB,CAAC,IAAI,KAAK,UAAU,CAClG,CAAC;gBACF,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,MAAM,IAAI,CAAC,EAAE,4CAA4C,cAAc,CAAC,MAAM,EAAE,CAAC,CAAC;YAC7G,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { TestContext } from '../context.js';
|
|
6
|
+
/**
|
|
7
|
+
* Register dataset operation tests.
|
|
8
|
+
*
|
|
9
|
+
* @param getContext - Function that returns the current test context
|
|
10
|
+
*/
|
|
11
|
+
export declare function datasetTests(getContext: () => TestContext): void;
|
|
12
|
+
//# sourceMappingURL=datasets.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.d.ts","sourceRoot":"","sources":["../../../src/suites/datasets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAmFhE"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Dataset operations test suite.
|
|
7
|
+
*
|
|
8
|
+
* Tests: list, listAt, get, set
|
|
9
|
+
*/
|
|
10
|
+
import { describe, it, beforeEach } from 'node:test';
|
|
11
|
+
import assert from 'node:assert/strict';
|
|
12
|
+
import { readFileSync } from 'node:fs';
|
|
13
|
+
import { StringType, encodeBeast2For, decodeBeast2For, variant } from '@elaraai/east';
|
|
14
|
+
import { packageImport, workspaceCreate, workspaceDeploy, datasetList, datasetListAt, datasetGet, datasetSet, } from '@elaraai/e3-api-client';
|
|
15
|
+
import { createStringPackageZip } from '../fixtures.js';
|
|
16
|
+
/**
|
|
17
|
+
* Register dataset operation tests.
|
|
18
|
+
*
|
|
19
|
+
* @param getContext - Function that returns the current test context
|
|
20
|
+
*/
|
|
21
|
+
export function datasetTests(getContext) {
|
|
22
|
+
describe('datasets', () => {
|
|
23
|
+
beforeEach(async () => {
|
|
24
|
+
const ctx = getContext();
|
|
25
|
+
const opts = await ctx.opts();
|
|
26
|
+
// Create package with string input
|
|
27
|
+
const zipPath = await createStringPackageZip(ctx.tempDir, 'dataset-pkg', '1.0.0');
|
|
28
|
+
const packageZip = readFileSync(zipPath);
|
|
29
|
+
await packageImport(ctx.config.baseUrl, ctx.repoName, packageZip, opts);
|
|
30
|
+
await workspaceCreate(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', opts);
|
|
31
|
+
await workspaceDeploy(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', 'dataset-pkg@1.0.0', opts);
|
|
32
|
+
});
|
|
33
|
+
it('datasetList returns field names', async () => {
|
|
34
|
+
const ctx = getContext();
|
|
35
|
+
const opts = await ctx.opts();
|
|
36
|
+
const fields = await datasetList(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', opts);
|
|
37
|
+
// Should have inputs and tasks (outputs are under tasks)
|
|
38
|
+
assert.ok(fields.includes('inputs'));
|
|
39
|
+
assert.ok(fields.includes('tasks'));
|
|
40
|
+
});
|
|
41
|
+
it('datasetListAt returns nested fields', async () => {
|
|
42
|
+
const ctx = getContext();
|
|
43
|
+
const opts = await ctx.opts();
|
|
44
|
+
const path = [variant('field', 'inputs')];
|
|
45
|
+
const fields = await datasetListAt(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', path, opts);
|
|
46
|
+
assert.ok(Array.isArray(fields));
|
|
47
|
+
assert.ok(fields.includes('config'), 'should have config field under inputs');
|
|
48
|
+
});
|
|
49
|
+
it('datasetSet and datasetGet round-trip', async () => {
|
|
50
|
+
const ctx = getContext();
|
|
51
|
+
const opts = await ctx.opts();
|
|
52
|
+
// Encode value as BEAST2
|
|
53
|
+
const encode = encodeBeast2For(StringType);
|
|
54
|
+
const decode = decodeBeast2For(StringType);
|
|
55
|
+
const data = encode('hello world');
|
|
56
|
+
// Set - TreePath uses variant('field', name) elements
|
|
57
|
+
const path = [
|
|
58
|
+
variant('field', 'inputs'),
|
|
59
|
+
variant('field', 'config'),
|
|
60
|
+
];
|
|
61
|
+
await datasetSet(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', path, data, opts);
|
|
62
|
+
// Get and decode
|
|
63
|
+
const retrieved = await datasetGet(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', path, opts);
|
|
64
|
+
assert.ok(retrieved instanceof Uint8Array);
|
|
65
|
+
const decoded = decode(retrieved);
|
|
66
|
+
assert.strictEqual(decoded, 'hello world');
|
|
67
|
+
});
|
|
68
|
+
it('datasetSet overwrites existing value', async () => {
|
|
69
|
+
const ctx = getContext();
|
|
70
|
+
const opts = await ctx.opts();
|
|
71
|
+
const encode = encodeBeast2For(StringType);
|
|
72
|
+
const decode = decodeBeast2For(StringType);
|
|
73
|
+
const path = [
|
|
74
|
+
variant('field', 'inputs'),
|
|
75
|
+
variant('field', 'config'),
|
|
76
|
+
];
|
|
77
|
+
// Set initial value
|
|
78
|
+
await datasetSet(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', path, encode('first'), opts);
|
|
79
|
+
// Overwrite with new value
|
|
80
|
+
await datasetSet(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', path, encode('second'), opts);
|
|
81
|
+
// Verify new value
|
|
82
|
+
const retrieved = await datasetGet(ctx.config.baseUrl, ctx.repoName, 'dataset-ws', path, opts);
|
|
83
|
+
const decoded = decode(retrieved);
|
|
84
|
+
assert.strictEqual(decoded, 'second');
|
|
85
|
+
});
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=datasets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datasets.js","sourceRoot":"","sources":["../../../src/suites/datasets.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACtF,OAAO,EACL,aAAa,EACb,eAAe,EACf,eAAe,EACf,WAAW,EACX,aAAa,EACb,UAAU,EACV,UAAU,GACX,MAAM,wBAAwB,CAAC;AAGhC,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,UAA6B;IACxD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,UAAU,CAAC,KAAK,IAAI,EAAE;YACpB,MAAM,GAAG,GAAG,UAAU,EAAE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AC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 Elara AI Pty Ltd
|
|
3
|
+
* Licensed under BSL 1.1. See LICENSE for details.
|
|
4
|
+
*/
|
|
5
|
+
import type { TestContext } from '../context.js';
|
|
6
|
+
/**
|
|
7
|
+
* Register package operation tests.
|
|
8
|
+
*
|
|
9
|
+
* @param getContext - Function that returns the current test context
|
|
10
|
+
*/
|
|
11
|
+
export declare function packageTests(getContext: () => TestContext): void;
|
|
12
|
+
//# sourceMappingURL=packages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"packages.d.ts","sourceRoot":"","sources":["../../../src/suites/packages.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAoBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAGjD;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAkFhE"}
|