-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #456 from citrus-it/origindep
Add test for an origin dependency
- Loading branch information
Showing
1 changed file
with
83 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -219,6 +219,29 @@ class TestPkgApiInstall(pkg5unittest.SingleDepotTestCase): | |
add file tmp/motd mode=0644 owner=root group=bin path=etc/motd | ||
close""" | ||
|
||
barge10 = """ | ||
open [email protected],5.11-0 | ||
add file tmp/cat mode=0555 owner=root group=bin path=/bin/cat | ||
add file tmp/motd mode=0444 owner=root group=bin path=etc/motd | ||
close """ | ||
|
||
derelict = """ | ||
open [email protected],5.11-0 | ||
add file tmp/motd mode=0444 owner=root group=bin path=etc/motd | ||
close """ | ||
|
||
barge11 = """ | ||
open [email protected],5.11-0 | ||
add file tmp/cat mode=0555 owner=root group=bin path=/bin/cat | ||
add depend type=require fmri=pkg:/derelict | ||
close """ | ||
|
||
barge12 = """ | ||
open [email protected],5.11-0 | ||
add file tmp/cat mode=0555 owner=root group=bin path=/bin/cat | ||
add depend type=origin fmri=pkg:/[email protected] | ||
close """ | ||
|
||
misc_files = ["tmp/libc.so.1", "tmp/cat", "tmp/baz", "tmp/motd"] | ||
|
||
def setUp(self): | ||
|
@@ -492,6 +515,66 @@ def test_update_backwards(self): | |
self.__do_update(api_obj, ["carriage", "horse@1"]) | ||
self.pkg("list carriage@3 horse@1") | ||
|
||
def test_origin_depend(self): | ||
"""Confirm that an origin dependency causes the proper sequence of | ||
upgrades to occur.""" | ||
|
||
self.pkgsend_bulk(self.rurl, self.barge10) | ||
api_obj = self.image_create(self.rurl) | ||
|
||
self.__do_install(api_obj, ["barge"]) | ||
|
||
self.pkg("list barge derelict", exit=3) | ||
|
||
# Attempting to update barge should result in nothing to do. | ||
api_obj.reset() | ||
for pd in api_obj.gen_plan_update(["barge"]): | ||
continue | ||
self.assertTrue(api_obj.planned_nothingtodo()) | ||
|
||
# Publish derelict and barge versions 1.1 and 1.2 | ||
self.pkgsend_bulk( | ||
self.rurl, (self.barge11, self.barge12, self.derelict) | ||
) | ||
|
||
# It should not be possible to update directly to [email protected] due to | ||
# its origin dependency. | ||
api_obj.reset() | ||
self.assertRaises( | ||
api_errors.PlanCreationException, | ||
lambda *args, **kwargs: list( | ||
api_obj.gen_plan_update(*args, **kwargs) | ||
), | ||
["[email protected]"], | ||
) | ||
|
||
# Upgrading barge should result in derelict being installed, and barge | ||
# only going to version 1.1 | ||
api_obj.reset() | ||
self.__do_update(api_obj, ["barge"]) | ||
self.pkg("list [email protected] derelict") | ||
|
||
# It should not be possible to uninstall derelict at this point as it | ||
# is required by [email protected] | ||
api_obj.reset() | ||
self.assertRaises( | ||
api_errors.NonLeafPackageException, | ||
lambda *args, **kwargs: list( | ||
api_obj.gen_plan_uninstall(*args, **kwargs) | ||
), | ||
["derelict"], | ||
) | ||
|
||
# A subsequent update of barge should move it to 1.2 | ||
api_obj.reset() | ||
self.__do_update(api_obj, ["barge"]) | ||
self.pkg("list [email protected] derelict") | ||
|
||
# And now derelict should be uninstallable | ||
api_obj.reset() | ||
self.__do_uninstall(api_obj, ["derelict"]) | ||
self.pkg("list derelict", exit=1) | ||
|
||
def test_multi_publisher(self): | ||
"""Verify that package install works as expected when multiple | ||
publishers share the same repository.""" | ||
|