fix(registry): restore protocol routing and test coverage for npm, oci, and api flows
This commit is contained in:
@@ -81,5 +81,8 @@ export {
|
||||
setupTestStorage,
|
||||
} from './storage.helper.ts';
|
||||
|
||||
// Server helpers
|
||||
export { getTestRegistry, startTestServer, stopTestServer } from './server.helper.ts';
|
||||
|
||||
// Re-export test config
|
||||
export { getTestConfig, testConfig } from '../test.config.ts';
|
||||
|
||||
49
test/helpers/server.helper.ts
Normal file
49
test/helpers/server.helper.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Server helper - starts/stops the registry server for integration and E2E tests
|
||||
*/
|
||||
|
||||
import { StackGalleryRegistry } from '../../ts/registry.ts';
|
||||
import { testConfig } from '../test.config.ts';
|
||||
|
||||
let registry: StackGalleryRegistry | null = null;
|
||||
|
||||
/**
|
||||
* Start the registry server for testing
|
||||
*/
|
||||
export async function startTestServer(): Promise<StackGalleryRegistry> {
|
||||
if (registry) return registry;
|
||||
|
||||
// Set JWT_SECRET env var so ApiRouter's AuthService uses the same secret
|
||||
Deno.env.set('JWT_SECRET', testConfig.jwt.secret);
|
||||
|
||||
registry = new StackGalleryRegistry({
|
||||
mongoUrl: testConfig.mongodb.url,
|
||||
mongoDb: testConfig.mongodb.name,
|
||||
s3Endpoint: testConfig.s3.endpoint,
|
||||
s3AccessKey: testConfig.s3.accessKey,
|
||||
s3SecretKey: testConfig.s3.secretKey,
|
||||
s3Bucket: testConfig.s3.bucket,
|
||||
s3Region: testConfig.s3.region,
|
||||
port: testConfig.registry.port,
|
||||
jwtSecret: testConfig.jwt.secret,
|
||||
});
|
||||
await registry.start();
|
||||
return registry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stop the registry server
|
||||
*/
|
||||
export async function stopTestServer(): Promise<void> {
|
||||
if (registry) {
|
||||
await registry.stop();
|
||||
registry = null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current registry instance
|
||||
*/
|
||||
export function getTestRegistry(): StackGalleryRegistry | null {
|
||||
return registry;
|
||||
}
|
||||
@@ -98,7 +98,7 @@ export const clients = {
|
||||
docker: {
|
||||
check: () => commandExists('docker'),
|
||||
build: (dockerfile: string, tag: string, context: string) =>
|
||||
runCommand(['docker', 'build', '-f', dockerfile, '-t', tag, context]),
|
||||
runCommand(['docker', 'build', '--load', '-f', dockerfile, '-t', tag, context]),
|
||||
push: (image: string) => runCommand(['docker', 'push', image]),
|
||||
pull: (image: string) => runCommand(['docker', 'pull', image]),
|
||||
rmi: (image: string, force = false) =>
|
||||
|
||||
Reference in New Issue
Block a user