Module: check_mk
Branch: master
Commit: 5733078f92087f54da1965ec1a2c48ea9829cfb9
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=5733078f92087f…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Tue Feb 21 12:30:50 2017 +0100
Test site now uses branch specific daily version in daily/git version mode
Change-Id: I62b7e40f675db722713893aa4c89823a5830c074
---
tests/conftest.py | 5 ++++-
tests/testlib/__init__.py | 16 ++++++++++------
2 files changed, 14 insertions(+), 7 deletions(-)
diff --git a/tests/conftest.py b/tests/conftest.py
index a005291..3c01873 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -74,11 +74,14 @@ def _get_site_object():
def site_edition():
return os.environ.get("EDITION", testlib.CMKVersion.CEE)
+ def site_branch():
+ return os.environ.get("BRANCH", "master")
+
def reuse_site():
return os.environ.get("REUSE", "1") == "1"
return testlib.Site(site_id=_site_id(), version=site_version(),
- edition=site_edition(), reuse=reuse_site())
+ edition=site_edition(), reuse=reuse_site(),
branch=site_branch())
def _site_id():
diff --git a/tests/testlib/__init__.py b/tests/testlib/__init__.py
index 81b4d4a..f0090ec 100644
--- a/tests/testlib/__init__.py
+++ b/tests/testlib/__init__.py
@@ -60,8 +60,8 @@ class CMKVersion(object):
CEE = "cee"
CRE = "cre"
- def __init__(self, version, edition):
- self.set_version(version)
+ def __init__(self, version, edition, branch):
+ self.set_version(version, branch)
if len(edition) != 3:
raise Exception("Invalid edition: %s. Must be short notation (cee, cre,
...)")
@@ -78,9 +78,13 @@ class CMKVersion(object):
return os.path.split(path)[-1].rsplit(".", 1)[0]
- def set_version(self, version):
+ def set_version(self, version, branch):
if version in [ CMKVersion.DAILY, CMKVersion.GIT ]:
- self.version = time.strftime("%Y.%m.%d")
+ date_part = time.strftime("%Y.%m.%d")
+ if branch != "master":
+ return "%s-%s" % (branch, date_part)
+ else:
+ return date_part
elif version == CMKVersion.DEFAULT:
self.version = self.get_default_version()
@@ -145,11 +149,11 @@ class CMKVersion(object):
class Site(object):
def __init__(self, site_id, reuse=True, version=CMKVersion.DEFAULT,
- edition=CMKVersion.CEE):
+ edition=CMKVersion.CEE, branch="master"):
assert site_id
self.id = site_id
self.root = "/omd/sites/%s" % self.id
- self.version = CMKVersion(version, edition)
+ self.version = CMKVersion(version, edition, branch)
self.update_with_git = version == CMKVersion.GIT