-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add tests for multiinstall (installonly) packages
- Loading branch information
1 parent
3d9bb9f
commit 9c8724c
Showing
5 changed files
with
287 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# | ||
# tdnf-test-one spec file | ||
# | ||
Summary: multiinstall test | ||
Name: tdnf-multi | ||
Version: 1.0.1 | ||
Release: 1 | ||
Vendor: VMware, Inc. | ||
Distribution: Photon | ||
License: VMware | ||
Url: http://www.vmware.com | ||
Group: Applications/tdnftest | ||
|
||
%description | ||
Part of tdnf test spec. Basic install/remove/upgrade test | ||
|
||
%prep | ||
|
||
%build | ||
|
||
# files should not conflict | ||
%install | ||
mkdir -p %_topdir/%buildroot/usr/share/multiinstall | ||
touch %_topdir/%buildroot/usr/share/multiinstall-%{release} | ||
|
||
%files | ||
/usr/share/multiinstall-%{release} | ||
|
||
%changelog | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-1 | ||
- Add a service file for whatprovides test. |
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# | ||
# tdnf-test-one spec file | ||
# | ||
Summary: multiinstall test | ||
Name: tdnf-multi | ||
Version: 1.0.1 | ||
Release: 2 | ||
Vendor: VMware, Inc. | ||
Distribution: Photon | ||
License: VMware | ||
Url: http://www.vmware.com | ||
Group: Applications/tdnftest | ||
|
||
%description | ||
Part of tdnf test spec. Basic install/remove/upgrade test | ||
|
||
%prep | ||
|
||
%build | ||
|
||
# files should not conflict | ||
%install | ||
mkdir -p %_topdir/%buildroot/usr/share/multiinstall | ||
touch %_topdir/%buildroot/usr/share/multiinstall-%{release} | ||
|
||
%files | ||
/usr/share/multiinstall-%{release} | ||
|
||
%changelog | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-2 | ||
- bump | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-1 | ||
- Add a service file for whatprovides test. |
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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# | ||
# tdnf-test-one spec file | ||
# | ||
Summary: multiinstall test | ||
Name: tdnf-multi | ||
Version: 1.0.1 | ||
Release: 3 | ||
Vendor: VMware, Inc. | ||
Distribution: Photon | ||
License: VMware | ||
Url: http://www.vmware.com | ||
Group: Applications/tdnftest | ||
|
||
%description | ||
Part of tdnf test spec. Basic install/remove/upgrade test | ||
|
||
%prep | ||
|
||
%build | ||
|
||
# files should not conflict | ||
%install | ||
mkdir -p %_topdir/%buildroot/usr/share/multiinstall | ||
touch %_topdir/%buildroot/usr/share/multiinstall-%{release} | ||
|
||
%files | ||
/usr/share/multiinstall-%{release} | ||
|
||
%changelog | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-3 | ||
- bump | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-2 | ||
- bump | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-1 | ||
- Add a service file for whatprovides test. |
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 |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# | ||
# tdnf-test-one spec file | ||
# | ||
Summary: multiinstall test | ||
Name: tdnf-multi | ||
Version: 1.0.1 | ||
Release: 4 | ||
Vendor: VMware, Inc. | ||
Distribution: Photon | ||
License: VMware | ||
Url: http://www.vmware.com | ||
Group: Applications/tdnftest | ||
|
||
%description | ||
Part of tdnf test spec. Basic install/remove/upgrade test | ||
|
||
%prep | ||
|
||
%build | ||
|
||
# files should not conflict | ||
%install | ||
mkdir -p %_topdir/%buildroot/usr/share/multiinstall | ||
touch %_topdir/%buildroot/usr/share/multiinstall-%{release} | ||
|
||
%files | ||
/usr/share/multiinstall-%{release} | ||
|
||
%changelog | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-4 | ||
- bump | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-3 | ||
- bump | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-2 | ||
- bump | ||
* Mon Jul 17 2023 Oliver Kurth <[email protected]> 1.0.1-1 | ||
- Add a service file for whatprovides test. |
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 |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# | ||
# Copyright (C) 2023 VMware, Inc. All Rights Reserved. | ||
# | ||
# Licensed under the GNU General Public License v2 (the "License"); | ||
# you may not use this file except in compliance with the License. The terms | ||
# of the License are located in the COPYING file of this distribution. | ||
# | ||
|
||
import pytest | ||
|
||
|
||
PKGNAME = "tdnf-multi" | ||
# must be sorted: | ||
PKG_VERSIONS = ["1.0.1-1", "1.0.1-2", "1.0.1-3", "1.0.1-4"] | ||
|
||
|
||
@pytest.fixture(scope='function', autouse=True) | ||
def setup_test(utils): | ||
utils.edit_config({"installonlypkgs": PKGNAME}) | ||
yield | ||
teardown_test(utils) | ||
|
||
|
||
def teardown_test(utils): | ||
# removing package by name without version will remoe all versions | ||
pkgname = PKGNAME | ||
utils.run(['tdnf', 'erase', '-y', pkgname]) | ||
utils.edit_config({"installonlypkgs": None}) | ||
|
||
|
||
# package can be installed twice | ||
def test_install_twice(utils): | ||
pkgname = PKGNAME | ||
utils.erase_package(pkgname) | ||
|
||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', pkgname]) | ||
# should install latest version | ||
latest = PKG_VERSIONS[-1] | ||
assert utils.check_package(pkgname, version=latest) | ||
|
||
first = PKG_VERSIONS[0] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
# test that the other version is still there | ||
assert utils.check_package(pkgname, version=latest) | ||
|
||
|
||
# package can be installed thrice | ||
def test_install_thrice(utils): | ||
pkgname = PKGNAME | ||
utils.erase_package(pkgname) | ||
|
||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', pkgname]) | ||
# should install latest version | ||
latest = PKG_VERSIONS[-1] | ||
assert utils.check_package(pkgname, version=latest) | ||
|
||
first = PKG_VERSIONS[0] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
second = PKG_VERSIONS[1] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={second}"]) | ||
assert utils.check_package(pkgname, version=second) | ||
|
||
# test that the other version is still there | ||
assert utils.check_package(pkgname, version=latest) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
|
||
# forth install removes the first installed one | ||
def test_install_fourth(utils): | ||
pkgname = PKGNAME | ||
utils.erase_package(pkgname) | ||
|
||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', pkgname]) | ||
# should install latest version | ||
latest = PKG_VERSIONS[-1] | ||
assert utils.check_package(pkgname, version=latest) | ||
|
||
first = PKG_VERSIONS[0] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
second = PKG_VERSIONS[1] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={second}"]) | ||
assert utils.check_package(pkgname, version=second) | ||
|
||
third = PKG_VERSIONS[2] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={third}"]) | ||
assert utils.check_package(pkgname, version=third) | ||
|
||
# the first installed should be gone (default installonly_limit=3) | ||
assert not utils.check_package(pkgname, version=latest) | ||
|
||
|
||
# remove without version removes all | ||
def test_install_remove_no_version(utils): | ||
pkgname = PKGNAME | ||
utils.erase_package(pkgname) | ||
|
||
first = PKG_VERSIONS[0] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
second = PKG_VERSIONS[1] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={second}"]) | ||
assert utils.check_package(pkgname, version=second) | ||
|
||
utils.run(['tdnf', 'remove', '-y', pkgname]) | ||
assert not utils.check_package(pkgname, version=first) | ||
assert not utils.check_package(pkgname, version=second) | ||
|
||
|
||
# remove with version removes one only | ||
def test_install_remove_with_version(utils): | ||
pkgname = PKGNAME | ||
utils.erase_package(pkgname) | ||
|
||
first = PKG_VERSIONS[0] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
second = PKG_VERSIONS[1] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={second}"]) | ||
assert utils.check_package(pkgname, version=second) | ||
|
||
utils.run(['tdnf', 'remove', '-y', f"{pkgname}={first}"]) | ||
assert not utils.check_package(pkgname, version=first) | ||
# other pkgs should remain installed: | ||
assert utils.check_package(pkgname, version=second) | ||
|
||
|
||
# a reinstall leaves them intact | ||
def test_install_reinstall(utils): | ||
pkgname = PKGNAME | ||
utils.erase_package(pkgname) | ||
|
||
first = PKG_VERSIONS[0] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
assert utils.check_package(pkgname, version=first) | ||
|
||
second = PKG_VERSIONS[1] | ||
utils.run(['tdnf', 'install', '-y', '--nogpgcheck', f"{pkgname}={second}"]) | ||
assert utils.check_package(pkgname, version=second) | ||
|
||
utils.run(['tdnf', 'reinstall', '-y', '--nogpgcheck', f"{pkgname}={first}"]) | ||
# both pkgs should remain installed: | ||
assert utils.check_package(pkgname, version=first) | ||
assert utils.check_package(pkgname, version=second) |