gather: Relax validations on variant_as_lookaside

Instead of validating both variants exist, let's just check the
existence of only the variant that is being used as a lookaside.

If the configuration says Foo depends on Bar, the error is reported only
if Foo exists but Bar does not. Any other situation is silently ignored.

JIRA: COMPOSE-3393
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2019-05-20 10:02:36 +02:00
parent cbe8457377
commit 283bae11da
2 changed files with 34 additions and 4 deletions

View file

@ -879,6 +879,33 @@ class TestGatherPhase(helpers.PungiTestCase):
with open(rpms_file) as fh:
self.assertEqual(fh.read(), "hello")
def test_validates_wrong_requiring_variant(self):
pkgset_phase = mock.Mock()
compose = helpers.DummyCompose(
self.topdir, {"variant_as_lookaside": [("foo", "Server")]}
)
phase = gather.GatherPhase(compose, pkgset_phase)
phase.validate()
def test_validates_wrong_required_variant(self):
pkgset_phase = mock.Mock()
compose = helpers.DummyCompose(
self.topdir, {"variant_as_lookaside": [("Server", "foo")]}
)
phase = gather.GatherPhase(compose, pkgset_phase)
with self.assertRaises(ValueError) as ctx:
phase.validate()
self.assertIn("'foo' doesn't exist", str(ctx.exception))
def test_validates_both_requires_missing(self):
pkgset_phase = mock.Mock()
compose = helpers.DummyCompose(
self.topdir, {"variant_as_lookaside": [("foo", "bar")]}
)
phase = gather.GatherPhase(compose, pkgset_phase)
phase.validate()
class TestGetPackagesToGather(helpers.PungiTestCase):
def setUp(self):