Ejemplo n.º 1
0
    def test_cgit_endpoint_not_reacheable(self):
        (flexmock(distgit.support).should_receive(
            'resource_is_reacheable').and_return(False))

        (url, err) = distgit.validate('images/my-img.yml', {}, self.group_cfg)
        self.assertEqual(url, 'http://my.cgit.endpoint/containers/my-img')
        self.assertEqual(err, ('This validation must run from a network '
                               'with access to http://my.cgit.endpoint'))
Ejemplo n.º 2
0
    def test_use_branch_from_group_cfg(self):
        expected_url = 'http://my.cgit.endpoint/containers/my-img'

        (flexmock(distgit).should_receive('branch_exists').with_args(
            'rhaos-4.2-rhel-999', expected_url)  # defined on setUp
         .and_return(True))

        (url, err) = distgit.validate('images/my-img.yml', {}, self.group_cfg)
        self.assertEqual(url, expected_url)
        self.assertIsNone(err)
Ejemplo n.º 3
0
    def test_use_branch_declared_on_file_with_vars(self):
        expected_url = 'http://my.cgit.endpoint/containers/img'

        (flexmock(distgit).should_receive('branch_exists').with_args(
            'my-4-branch.2', expected_url).and_return(True))

        data = {'distgit': {'branch': 'my-{MAJOR}-branch.{MINOR}'}}
        (url, err) = distgit.validate('images/img.yml', data, self.group_cfg)
        self.assertEqual(url, expected_url)
        self.assertIsNone(err)
Ejemplo n.º 4
0
    def test_branch_doesnt_exist(self):
        branch_url = ('http://my.cgit.endpoint/containers/my-img/'
                      'log?h=rhaos-4.2-rhel-999')  # defined on setUp

        (flexmock(distgit.support).should_receive('resource_exists').with_args(
            branch_url).and_return(False))

        (url, err) = distgit.validate('images/my-img.yml', {}, self.group_cfg)
        self.assertEqual(url, 'http://my.cgit.endpoint/containers/my-img')
        self.assertEqual(err, 'Branch rhaos-4.2-rhel-999 not found on DistGit')
Ejemplo n.º 5
0
    def test_cgit_repository_doesnt_exist(self):
        (flexmock(distgit.support).should_receive(
            'resource_exists').and_return(False))

        (url, err) = distgit.validate('images/my-img.yml', {}, self.group_cfg)
        self.assertEqual(url, 'http://my.cgit.endpoint/containers/my-img')
        self.assertEqual(err, ('Corresponding DistGit repo was not found.\n'
                               "If you didn't request a DistGit repo yet, "
                               'please check '
                               'https://mojo.redhat.com/docs/DOC-1168290\n'
                               'But if you already obtained one, make sure '
                               'its name matches the YAML filename'))
Ejemplo n.º 6
0
 def test_file_with_additional_extensions(self):
     (url, err) = distgit.validate('images/x.apb.y.yml', {}, self.group_cfg)
     self.assertEqual(url, 'http://my.cgit.endpoint/containers/x')
     self.assertIsNone(err)
Ejemplo n.º 7
0
 def test_file_with_custom_namespace(self):
     data = {'distgit': {'namespace': 'apbs'}}
     (url, err) = distgit.validate('images/foo.yml', data, self.group_cfg)
     self.assertEqual(url, 'http://my.cgit.endpoint/apbs/foo')
     self.assertIsNone(err)
Ejemplo n.º 8
0
 def test_unknown_artifact(self):
     (url, err) = distgit.validate('unknown/foo.yml', {}, self.group_cfg)
     self.assertEqual(url, 'http://my.cgit.endpoint/???/foo')
     self.assertIsNone(err)
Ejemplo n.º 9
0
 def test_rpm_artifact(self):
     (url, err) = distgit.validate('rpms/bar.yml', {}, self.group_cfg)
     self.assertEqual(url, 'http://my.cgit.endpoint/rpms/bar')
     self.assertIsNone(err)
Ejemplo n.º 10
0
 def test_image_artifact(self):
     (url, err) = distgit.validate('images/foo.yml', {}, self.group_cfg)
     self.assertEqual(url, 'http://my.cgit.endpoint/containers/foo')
     self.assertIsNone(err)