fix: trim registry repository slugs
This commit is contained in:
@@ -191,6 +191,18 @@ tap.test('should expose generated service registry targets', async () => {
|
|||||||
expect(refreshedService.data.registryTarget?.imageUrl).toEqual(registryTarget.imageUrl);
|
expect(refreshedService.data.registryTarget?.imageUrl).toEqual(registryTarget.imageUrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
tap.test('should trim truncated registry repository suffixes', async () => {
|
||||||
|
const registryTarget = testCloudly.registryManager.getServiceRegistryTarget({
|
||||||
|
id: 'service-5gv-123456',
|
||||||
|
data: {
|
||||||
|
name: 'Registry Target Test Service',
|
||||||
|
},
|
||||||
|
} as any);
|
||||||
|
|
||||||
|
expect(registryTarget.repository).toEqual('workloads/registry-target-test-service-service-5gv');
|
||||||
|
expect(registryTarget.repository.split('/').every((partArg) => /^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(partArg))).toBeTrue();
|
||||||
|
});
|
||||||
|
|
||||||
tap.test('should push service config updates to connected coreflows', async (toolsArg) => {
|
tap.test('should push service config updates to connected coreflows', async (toolsArg) => {
|
||||||
const cluster = await testClient.cluster.createCluster('Registry Config Push Test Cluster');
|
const cluster = await testClient.cluster.createCluster('Registry Config Push Test Cluster');
|
||||||
const persistedCluster = await testCloudly.clusterManager.getConfigBy_ConfigID(cluster.id);
|
const persistedCluster = await testCloudly.clusterManager.getConfigBy_ConfigID(cluster.id);
|
||||||
|
|||||||
@@ -246,7 +246,7 @@ export class CloudlyRegistryManager {
|
|||||||
private getServiceRepository(serviceArg: Service) {
|
private getServiceRepository(serviceArg: Service) {
|
||||||
const serviceName = this.slugify(serviceArg.data?.name || serviceArg.id);
|
const serviceName = this.slugify(serviceArg.data?.name || serviceArg.id);
|
||||||
const serviceId = this.slugify(serviceArg.id).slice(0, 12) || serviceArg.id;
|
const serviceId = this.slugify(serviceArg.id).slice(0, 12) || serviceArg.id;
|
||||||
return `workloads/${serviceName}-${serviceId}`;
|
return `workloads/${this.slugify(`${serviceName}-${serviceId}`)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
private slugify(valueArg: string) {
|
private slugify(valueArg: string) {
|
||||||
|
|||||||
Reference in New Issue
Block a user