mirror of
https://github.com/coollabsio/coolify.git
synced 2026-10-28 09:34:36 +08:00
Cloning a clone added another "-clone-<id>" to the name, so after about seven clones the name was longer than 255 characters and the insert failed. Closes #9976
26 lines
992 B
PHP
26 lines
992 B
PHP
<?php
|
|
|
|
it('adds a clone suffix to the source name', function () {
|
|
expect(clone_resource_name('Gitea Runner', 'abc123def456ghi789jkl012'))
|
|
->toBe('Gitea Runner-clone-abc123def456ghi789jkl012');
|
|
});
|
|
|
|
it('replaces the clone suffixes of earlier clones', function () {
|
|
$name = 'Gitea Runner-clone-sy2cojnseswr8szrpj1omsgw-clone-yvj9kdc2xuff8td0f0mps7eq-clone-ab12cd3';
|
|
|
|
expect(clone_resource_name($name, 'newid000000000000000000a'))
|
|
->toBe('Gitea Runner-clone-newid000000000000000000a');
|
|
});
|
|
|
|
it('keeps a name that only contains the word clone', function () {
|
|
expect(clone_resource_name('my-clone-db', 'abc123def456ghi789jkl012'))
|
|
->toBe('my-clone-db-clone-abc123def456ghi789jkl012');
|
|
});
|
|
|
|
it('keeps the clone name within the 255 characters of the name column', function () {
|
|
$name = clone_resource_name(str_repeat('a', 255), 'abc123def456ghi789jkl012');
|
|
|
|
expect($name)->toHaveLength(255)
|
|
->toEndWith('-clone-abc123def456ghi789jkl012');
|
|
});
|