feat: wire service registry targets
This commit is contained in:
@@ -157,6 +157,39 @@ tap.test('should deny OCI registry push tokens for non-admin users', async () =>
|
||||
expect(pushResponse.status).toEqual(403);
|
||||
});
|
||||
|
||||
tap.test('should expose generated service registry targets', async () => {
|
||||
const image = await testClient.image.createImage({
|
||||
name: 'Registry Target Test Image',
|
||||
description: 'Image used by the registry target test',
|
||||
});
|
||||
const service = await testClient.services.createService({
|
||||
name: 'Registry Target Test Service',
|
||||
description: 'Service used by the registry target test',
|
||||
imageId: image.id,
|
||||
imageVersion: 'latest',
|
||||
environment: {},
|
||||
secretBundleId: '',
|
||||
serviceCategory: 'workload',
|
||||
deploymentStrategy: 'custom',
|
||||
scaleFactor: 1,
|
||||
balancingStrategy: 'round-robin',
|
||||
ports: {
|
||||
web: 3000,
|
||||
},
|
||||
domains: [],
|
||||
deploymentIds: [],
|
||||
});
|
||||
|
||||
const registryTarget = await testClient.services.getRegistryTarget(service.id, 'latest');
|
||||
expect(registryTarget.protocol).toEqual('oci');
|
||||
expect(registryTarget.registryHost).toEqual(`${helpers.testCloudlyConfig.publicUrl}:${helpers.testCloudlyConfig.publicPort}`);
|
||||
expect(registryTarget.repository.startsWith('workloads/registry-target-test-service-')).toBeTrue();
|
||||
expect(registryTarget.imageUrl).toEqual(`${registryTarget.registryHost}/${registryTarget.repository}:latest`);
|
||||
|
||||
const refreshedService = await testClient.services.getServiceById(service.id);
|
||||
expect(refreshedService.data.registryTarget?.imageUrl).toEqual(registryTarget.imageUrl);
|
||||
});
|
||||
|
||||
tap.test('should expose platform desired state', async () => {
|
||||
const capabilitiesResponse = await testClient.platform.getPlatformCapabilities();
|
||||
expect(capabilitiesResponse.capabilities.find((capability) => capability.id === 'database')).toBeTruthy();
|
||||
|
||||
Reference in New Issue
Block a user