def test_keeps_new_repo_by_flavor_with_days(self, session, no_update_timestamp): Repo( project=Project('nfs-ganesha'), ref='next', distro='centos', distro_version='7', flavor='ceph_master', ) conf.purge_rotation = { 'nfs-ganesha': { 'flavor': { 'ceph_master': { 'keep_minimum': 0, 'days': 70 } } }, '__force_dict__': True } session.commit() recurring.purge_repos() assert len(Repo.query.all()) == 1
def test_list_one_flavor(self, session): project = Project('ceph') Binary('ceph-1.0.0.rpm', project, ref='giant', sha1="head", distro='centos', distro_version='el6', arch='x86_64', flavor='tcmalloc') Binary('ceph-1.0.0.rpm', project, ref='giant', sha1="head", distro='centos', distro_version='el7', arch='x86_64', flavor='default') session.commit() result = session.app.get( '/binaries/ceph/giant/head/centos/el6/x86_64/flavors/', ) # default flavor is for a different distro_version in this case # and should not show up assert list(result.json.keys()) == ['tcmalloc']
def test_get_rid_of_old_but_keep_new_repo_by_flavor_configured_with_offset( self, session, no_update_timestamp): repo = Repo( project=Project('nfs-ganesha'), ref='next', distro='centos', distro_version='7', flavor='ceph_master', ) repo.modified = self.one_minute conf.purge_rotation = { 'nfs-ganesha': { 'flavor': { 'ceph_master': { 'keep_minimum': 0 } } }, '__force_dict__': True } session.commit() recurring.purge_repos() assert len(Repo.query.all()) == 1
def test_create(self, session, url): p = Project('foobar') repo = Repo( p, "firefly", "ubuntu", "trusty", sha1="head", ) repo.path = "some_path" session.commit() repo.get(1) repo.needs_update = False session.commit() # create a raw type repo result = session.app.post_json( url, params={'type': 'raw'}, ) assert result.json['type'] == 'raw' # adding an rpm doesn't change the type Binary( 'binary.rpm', p, repo, ref='firefly', sha1='head', flavor='default', distro='ubuntu', distro_version='trusty', arch='arm64', ) session.commit() result = session.app.get(url) assert result.json['type'] == 'raw'
def test_list_a_project(self, session): Project('foobar') session.commit() result = session.app.get('/binaries/').json assert result == {'foobar': []}
def test_get_index_single_ref(self, session): p = Project('ceph') Binary('ceph-1.0.0.rpm', p, ref='master', sha1="head", distro='centos', distro_version='el6', arch='i386') session.commit() result = session.app.get('/binaries/ceph/master/') assert result.json == {'head': ['centos']}
def test_get_index_no_ref(self, session): Project('ceph') session.commit() result = session.app.get('/binaries/ceph/next/', expect_errors=True) assert result.status_int == 404
def test_project_has_no_built_repos(self, session): Project('foobar') result = session.app.get('/repos/foobar/') assert result.status_int == 200
def test_get_index_single_project_data(self, session): Project('foobar') session.commit() result = session.app.get('/binaries/foobar/') assert result.json == {}
def test_list_a_distro_version(self, session): p = Project('ceph') Binary('ceph-1.0.0.deb', p, ref='master', distro='ubuntu', distro_version='trusty', arch='i386') session.commit() result = session.app.get('/projects/ceph/master/ubuntu/') assert result.json == {'trusty': ['i386']}
def test_search_by_distro_gets_one_item(self, session): project = Project('ceph') Binary('ceph-1.0.0.rpm', project, ref='giant', distro='centos', distro_version='el6', arch='x86_64') session.commit() result = session.app.get('/search/?distro=centos') assert len(result.json) == 1
def test_get_index_ref_with_distro(self, session): p = Project('ceph') Binary('ceph-1.0.0.rpm', p, ref='master', distro='centos', distro_version='el6', arch='i386') session.commit() result = session.app.get('/projects/ceph/master/') assert result.json['centos'] == ['el6']
def test_project_no_built_repos(self, session): Project('foobar') session.commit() result = session.app.get('/repos/') assert result.status_int == 200 assert result.json == {"foobar": []}
def test_single_project_should_have_one_item(self, session): Project('foobar') session.commit() result = session.app.get('/binaries/') assert result.status_int == 200 assert len(result.json) == 1
def test_list_unkown_ref_for_distro(self, session): p = Project('ceph') Binary('ceph-1.0.0.deb', p, ref='master', distro='ubuntu', distro_version='trusty', arch='i386') session.commit() result = session.app.get('/projects/ceph/BOGUS/ubuntu/', expect_errors=True) assert result.status_int == 404
def test_get_index_single_project(self, session): Project('foobar') session.commit() result = session.app.get('/binaries/foobar/') assert result.status_int == 200
def test_list_a_distro_version_not_found(self, session): p = Project('ceph') Binary('ceph-1.0.0.rpm', p, ref='master', distro='centos', distro_version='el6', arch='i386') session.commit() result = session.app.get('/projects/ceph/master/ubuntu/', expect_errors=True) assert result.status_int == 404
def test_list_arch_no_binaries(self, session): Project('ceph') session.commit() result = session.app.get( '/binaries/ceph/giant/head/centos/el6/x86_64/', expect_errors=True) assert result.status_int == 404
def setup(self): self.p = Project('ceph')