mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-04 05:10:40 +00:00
Automatic versioning for aptly
New version format: * for releases, `x.y.z` (follows tag without leading `v`) * for nightly builds, `x.y.z+N+hash` (previous version, not the upcoming one) This means that each nightly build `aptly` would report correct version now. Version is now complied into the aptly binary, system tests automatically check for current version, no need to update them anymore.
This commit is contained in:
@@ -98,6 +98,12 @@ def run(include_long_tests=False, capture_results=False, tests=None, filters=Non
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == "__main__":
|
||||
if 'APTLY_VERSION' not in os.environ:
|
||||
try:
|
||||
os.environ['APTLY_VERSION'] = os.popen("make version").read().strip()
|
||||
except BaseException, e:
|
||||
print "Failed to capture current version: ", e
|
||||
|
||||
os.chdir(os.path.realpath(os.path.dirname(sys.argv[0])))
|
||||
random.seed()
|
||||
include_long_tests = False
|
||||
|
||||
@@ -1 +1 @@
|
||||
aptly version: 0.9.8~dev
|
||||
aptly version: ${APTLY_VERSION}
|
||||
|
||||
@@ -9,5 +9,6 @@ class VersionTest(BaseTest):
|
||||
"""
|
||||
version should match
|
||||
"""
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
runCmd = "aptly version"
|
||||
|
||||
@@ -21,6 +21,6 @@ End command output: ------------------------------
|
||||
4) [Running]: version
|
||||
|
||||
Begin command output: ----------------------------
|
||||
aptly version: 0.9.8~dev
|
||||
aptly version: ${APTLY_VERSION}
|
||||
|
||||
End command output: ------------------------------
|
||||
|
||||
@@ -5,6 +5,8 @@ class RunTask1Test(BaseTest):
|
||||
"""
|
||||
task run: simple commands, 1-word command
|
||||
"""
|
||||
gold_processor = BaseTest.expand_environ
|
||||
|
||||
runCmd = "aptly task run repo list, repo create local, repo drop local, version"
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import requests_unixsocket
|
||||
import time
|
||||
import urllib
|
||||
import os
|
||||
import os.path
|
||||
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
class SystemdAPIHandoverTest(BaseTest):
|
||||
aptly_server = None
|
||||
socket_path = "/tmp/_aptly_systemdapihandovertest.sock"
|
||||
@@ -37,9 +38,9 @@ class SystemdAPIHandoverTest(BaseTest):
|
||||
Verify we can listen on a unix domain socket.
|
||||
"""
|
||||
def check(self):
|
||||
if self.aptly_server == None:
|
||||
if self.aptly_server is None:
|
||||
print("Skipping test as we failed to setup a listener.")
|
||||
return
|
||||
session = requests_unixsocket.Session()
|
||||
r = session.get('http+unix://%s/api/version' % urllib.quote(self.socket_path, safe=''))
|
||||
self.check_equal(r.json(), {'Version': '0.9.8~dev'})
|
||||
self.check_equal(r.json(), {'Version': os.environ['APTLY_VERSION']})
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import requests_unixsocket
|
||||
import time
|
||||
import os
|
||||
import urllib
|
||||
|
||||
from lib import BaseTest
|
||||
|
||||
|
||||
class UnixSocketAPITest(BaseTest):
|
||||
aptly_server = None
|
||||
socket_path = "/tmp/_aptly_test.sock"
|
||||
@@ -33,4 +35,4 @@ class UnixSocketAPITest(BaseTest):
|
||||
r = session.get('http+unix://%s/api/version' % urllib.quote(UnixSocketAPITest.socket_path, safe=''))
|
||||
# Just needs to come back, we actually don't care much about the code.
|
||||
# Only needs to verify that the socket is actually responding.
|
||||
self.check_equal(r.json(), {'Version': '0.9.8~dev'})
|
||||
self.check_equal(r.json(), {'Version': os.environ['APTLY_VERSION']})
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
from api_lib import APITest
|
||||
import os
|
||||
|
||||
|
||||
class VersionAPITest(APITest):
|
||||
@@ -7,4 +8,4 @@ class VersionAPITest(APITest):
|
||||
"""
|
||||
|
||||
def check(self):
|
||||
self.check_equal(self.get("/api/version").json(), {'Version': '0.9.8~dev'})
|
||||
self.check_equal(self.get("/api/version").json(), {'Version': os.environ['APTLY_VERSION']})
|
||||
|
||||
Reference in New Issue
Block a user