def test_update_changes_modified(self, session): build = Build(self.p, **self.data) initial_timestamp = build.modified.time() session.commit() build.distro = "centos" session.commit() assert initial_timestamp < build.modified.time()
def test_can_create(self, session): Build(self.p, **self.data) session.commit() b = Build.get(1) assert b.ref == "master" assert b.sha1 == "sha1" assert b.url == "jenkins.ceph.com/build" assert b.log_url == "jenkins.ceph.com/build/console" assert b.build_id == "250" assert b.status == "failed"
def test_list_sha1s_by_id(self, session): project = Project(name='ceph') Build(build_id=1, project=project, ref='master', sha1='1234') Build(build_id=2, project=project, ref='master', sha1='1234') Build(build_id=100, project=project, ref='master', sha1='1234') commit() result = session.app.get('/builds/ceph/master/1234/') assert result.namespace['builds'][0].build_id == '100' assert result.namespace['builds'][1].build_id == '2' assert result.namespace['builds'][2].build_id == '1'
def test_update_build(self, session): session.app.post_json('/api/builds/ceph/', params=self.data) data = self.data.copy() data['status'] = "completed" result = session.app.post_json('/api/builds/ceph/', params=data) assert result.status_int == 200 build = Build.get(1) assert build.status == "completed"
def __init__(self, _id): self.project = Project.get(request.context['project_id']) self.build = Build.get(_id) if not self.project: # TODO: nice project not found error template abort(404, 'project not found') if not self.build: # TODO: nice project not found error template abort(404, 'build not found')
def test_update_build(self, session): session.app.post_json('/api/builds/ceph/', params=self.data) data = self.data.copy() data['status'] = "completed" result = session.app.post_json('/api/builds/ceph/', params=data) assert result.status_int == 200 build = Build.get(1) assert build.status == "completed" assert build.completed
def index(self): builds = Build.filter_by(project=self.project).order_by(desc( Build.id)).limit(BUILD_LIMIT).all() distinct = {"refs": list(set([b.ref for b in builds]))} return dict( project_name=self.project_name, distinct=distinct, builds=builds, section="Builds", )
def index(self): builds = Build.filter_by(project=self.project).order_by(desc(Build.modified)).limit(BUILD_LIMIT).all() distinct = { "refs": list(set([b.ref for b in builds])) } return dict( project_name=self.project_name, distinct=distinct, builds=builds, section="Builds", )
def test_create_a_build(self, session): result = session.app.post_json('/api/builds/ceph/', params=self.data) assert result.status_int == 200 build = Build.get(1) assert build.ref == "master" assert build.project.name == "ceph" assert build.flavor == "default" assert build.sha1 == "sha1" assert build.url == "jenkins.ceph.com/build" assert build.log_url == "jenkins.ceph.com/build/console" assert build.extra["version"] == "10.2.2" assert not build.distro
def index(self): builds = Build.filter_by(project=self.project, ref=self.ref_name).order_by(desc( Build.id)).limit(BUILD_LIMIT).all() distinct = {"sha1s": list(set([b.sha1 for b in builds]))} return dict( project_name=self.project.name, distinct=distinct, builds=builds, breadcrumb="> {}".format(self.ref_name), section="Builds", )
def index(self): builds = Build.filter_by( project=self.project, ref=request.context['ref'], sha1=request.context['sha1'], flavor=self.flavor_name ).order_by(desc(Build.modified)).limit(BUILD_LIMIT).all() return dict( project_name=self.project.name, builds=builds, breadcrumb="> {} > {} > {}".format(request.context['ref'], request.context['sha1'], self.flavor_name), section="Builds", )
def index(self): builds = Build.filter_by(project=self.project, ref=request.context['ref'], sha1=request.context['sha1'], flavor=self.flavor_name).order_by( desc(Build.id)).limit(BUILD_LIMIT).all() return dict( project_name=self.project.name, builds=builds, breadcrumb="> {} > {} > {}".format(request.context['ref'], request.context['sha1'], self.flavor_name), section="Builds", )
def index(self): builds = Build.filter_by(project=self.project, ref=request.context['ref'], sha1=self.sha1_name).order_by(desc( Build.id)).limit(BUILD_LIMIT).all() distinct = {"flavors": list(set([b.flavor for b in builds]))} return dict( project_name=self.project.name, distinct=distinct, builds=builds, breadcrumb="> {} > {}".format(request.context['ref'], self.sha1_name), section="Builds", )
def index(self): builds = Build.filter_by( project=self.project, ref=self.ref_name ).order_by(desc(Build.modified)).limit(BUILD_LIMIT).all() distinct = { "sha1s": list(set([b.sha1 for b in builds])) } return dict( project_name=self.project.name, distinct=distinct, builds=builds, breadcrumb="> {}".format(self.ref_name), section="Builds", )
def index(self): builds = Build.filter_by( project=self.project, ref=request.context['ref'], sha1=self.sha1_name ).order_by(desc(Build.modified)).limit(BUILD_LIMIT).all() distinct = { "flavors": list(set([b.flavor for b in builds])) } return dict( project_name=self.project.name, distinct=distinct, builds=builds, breadcrumb="> {} > {}".format(request.context['ref'], self.sha1_name), section="Builds", )
def test_default_gives_full_url(self, session): Build(self.p, **self.data) session.commit() result = Build.get(1).get_url() assert result == '/builds/ceph/master/sha1/default/1/'
def test_update_queued_build_is_completed(self, session): data = get_build_data(status='queued', url='jenkins.ceph.com/trigger') session.app.post_json('/api/builds/ceph/', params=data) data = get_build_data(status='completed') session.app.post_json('/api/builds/ceph/', params=data) assert Build.get(1).status == 'completed'
def test_update_queued_build_is_completed(self, session): data = get_build_data(status='queued', url='jenkins.ceph.com/trigger') session.app.post_json('/api/builds/ceph/', params=data) data = get_build_data(status='completed') result = session.app.post_json('/api/builds/ceph/', params=data) assert Build.get(1).status == 'completed'
def test_distro_version_can_be_null(self, session): Build(self.p, **self.data) session.commit() b = Build.get(1) assert not b.distro_version
def test_by_sha1(self, session): build = Build(self.p, **self.data) session.commit() result = build.get_url('sha1') assert result == '/builds/ceph/master/sha1/'
def test_can_create_with_extra(self, session): b = Build(self.p, **self.data) b.extra = dict(version="10.2.2") session.commit() build = Build.get(1) assert build.extra['version'] == "10.2.2"
def test_sets_modified(self, session): build = Build(self.p, **self.data) session.commit() assert build.modified.timetuple()
def test_up_to_project(self, session): build = Build(self.p, **self.data) session.commit() result = build.get_url('project') assert result == '/builds/ceph/'
def test_update_queued_build_is_completed(self, session): data = get_build_data(status="queued", url="jenkins.ceph.com/trigger") session.app.post_json("/api/builds/ceph/", params=data) data = get_build_data(status="completed") result = session.app.post_json("/api/builds/ceph/", params=data) assert Build.get(1).status == "completed"