-
Notifications
You must be signed in to change notification settings - Fork 133
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When updating a bundle and changing the is_base field to True, it creates a new version based on the bundle name. This can potentially breaks builds and moreover, it can breaks the whole runbot when a duplicate version name is created. With this commit: - a constraint on the version name uniqueness is added - the is_base field is now readonky - a version cannot be created by the compute version if the version name does not match the above mentioned regular expression
- Loading branch information
Showing
5 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,4 @@ | |
from . import test_upgrade | ||
from . import test_dockerfile | ||
from . import test_host | ||
from . import test_bundle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from .common import RunbotCase | ||
|
||
class TestBundleCreation(RunbotCase): | ||
def test_version_at_bundle_creation(self): | ||
saas_name = 'saas-27.2' | ||
saas_bundle = self.Bundle.create({ | ||
'name': saas_name, | ||
'project_id': self.project.id | ||
}) | ||
saas_bundle.is_base = True | ||
self.assertEqual(saas_bundle.version_id.name, saas_name, 'The bundle version_id should create base version') | ||
|
||
dev_name = 'saas-27.2-brol-bro' | ||
dev_bundle = self.Bundle.create({ | ||
'name': dev_name, | ||
'project_id': self.project.id | ||
}) | ||
self.assertEqual(dev_bundle.version_id.name, saas_name) | ||
|
||
self.assertFalse(self.Version.search([('name', '=', dev_name)]), 'A dev bundle should not summon a new version') | ||
dev_name = 'saas-27.2-brol-zzz' | ||
dev_bundle = self.Bundle.create({ | ||
'name': dev_name, | ||
'project_id': self.project.id, | ||
'is_base': True | ||
}) | ||
self.assertFalse(self.Version.search([('name', '=', dev_name)]), 'A dev bundle should not summon a new version, even if is_base is True') | ||
self.assertEqual(dev_bundle.version_id.id, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters