示例#1
0
 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()
示例#2
0
 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()
示例#3
0
 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"
示例#4
0
 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'
示例#5
0
 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"
示例#6
0
 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')
示例#7
0
 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')
示例#8
0
 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
示例#9
0
 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"
示例#10
0
    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",
        )
示例#11
0
    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",
        )
示例#12
0
 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
示例#13
0
 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
示例#14
0
    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",
        )
示例#15
0
    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",
        )
示例#16
0
    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",
        )
示例#17
0
    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",
        )
示例#18
0
    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",
        )
示例#19
0
    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",
        )
示例#20
0
 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/'
示例#21
0
 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'
示例#22
0
 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'
示例#23
0
 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
示例#24
0
 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/'
示例#25
0
 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"
示例#26
0
 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
示例#27
0
 def test_sets_modified(self, session):
     build = Build(self.p, **self.data)
     session.commit()
     assert build.modified.timetuple()
示例#28
0
 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"
示例#29
0
 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/'
示例#30
0
 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/'
示例#31
0
 def test_up_to_project(self, session):
     build = Build(self.p, **self.data)
     session.commit()
     result = build.get_url('project')
     assert result == '/builds/ceph/'
示例#32
0
 def test_up_to_project(self, session):
     build = Build(self.p, **self.data)
     session.commit()
     result = build.get_url('project')
     assert result == '/builds/ceph/'
示例#33
0
 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"