Пример #1
0
    def test_get_rid_of_new_and_old_repos_by_flavor_configured_in_days(
            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

        # cause lifespan for this repo to be 0 days, thus remove it
        conf.purge_rotation = {
            'nfs-ganesha': {
                'flavor': {
                    'ceph_master': {
                        'days': 0
                    }
                }
            },
            '__force_dict__': True
        }
        session.commit()
        recurring.purge_repos()
        assert len(Repo.query.all()) == 0
Пример #2
0
    def test_get_rid_of_new_and_old_repos_without_days(self, session,
                                                       no_update_timestamp):
        repo = Repo(
            project=Project('nfs-ganesha'),
            ref='next',
            distro='centos',
            distro_version='7',
            flavor='ceph_master',
        )
        repo.modified = self.three_weeks_ago

        conf.purge_rotation = {
            'nfs-ganesha': {
                'flavor': {
                    'ceph_master': {
                        'keep_minimum': 0
                    }
                },
                'ref': {
                    'next': {
                        'keep_minimum': 0
                    }
                }
            },
            '__force_dict__': True
        }
        session.commit()
        recurring.purge_repos()
        assert len(Repo.query.all()) == 0
Пример #3
0
    def test_raw_post_update(self, session, recorder, monkeypatch):
        pecan.conf.repos_root = '/tmp/root'
        url = '/repos/foobar/master/head/windows/999/'
        p = Project('foobar')
        repo = Repo(
            p,
            "master",
            "windows",
            "999",
            sha1="head",
        )
        session.commit()
        repo.get(1)
        # create a raw type repo
        result = session.app.post_json(
            url,
            params={
                'type': 'raw',
                'needs_update': False,
            },
        )
        assert result.json['type'] == 'raw'

        # check that update just marks it 'ready' immediately
        fake_post_status = recorder()
        monkeypatch.setattr(asynch, 'post_status', fake_post_status)
        result = session.app.post(url + 'update/')
        assert fake_post_status.recorder_calls[0]['args'][0] == 'ready'
Пример #4
0
    def test_skips_marking_needs_update(self, session, tmpdir, url):
        pecan.conf.binary_root = str(tmpdir)
        pecan.conf.repos = {
            'ceph-deploy': {
                'automatic': False,
            },
            '__force_dict__': True,
        }
        session.app.post(url,
                         upload_files=[('file',
                                        'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                                        b_('hello tharrrr'))])
        project = Project.filter_by(name='ceph-deploy').first()
        repo = Repo.filter_by(project=project).first()
        # newly created repos will default to ``needs_update`` as ``True``,
        # revert so we can test if disabling automatic repos works
        repo.needs_update = False
        session.commit()

        session.app.post(url,
                         upload_files=[('file',
                                        'ceph-deploy_10.0.0-0.el6.x86_64.rpm',
                                        b_('newer version'))])
        project = Project.filter_by(name='ceph-deploy').first()
        repo = Repo.filter_by(project=project).first()
        assert repo.needs_update is False
Пример #5
0
 def test_marks_multiple_projects(self, session, tmpdir, url):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {
                 'ceph-deploy': ['master']
             },
         },
         'rhcs': {
             'all': {
                 'ceph-deploy': ['master']
             },
         },
         '__force_dict__': True,
     }
     session.commit()
     session.app.post(url,
                      upload_files=[('file',
                                     'ceph-deploy_9.0.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     ceph_project = Project.filter_by(name='ceph').first()
     rhcs_project = Project.filter_by(name='rhcs').first()
     assert Repo.filter_by(
         project=ceph_project).first().needs_update is True
     assert Repo.filter_by(
         project=rhcs_project).first().needs_update is True
Пример #6
0
 def test_full_metric_name(self, session):
     Repo(
         self.p,
         ref="master",
         distro='ubuntu',
         distro_version='trusty',
         arch='aarch64',
     )
     session.commit()
     result = Repo.get(1).metric_name
     assert result == "repos.ceph.ubuntu.trusty"
Пример #7
0
 def test_ref_does_not_exist(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/hammer/ubuntu/trusty/', expect_errors=True)
     assert result.status_int == 404
Пример #8
0
 def test_recreate_head(self, session, tmpdir, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.head(url)
     assert result.status_int == 200
Пример #9
0
 def test_sha1_does_not_exist(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/sha1/', expect_errors=True)
     assert result.status_int == 404
Пример #10
0
 def test_extra_metadata_default(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.json['extra'] == {}
Пример #11
0
 def test_recreate_head(self, session, tmpdir, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.head(url)
     assert result.status_int == 200
Пример #12
0
 def test_extra_metadata_default(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.json['extra'] == {}
Пример #13
0
 def test_sha1_does_not_exist(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url, expect_errors=True)
     assert result.status_int == 404
Пример #14
0
 def test_default_flavor(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
     assert result.json == ['default']
Пример #15
0
    def test_update_triggers_a_change_in_modified(self, session):
        initial_repo = Repo(
            self.p,
            ref='firefly',
            distro='centos',
            distro_version='7',
            )
        initial_timestamp = initial_repo.modified.time()
        session.commit()
        repo = Repo.get(1)
        repo.distro = 'rhel'
        session.commit()

        assert initial_timestamp < repo.modified.time()
Пример #16
0
 def test_repo_type(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["type"] is None
Пример #17
0
 def test_single_project_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"foobar": ["firefly"]}
Пример #18
0
 def test_binary_sets_repo_type(self, session):
     repo = Repo(self.p, 'hammer', 'centos', '7')
     session.commit()
     Binary(
         'ceph-1.0.rpm',
         self.p,
         ref='hammer',
         distro='centos',
         distro_version='7',
         arch='x86_64',
     )
     session.commit()
     repo = Repo.get(1)
     assert repo.type == 'rpm'
Пример #19
0
 def test_repo_type(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["type"] is None
Пример #20
0
 def test_single_distro(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/ubuntu/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == ["trusty"]
Пример #21
0
 def test_single_project_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"foobar": ["firefly"]}
Пример #22
0
 def test_binary_file_deleted_removes_repo(self, session, tmpdir):
     # if a repo has no binaries related to it after binary deletion, it is deleted as well
     pecan.conf.binary_root = str(tmpdir)
     session.app.post(
         '/binaries/ceph/giant/ceph/el6/x86_64/',
         params={'force': 1},
         upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
     )
     repo = Repo.get(1)
     assert repo
     result = session.app.delete('/binaries/ceph/giant/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/')
     assert result.status_int == 204
     repo = Repo.get(1)
     assert not repo
Пример #23
0
 def test_binary_file_deleted_removes_repo(self, session, tmpdir, url_post,
                                           url_delete):
     # if a repo has no binaries related to it after binary deletion, it is deleted as well
     pecan.conf.binary_root = str(tmpdir)
     session.app.post(url_post,
                      params={'force': 1},
                      upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     repo = Repo.get(1)
     assert repo
     result = session.app.delete(url_delete)
     assert result.status_int == 204
     repo = Repo.get(1)
     assert not repo
Пример #24
0
 def test_default_flavor(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(
         '/repos/foobar/firefly/head/ubuntu/trusty/flavors/')
     assert result.json == ['default']
Пример #25
0
 def test_recreate_head(self, session, tmpdir):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.head(
         "/repos/foobar/firefly/ubuntu/trusty/recreate"
     )
     assert result.status_int == 200
Пример #26
0
 def test_repo_exists(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/ubuntu/trusty/')
     assert result.status_int == 200
     assert result.json["distro_version"] == "trusty"
     assert result.json["distro"] == "ubuntu"
     assert result.json["ref"] == "firefly"
Пример #27
0
 def test_get_single_project(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/head/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"ubuntu": ["trusty"]}
Пример #28
0
 def test_update_empty_json(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=dict(),
         expect_errors=True,
     )
     assert result.status_int == 400
Пример #29
0
 def test_recreate(self, session, tmpdir, url):
     path = str(tmpdir)
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = path
     session.commit()
     result = session.app.post_json(url, params={})
     assert os.path.exists(path) is False
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
Пример #30
0
    def test_get_rid_of_new_repos_without_offset(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': {
                        'days': 0
                    }
                },
                'ref': {
                    'next': {
                        'days': 0
                    }
                }
            },
            '__force_dict__': True
        }
        session.commit()
        recurring.purge_repos()
        assert len(Repo.query.all()) == 0
Пример #31
0
 def test_recreate_invalid_path(self, session, tmpdir, url):
     path = str(tmpdir)
     invalid_path = os.path.join(path, 'invalid_path')
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = invalid_path
     session.commit()
     result = session.app.post_json(url)
     assert os.path.exists(path) is True
     assert result.json['needs_update'] is True
Пример #32
0
 def test_recreate(self, session, tmpdir, url):
     path = str(tmpdir)
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = path
     session.commit()
     result = session.app.post_json(url, params={})
     assert os.path.exists(path) is False
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
Пример #33
0
    def test_get_rid_of_new_and_old_repos_without_days(self, session, fake,
                                                       monkeypatch):
        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
                    }
                },
                'ref': {
                    'next': {
                        'keep_minimum': 0
                    }
                }
            },
            '__force_dict__': True
        }
        fake_datetime = fake(utcnow=lambda: self.old, now=self.now)
        monkeypatch.setattr(datetime, 'datetime', fake_datetime)
        session.commit()
        recurring.purge_repos(_now=self.now)
        assert len(Repo.query.all()) == 0
Пример #34
0
 def test_recreate_invalid_path(self, session, tmpdir, url):
     path = str(tmpdir)
     invalid_path = os.path.join(path, 'invalid_path')
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = invalid_path
     session.commit()
     result = session.app.post_json(url)
     assert os.path.exists(path) is True
     assert result.json['needs_update'] is True
Пример #35
0
 def test_update_empty_json(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.post_json(
         url,
         params=dict(),
         expect_errors=True,
     )
     assert result.status_int == 400
Пример #36
0
 def test_update_invalid_field_value(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     data = {"distro": 123}
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
Пример #37
0
 def setup(self):
     self.p = Project('ceph')
     self.repo = Repo(
         self.p,
         ref='firefly',
         distro='centos',
         distro_version='7',
     )
Пример #38
0
 def test_repo_exists(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["distro_version"] == "trusty"
     assert result.json["distro"] == "ubuntu"
     assert result.json["ref"] == "firefly"
     assert result.json["sha1"] == "head"
Пример #39
0
 def test_created_no_binaries_is_not_generic(self, session):
     repo = Repo(
         self.p,
         ref='firefly',
         distro='centos',
         distro_version='7',
         )
     assert repo.is_generic is False
Пример #40
0
 def test_repo_exists(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get(url)
     assert result.status_int == 200
     assert result.json["distro_version"] == "trusty"
     assert result.json["distro"] == "ubuntu"
     assert result.json["ref"] == "firefly"
     assert result.json["sha1"] == "head"
Пример #41
0
 def test_recreate(self, session, tmpdir):
     path = str(tmpdir)
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = path
     session.commit()
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/recreate",
         params={}
     )
     assert os.path.exists(path) is False
     assert result.json['needs_update'] is True
Пример #42
0
 def test_created_slaps_a_modified_attr(self, session):
     repo = Repo(
         self.p,
         ref='firefly',
         distro='centos',
         distro_version='7',
         )
     assert repo.modified.timetuple()
Пример #43
0
 def test_update_invalid_field_value(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     data = {"distro": 123}
     result = session.app.post_json(
         url,
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
Пример #44
0
 def test_update(self, session, tmpdir):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     repo.get(1)
     repo.needs_update = False
     session.commit()
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/update",
         params={}
     )
     assert result.json['needs_update'] is True
Пример #45
0
 def test_binary_file_deleted_repo_exists(self, session, tmpdir):
     # if a repo has binaries related to it after binary deletion, it will still exist
     pecan.conf.binary_root = str(tmpdir)
     session.app.post('/binaries/ceph/giant/head/ceph/el6/x86_64/',
                      params={'force': 1},
                      upload_files=[('file', 'ceph-9.0.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     session.app.post('/binaries/ceph/giant/head/ceph/el6/x86_64/',
                      params={'force': 1},
                      upload_files=[('file', 'ceph-9.1.0-0.el6.x86_64.rpm',
                                     b_('hello tharrrr'))])
     repo = Repo.get(1)
     assert repo
     result = session.app.delete(
         '/binaries/ceph/giant/head/ceph/el6/x86_64/ceph-9.0.0-0.el6.x86_64.rpm/'
     )
     assert result.status_int == 204
     repo = Repo.get(1)
     assert repo.needs_update
Пример #46
0
 def test_add_extra_metadata(self, session, url):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {'version': '0.94.8', 'distros': ['precise']}
     session.app.post_json(
         url,
         params=data,
     )
     updated_repo = Repo.get(repo_id)
     assert updated_repo.extra == {"version": "0.94.8", 'distros': ['precise']}
Пример #47
0
 def test_update_invalid_fields(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"bogus": "7", "distro": "centos"}
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=data,
         expect_errors=True,
     )
     assert result.status_int == 400
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro == "ubuntu"
Пример #48
0
 def test_x86_64(self, session):
     Binary(
         'ceph-1.0.rpm',
         self.p,
         distro='centos',
         distro_version='7',
         arch='x86_64',
     )
     session.commit()
     repo = Repo.get(1)
     assert repo.archs == ['x86_64']
Пример #49
0
 def test_update(self, session, tmpdir, 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()
     result = session.app.post_json(
         url,
         params={}
     )
     assert result.json['needs_update'] is True
     assert result.json['is_queued'] is False
Пример #50
0
 def test_does_show_refs_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     Repo(
         p,
         "hammer",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert sorted(result.json["foobar"]) == sorted(["firefly", "hammer"])
Пример #51
0
 def test_do_not_show_distro_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     Repo(
         p,
         "firefly",
         "centos",
         "7",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == {"ubuntu": ["trusty"]}
Пример #52
0
 def test_update_single_field(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     repo_id = repo.id
     data = {"distro_version": "precise"}
     result = session.app.post_json(
         "/repos/foobar/firefly/ubuntu/trusty/",
         params=data,
     )
     assert result.status_int == 200
     updated_repo = Repo.get(repo_id)
     assert updated_repo.distro_version == "precise"
     assert result.json['distro_version'] == "precise"
Пример #53
0
 def test_does_show_refs_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     Repo(
         p,
         "hammer",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert sorted(result.json["foobar"]) == sorted(["firefly", "hammer"])
Пример #54
0
 def test_deb_is_inferred(self, session):
     Binary(
         'ceph-1.0.deb',
         self.p,
         distro='ubuntu',
         distro_version='trusty',
         arch='x86_64',
     )
     session.commit()
     repo = Repo.get(1)
     assert repo.infer_type() == 'deb'
Пример #55
0
 def test_deb_is_inferred(self, session):
     binary = Binary(
         'ceph-1.0.deb',
         self.p,
         distro='ubuntu',
         distro_version='trusty',
         arch='x86_64',
         )
     session.commit()
     repo = Repo.get(1)
     assert repo.infer_type() == 'deb'
Пример #56
0
 def test_rpm_is_inferred(self, session):
     binary = Binary(
         'ceph-1.0.rpm',
         self.p,
         distro='centos',
         distro_version='7',
         arch='x86_64',
         )
     session.commit()
     repo = Repo.get(1)
     assert repo.infer_type() == 'rpm'
Пример #57
0
 def test_marks_multiple_projects(self, session, tmpdir):
     pecan.conf.binary_root = str(tmpdir)
     pecan.conf.repos = {
         'ceph': {
             'all': {'ceph-deploy': ['master']},
         },
         'rhcs': {
             'all': {'ceph-deploy': ['master']},
         },
         '__force_dict__': True,
     }
     session.commit()
     session.app.post(
         '/binaries/ceph-deploy/master/centos/6/x86_64/',
         upload_files=[('file', 'ceph-deploy_9.0.0-0.el6.x86_64.rpm', 'hello tharrrr')]
     )
     ceph_project = Project.filter_by(name='ceph').first()
     rhcs_project = Project.filter_by(name='rhcs').first()
     assert Repo.filter_by(project=ceph_project).first().needs_update is True
     assert Repo.filter_by(project=rhcs_project).first().needs_update is True
Пример #58
0
 def test_multiple_distros_with_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo2 = Repo(
         p,
         "firefly",
         "centos",
         "7",
     )
     repo.path = "some_path"
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/')
     assert result.status_int == 200
     assert len(result.json) == 2
     assert result.json == {"ubuntu": ["trusty"], "centos": ['7']}
Пример #59
0
 def test_does_show_sha1_without_built_repos(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
         sha1="sha1",
     )
     Repo(
         p,
         "firefly",
         "centos",
         "7",
         sha1="head",
     )
     repo.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/')
     assert len(result.json) == 2
     assert "sha1" in result.json
Пример #60
0
 def test_shows_only_versions_for_ref(self, session):
     p = Project('foobar')
     repo = Repo(
         p,
         "firefly",
         "ubuntu",
         "trusty",
     )
     repo.path = "some_path"
     repo2 = Repo(
         p,
         "hammer",
         "ubuntu",
         "precise",
     )
     repo2.path = "some_path"
     session.commit()
     result = session.app.get('/repos/foobar/firefly/ubuntu/')
     assert result.status_int == 200
     assert len(result.json) == 1
     assert result.json == ["trusty"]