Add integration connector plugins and compose fixtures

Scaffold connector plugins for DockerRegistry, GitLab, Gitea,
Jenkins, and Nexus. Wire plugin discovery in IntegrationService
and add compose fixtures for local integration testing.

- 5 new connector plugins under src/Integrations/__Plugins/
- docker-compose.integrations.yml for local fixture services
- Advisory source catalog and source management API updates
- Integration e2e test specs and Playwright config
- Integration hub docs under docs/integrations/

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
master
2026-03-30 17:24:56 +03:00
parent 8931fc7c0c
commit 89a075ea21
23 changed files with 3033 additions and 6 deletions

View File

@@ -0,0 +1,385 @@
/**
* Integration Services — End-to-End Test Suite
*
* Live infrastructure tests that validate the full integration lifecycle:
* 1. Docker compose health (fixtures + real services)
* 2. Direct endpoint probes to each 3rd-party service
* 3. Stella Ops connector plugin API (create, test, health, delete)
* 4. UI verification (Hub counts, tab switching, list views)
* 5. Advisory source catalog (74/74 healthy)
*
* Prerequisites:
* - Main Stella Ops stack running (docker-compose.stella-ops.yml)
* - Integration fixtures running (docker-compose.integration-fixtures.yml)
* - Integration services running (docker-compose.integrations.yml)
*
* Usage:
* PLAYWRIGHT_BASE_URL=https://stella-ops.local npx playwright test e2e/integrations.e2e.spec.ts
*/
import { execSync } from 'child_process';
import { test, expect } from './fixtures/live-auth.fixture';
const SCREENSHOT_DIR = 'e2e/screenshots/integrations';
const BASE = process.env['PLAYWRIGHT_BASE_URL'] || 'https://stella-ops.local';
// ---------------------------------------------------------------------------
// Helpers
// ---------------------------------------------------------------------------
function dockerHealthy(containerName: string): boolean {
try {
const out = execSync(
`docker ps --filter "name=${containerName}" --format "{{.Status}}"`,
{ encoding: 'utf-8', timeout: 5_000 },
).trim();
return out.includes('(healthy)') || (out.startsWith('Up') && !out.includes('health: starting'));
} catch {
return false;
}
}
function dockerRunning(containerName: string): boolean {
try {
const out = execSync(
`docker ps --filter "name=${containerName}" --format "{{.Status}}"`,
{ encoding: 'utf-8', timeout: 5_000 },
).trim();
return out.startsWith('Up');
} catch {
return false;
}
}
async function snap(page: import('@playwright/test').Page, label: string) {
await page.screenshot({ path: `${SCREENSHOT_DIR}/${label}.png`, fullPage: true });
}
// ---------------------------------------------------------------------------
// 1. Compose Health
// ---------------------------------------------------------------------------
test.describe('Integration Services — Compose Health', () => {
const fixtures = [
'stellaops-harbor-fixture',
'stellaops-github-app-fixture',
'stellaops-advisory-fixture',
];
const services = [
'stellaops-gitea',
'stellaops-jenkins',
'stellaops-nexus',
'stellaops-vault',
'stellaops-docker-registry',
'stellaops-minio',
];
for (const name of fixtures) {
test(`fixture container ${name} is healthy`, () => {
expect(dockerHealthy(name), `${name} should be healthy`).toBe(true);
});
}
for (const name of services) {
test(`service container ${name} is running`, () => {
expect(dockerRunning(name), `${name} should be running`).toBe(true);
});
}
test('core integrations-web service is healthy', () => {
expect(dockerHealthy('stellaops-integrations-web')).toBe(true);
});
test('core concelier service is healthy', () => {
expect(dockerHealthy('stellaops-concelier')).toBe(true);
});
});
// ---------------------------------------------------------------------------
// 2. Direct Endpoint Probes
// ---------------------------------------------------------------------------
test.describe('Integration Services — Direct Endpoint Probes', () => {
const probes: Array<{ name: string; url: string; expect: string | number }> = [
{ name: 'Harbor fixture', url: 'http://127.1.1.6/api/v2.0/health', expect: 'healthy' },
{ name: 'GitHub App fixture', url: 'http://127.1.1.7/api/v3/app', expect: 'Stella QA' },
{ name: 'Advisory fixture', url: 'http://127.1.1.8/health', expect: 'healthy' },
{ name: 'Gitea', url: 'http://127.1.2.1:3000/api/v1/version', expect: 'version' },
{ name: 'Jenkins', url: 'http://127.1.2.2:8080/api/json', expect: 200 },
{ name: 'Nexus', url: 'http://127.1.2.3:8081/service/rest/v1/status', expect: 200 },
{ name: 'Vault', url: 'http://127.1.2.4:8200/v1/sys/health', expect: 200 },
{ name: 'Docker Registry', url: 'http://127.1.2.5:5000/v2/', expect: 200 },
{ name: 'MinIO', url: 'http://127.1.2.6:9000/minio/health/live', expect: 200 },
];
for (const probe of probes) {
test(`${probe.name} responds at ${new URL(probe.url).pathname}`, async ({ playwright }) => {
const ctx = await playwright.request.newContext({ ignoreHTTPSErrors: true });
try {
const resp = await ctx.get(probe.url, { timeout: 10_000 });
expect(resp.status(), `${probe.name} should return 2xx`).toBeLessThan(300);
if (typeof probe.expect === 'string') {
const body = await resp.text();
expect(body).toContain(probe.expect);
}
} finally {
await ctx.dispose();
}
});
}
});
// ---------------------------------------------------------------------------
// 3. Stella Ops Connector Lifecycle
// ---------------------------------------------------------------------------
test.describe('Integration Services — Connector Lifecycle', () => {
const createdIds: string[] = [];
const integrations = [
{
name: 'E2E Harbor Registry',
type: 1, // Registry
provider: 100, // Harbor
endpoint: 'http://harbor-fixture.stella-ops.local',
authRefUri: null,
organizationId: 'e2e-test',
extendedConfig: { scheduleType: 'manual', repositories: ['e2e/test'] },
tags: ['e2e'],
},
{
name: 'E2E Docker Registry',
type: 1,
provider: 104, // DockerHub
endpoint: 'http://oci-registry.stella-ops.local:5000',
authRefUri: null,
organizationId: null,
extendedConfig: { scheduleType: 'manual' },
tags: ['e2e'],
},
{
name: 'E2E Nexus Repository',
type: 1,
provider: 107, // Nexus
endpoint: 'http://nexus.stella-ops.local:8081',
authRefUri: null,
organizationId: null,
extendedConfig: { scheduleType: 'manual' },
tags: ['e2e'],
},
{
name: 'E2E Gitea SCM',
type: 2, // Scm
provider: 203, // Gitea
endpoint: 'http://gitea.stella-ops.local:3000',
authRefUri: null,
organizationId: 'e2e',
extendedConfig: { scheduleType: 'manual', repositories: ['e2e/repo'] },
tags: ['e2e'],
},
{
name: 'E2E Jenkins CI',
type: 3, // CiCd
provider: 302, // Jenkins
endpoint: 'http://jenkins.stella-ops.local:8080',
authRefUri: null,
organizationId: null,
extendedConfig: { scheduleType: 'manual' },
tags: ['e2e'],
},
];
test('GET /providers returns at least 8 connector plugins', async ({ apiRequest }) => {
const resp = await apiRequest.get('/api/v1/integrations/providers');
expect(resp.status()).toBe(200);
const providers = await resp.json();
expect(providers.length).toBeGreaterThanOrEqual(8);
});
for (const integration of integrations) {
test(`create ${integration.name} and auto-activate`, async ({ apiRequest }) => {
const resp = await apiRequest.post('/api/v1/integrations', { data: integration });
expect(resp.status()).toBe(201);
const body = await resp.json();
createdIds.push(body.id);
expect(body.name).toBe(integration.name);
// Auto-test should set status to Active (1) for reachable services
expect(body.status, `${integration.name} should be Active after auto-test`).toBe(1);
});
}
test('list integrations returns correct counts per type', async ({ apiRequest }) => {
const registries = await apiRequest.get('/api/v1/integrations?type=1&pageSize=100');
const scm = await apiRequest.get('/api/v1/integrations?type=2&pageSize=100');
const cicd = await apiRequest.get('/api/v1/integrations?type=3&pageSize=100');
const regBody = await registries.json();
const scmBody = await scm.json();
const cicdBody = await cicd.json();
expect(regBody.totalCount).toBeGreaterThanOrEqual(3);
expect(scmBody.totalCount).toBeGreaterThanOrEqual(1);
expect(cicdBody.totalCount).toBeGreaterThanOrEqual(1);
});
test('test-connection succeeds on all created integrations', async ({ apiRequest }) => {
for (const id of createdIds) {
const resp = await apiRequest.post(`/api/v1/integrations/${id}/test`);
expect(resp.status()).toBe(200);
const body = await resp.json();
expect(body.success, `test-connection for ${id} should succeed`).toBe(true);
}
});
test('health-check returns healthy on all created integrations', async ({ apiRequest }) => {
for (const id of createdIds) {
const resp = await apiRequest.get(`/api/v1/integrations/${id}/health`);
expect(resp.status()).toBe(200);
const body = await resp.json();
// HealthStatus.Healthy = 1
expect(body.status, `health for ${id} should be Healthy`).toBe(1);
}
});
test.afterAll(async ({ playwright }) => {
// Clean up: get a fresh token and delete all e2e integrations
if (createdIds.length === 0) return;
const browser = await playwright.chromium.launch();
const page = await browser.newPage({ ignoreHTTPSErrors: true });
await page.goto(BASE, { waitUntil: 'domcontentloaded' });
if (page.url().includes('/welcome')) {
await page.getByRole('button', { name: /sign in/i }).click();
await page.waitForURL('**/connect/authorize**', { timeout: 10_000 });
}
const usernameField = page.getByRole('textbox', { name: /username/i });
if (await usernameField.isVisible({ timeout: 5_000 }).catch(() => false)) {
await usernameField.fill('admin');
await page.getByRole('textbox', { name: /password/i }).fill('Admin@Stella2026!');
await page.getByRole('button', { name: /sign in/i }).click();
await page.waitForURL(`${BASE}/**`, { timeout: 15_000 });
}
await page.waitForLoadState('networkidle');
const token = await page.evaluate(() => {
const s = sessionStorage.getItem('stellaops.auth.session.full');
return s ? JSON.parse(s)?.tokens?.accessToken : null;
});
if (token) {
for (const id of createdIds) {
await page.evaluate(
async ([id, token]) => {
await fetch(`/api/v1/integrations/${id}`, {
method: 'DELETE',
headers: { Authorization: `Bearer ${token}` },
});
},
[id, token] as const,
);
}
}
await browser.close();
});
});
// ---------------------------------------------------------------------------
// 4. Advisory Sources
// ---------------------------------------------------------------------------
test.describe('Integration Services — Advisory Sources', () => {
test('all advisory sources report healthy after check', async ({ apiRequest }) => {
// Trigger a full check (this takes ~60-90 seconds)
const checkResp = await apiRequest.post('/api/v1/advisory-sources/check', { timeout: 120_000 });
expect(checkResp.status()).toBe(200);
const result = await checkResp.json();
expect(result.totalChecked).toBeGreaterThanOrEqual(42);
expect(result.failedCount, `Expected 0 failed sources, got ${result.failedCount}`).toBe(0);
});
});
// ---------------------------------------------------------------------------
// 5. UI Verification
// ---------------------------------------------------------------------------
test.describe('Integration Services — UI Verification', () => {
test('Hub tab shows correct connector counts', async ({ liveAuthPage: page }) => {
await page.goto(`${BASE}/setup/integrations`, { waitUntil: 'networkidle', timeout: 30_000 });
await page.waitForLoadState('domcontentloaded');
await page.waitForTimeout(2_000);
// Check that configured connectors count is shown
const countText = await page.locator('text=/configured connectors/').textContent();
expect(countText).toBeTruthy();
await snap(page, '01-hub-overview');
});
test('Registries tab lists registry integrations', async ({ liveAuthPage: page }) => {
await page.goto(`${BASE}/setup/integrations/registries`, { waitUntil: 'networkidle', timeout: 30_000 });
await page.waitForTimeout(2_000);
const heading = page.getByRole('heading', { name: /registry/i });
await expect(heading).toBeVisible({ timeout: 5_000 });
// Should have at least one row in the table
const rows = page.locator('table tbody tr');
const count = await rows.count();
expect(count).toBeGreaterThanOrEqual(1);
await snap(page, '02-registries-tab');
});
test('SCM tab lists SCM integrations', async ({ liveAuthPage: page }) => {
await page.goto(`${BASE}/setup/integrations/scm`, { waitUntil: 'networkidle', timeout: 30_000 });
await page.waitForTimeout(2_000);
const heading = page.getByRole('heading', { name: /scm/i });
await expect(heading).toBeVisible({ timeout: 5_000 });
const rows = page.locator('table tbody tr');
const count = await rows.count();
expect(count).toBeGreaterThanOrEqual(1);
await snap(page, '03-scm-tab');
});
test('CI/CD tab lists CI/CD integrations', async ({ liveAuthPage: page }) => {
await page.goto(`${BASE}/setup/integrations/ci`, { waitUntil: 'networkidle', timeout: 30_000 });
await page.waitForTimeout(2_000);
const heading = page.getByRole('heading', { name: /ci\/cd/i });
await expect(heading).toBeVisible({ timeout: 5_000 });
const rows = page.locator('table tbody tr');
const count = await rows.count();
expect(count).toBeGreaterThanOrEqual(1);
await snap(page, '04-cicd-tab');
});
test('tab switching navigates between all tabs', async ({ liveAuthPage: page }) => {
await page.goto(`${BASE}/setup/integrations`, { waitUntil: 'networkidle', timeout: 30_000 });
await page.waitForTimeout(2_000);
const tabs = ['Registries', 'SCM', 'CI/CD', 'Runtimes / Hosts', 'Advisory & VEX', 'Secrets', 'Hub'];
for (const tabName of tabs) {
const tab = page.getByRole('tab', { name: tabName });
await tab.click();
await page.waitForTimeout(500);
// Verify tab is now selected
const isSelected = await tab.getAttribute('aria-selected');
expect(isSelected, `Tab "${tabName}" should be selected after click`).toBe('true');
}
await snap(page, '05-tab-switching-final');
});
});