Feat v0.7.2 package runners ci gate (#56)
All checks were successful
CI/CD / detect-changes (push) Successful in 4s
CI/CD / test-runners (push) Has been skipped
CI/CD / test-frontend (push) Successful in 6s
CI/CD / test-go-pg (push) Successful in 2m39s
CI/CD / test-sqlite (push) Successful in 2m55s
CI/CD / build-and-deploy (push) Successful in 29s

Co-authored-by: Jeffrey Smith <jasafpro@gmail.com>
Co-committed-by: Jeffrey Smith <jasafpro@gmail.com>
This commit was merged in pull request #56.
This commit is contained in:
2026-04-02 12:10:57 +00:00
committed by xcaliber
parent 829caa3b20
commit d6c7b21713
37 changed files with 1504 additions and 36 deletions

View File

@@ -0,0 +1,62 @@
/**
* Schedules Runner — Entry Point
*
* Boot SDK, load test modules.
* Each module is an IIFE that registers suites via sw.testing.suite().
*/
(async function () {
'use strict';
try {
var base = window.__BASE__ || '';
var ver = window.__VERSION__ || '0';
if (!window.preact) {
var { h, render } = await import(base + '/js/sw/vendor/preact.module.js');
var hooksModule = await import(base + '/js/sw/vendor/hooks.module.js');
var htmModule = await import(base + '/js/sw/vendor/htm.module.js');
window.preact = { h, render };
window.hooks = hooksModule;
window.html = htmModule.default.bind(h);
}
var sdk = await import(base + '/js/sw/sdk/index.js?v=' + ver);
await sdk.boot();
} catch (e) {
console.warn('[SchedRunner] SDK boot failed:', e.message);
}
window.SR = {
base: window.__BASE__ || '',
api: '/api/v1/schedules'
};
var surfaceId = 'schedules-runner';
var assetBase = '/surfaces/' + surfaceId + '/js/';
if (window.SR.base) assetBase = window.SR.base + assetBase;
var modules = [
'schedules-crud.js'
];
var loaded = 0;
function loadNext() {
if (loaded >= modules.length) { onReady(); return; }
var script = document.createElement('script');
script.src = assetBase + modules[loaded] + '?v=' + (window.__VERSION__ || '0') + '.' + Date.now();
script.onload = function () { loaded++; loadNext(); };
script.onerror = function () {
console.error('[SchedRunner] Failed to load: ' + modules[loaded]);
loaded++; loadNext();
};
document.body.appendChild(script);
}
function onReady() {
console.log('[SchedRunner] All modules loaded — ' + sw.testing.suites().length + ' suites registered');
var manifest = window.__MANIFEST__ || {};
if (manifest.id === surfaceId) {
window.location.href = (window.__BASE__ || '') + '/s/test-runners';
}
}
loadNext();
})();

View File

@@ -0,0 +1,65 @@
/**
* Schedules Runner — schedules/crud suite
*
* Tests schedule CRUD via the kernel schedules API.
*/
(function () {
'use strict';
var API = window.SR.api;
sw.testing.suite('schedules/crud', async function (s) {
var schedId;
s.test('create schedule', async function (t) {
var r = await sw.api.post(API, {
name: 'runner-test-' + Date.now(),
cron_expr: '0 0 * * *',
script: 'print("hello from schedule runner")',
enabled: false
});
t.assert.ok(r.id, 'schedule has id');
t.assert.ok(r.name, 'schedule has name');
schedId = r.id;
s.track('schedule', schedId);
});
s.test('get schedule', async function (t) {
t.assert.ok(schedId, 'schedId from previous test');
var r = await sw.api.get(API + '/' + schedId);
t.assert.eq(r.id, schedId, 'id matches');
t.assert.ok(r.cron_expr, 'cron_expr present');
});
s.test('update schedule', async function (t) {
t.assert.ok(schedId, 'schedId from previous test');
var r = await sw.api.put(API + '/' + schedId, {
name: 'runner-test-updated',
cron_expr: '30 2 * * *'
});
t.assert.eq(r.name, 'runner-test-updated', 'name updated');
});
s.test('run schedule', async function (t) {
t.assert.ok(schedId, 'schedId from previous test');
try {
await sw.api.post(API + '/' + schedId + '/run', {});
t.assert.ok(true, 'run endpoint returned successfully');
} catch (e) {
t.warn('Schedule run failed: ' + e.message);
}
});
s.test('delete schedule', async function (t) {
t.assert.ok(schedId, 'schedId from previous test');
await sw.api.del(API + '/' + schedId);
try {
await sw.api.get(API + '/' + schedId);
t.assert.ok(false, 'expected error after delete');
} catch (e) {
t.assert.ok(true, 'schedule not found after delete');
}
schedId = null;
});
});
})();

View File

@@ -0,0 +1,9 @@
{
"id": "schedules-runner",
"icon": "⏰",
"type": "test-runner",
"title": "Schedules Runner",
"auth": "admin",
"version": "0.1.0",
"description": "Integration tests for Schedules package — CRUD, run, enable/disable."
}