-
Notifications
You must be signed in to change notification settings - Fork 135
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 hidden in the interface when the bundle name does not match the regular expression defined in the settings - a version cannot be created by the compute version if the bundle name does not match the above mentioned regular expression
- Loading branch information
Showing
6 changed files
with
47 additions
and
9 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,25 @@ | ||
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 | ||
}) | ||
self.assertTrue(saas_bundle.match_base) | ||
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.assertFalse(dev_bundle.match_base) | ||
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_bundle.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.name, saas_name) |
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