Hello community, here is the log from the commit of package yast2-update for openSUSE:Factory checked in at 2015-10-22 12:56:20 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-update (Old) and /work/SRC/openSUSE:Factory/.yast2-update.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-update" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-update/yast2-update.changes 2015-07-22 09:19:09.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-update.new/yast2-update.changes 2015-10-22 12:56:22.000000000 +0200 @@ -1,0 +2,7 @@ +Mon Oct 5 08:49:01 CEST 2015 - [email protected] + +- Added new test for Update.IsProductSupportedForUpgrade + (bsc#947398) +- 3.1.34 + +------------------------------------------------------------------- Old: ---- yast2-update-3.1.33.tar.bz2 New: ---- yast2-update-3.1.34.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-update.spec ++++++ --- /var/tmp/diff_new_pack.8jWoIe/_old 2015-10-22 12:56:23.000000000 +0200 +++ /var/tmp/diff_new_pack.8jWoIe/_new 2015-10-22 12:56:23.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.33 +Version: 3.1.34 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-update-3.1.33.tar.bz2 -> yast2-update-3.1.34.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.33/.travis.yml new/yast2-update-3.1.34/.travis.yml --- old/yast2-update-3.1.33/.travis.yml 2015-07-07 11:45:10.000000000 +0200 +++ new/yast2-update-3.1.34/.travis.yml 2015-10-05 09:22:14.000000000 +0200 @@ -5,7 +5,7 @@ # disable rvm, use system Ruby - rvm reset - wget https://raw.githubusercontent.com/yast/yast-devtools/master/travis-tools/travis_setup.sh - - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-packager yast2-installation-control" -g "rspec:2.14.1 yast-rake gettext" + - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-packager yast2-installation-control" -g "rspec:3.3.0 yast-rake gettext" script: - rake check:syntax - rake check:pot diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.33/package/yast2-update.changes new/yast2-update-3.1.34/package/yast2-update.changes --- old/yast2-update-3.1.33/package/yast2-update.changes 2015-07-07 11:45:10.000000000 +0200 +++ new/yast2-update-3.1.34/package/yast2-update.changes 2015-10-05 09:22:14.000000000 +0200 @@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Oct 5 08:49:01 CEST 2015 - [email protected] + +- Added new test for Update.IsProductSupportedForUpgrade + (bsc#947398) +- 3.1.34 + +------------------------------------------------------------------- Wed Jul 1 13:51:41 CEST 2015 - [email protected] - Cleanup for snapshots made during installation (bnc#935923) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.33/package/yast2-update.spec new/yast2-update-3.1.34/package/yast2-update.spec --- old/yast2-update-3.1.33/package/yast2-update.spec 2015-07-07 11:45:10.000000000 +0200 +++ new/yast2-update-3.1.34/package/yast2-update.spec 2015-10-05 09:22:14.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-update -Version: 3.1.33 +Version: 3.1.34 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.33/test/data/control-files/system-upgrade.xml new/yast2-update-3.1.34/test/data/control-files/system-upgrade.xml --- old/yast2-update-3.1.33/test/data/control-files/system-upgrade.xml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-update-3.1.34/test/data/control-files/system-upgrade.xml 2015-10-05 09:22:14.000000000 +0200 @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<productDefines xmlns="http://www.suse.com/1.0/yast2ns" xmlns:config="http://www.suse.com/1.0/configns"> + +<!-- +Work around for the text domain +textdomain="control" +--> + + <textdomain>control</textdomain> + + <software> + <!-- warn on older suse --> + <products_supported_for_upgrade config:type="list"> + <!-- openQA tests down to 12.1 --> + <regexp_item>^openSUSE 12\..*</regexp_item> + <regexp_item>^openSUSE 13\..*$</regexp_item> + <!-- TW snapshots --> + <regexp_item>^openSUSE 20[0-9]*$</regexp_item> + <!-- openSUSE Leap --> + <regexp_item>^openSUSE Leap 42\.1.*$</regexp_item> + </products_supported_for_upgrade> + </software> + +</productDefines> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-update-3.1.33/test/update_test.rb new/yast2-update-3.1.34/test/update_test.rb --- old/yast2-update-3.1.33/test/update_test.rb 2015-07-07 11:45:10.000000000 +0200 +++ new/yast2-update-3.1.34/test/update_test.rb 2015-10-05 09:22:14.000000000 +0200 @@ -19,17 +19,22 @@ "data" ) -def default_product_control +def default_product_control_desktop Yast::ProductControl.custom_control_file = File.join(DATA_DIR, "control-files", "desktop-upgrade.xml") Yast::ProductControl.Init end +def default_product_control_system + Yast::ProductControl.custom_control_file = File.join(DATA_DIR, "control-files", "system-upgrade.xml") + Yast::ProductControl.Init +end + def default_SetDesktopPattern_stubs - default_product_control - Yast::Update.stub(:installed_desktop).and_return("sysconfig-desktop") - Yast::Update.stub(:packages_installed?).and_return(true) - Yast::Pkg.stub(:ResolvableInstall).with(kind_of(String), :pattern).and_return(true) - Yast::Pkg.stub(:ResolvableInstall).with(kind_of(String), :package).and_return(true) + default_product_control_desktop + allow(Yast::Update).to receive(:installed_desktop).and_return("sysconfig-desktop") + allow(Yast::Update).to receive(:packages_installed?).and_return(true) + allow(Yast::Pkg).to receive(:ResolvableInstall).with(kind_of(String), :pattern).and_return(true) + allow(Yast::Pkg).to receive(:ResolvableInstall).with(kind_of(String), :package).and_return(true) end describe Yast::Update do @@ -40,17 +45,17 @@ describe "#installed_product" do it "returns `nil` if neither os-release nor SuSE-release files exist in Installation.destdir" do - Yast::Installation.stub(:destdir).and_return(File.join(DATA_DIR, "update-test-1")) + allow(Yast::Installation).to receive(:destdir).and_return(File.join(DATA_DIR, "update-test-1")) expect(Yast::Update.installed_product).to be_nil end it "returns product name from SUSE-release if os-release is missing and SUSE-release exists in Installation.destdir" do - Yast::Installation.stub(:destdir).and_return(File.join(DATA_DIR, "update-test-2")) + allow(Yast::Installation).to receive(:destdir).and_return(File.join(DATA_DIR, "update-test-2")) expect(Yast::Update.installed_product).to eq("SUSE Linux Enterprise Server 11") end it "returns product name from os-release if such file exists in Installation.destdir" do - Yast::Installation.stub(:destdir).and_return(File.join(DATA_DIR, "update-test-3")) + allow(Yast::Installation).to receive(:destdir).and_return(File.join(DATA_DIR, "update-test-3")) expect(Yast::Update.installed_product).to eq("openSUSE 13.1") end end @@ -147,7 +152,7 @@ describe "#SetDesktopPattern" do context "if there is no definition of window manager upgrade path in control file" do it "returns true as there is no upgrade path defined" do - Yast::ProductFeatures.stub(:GetFeature).with("software","upgrade").and_return(nil) + allow(Yast::ProductFeatures).to receive(:GetFeature).with("software","upgrade").and_return(nil) expect(Yast::Y2Logger.instance).to receive(:info) do |msg| expect(msg).to match(/upgrade is not handled by this product/i) @@ -159,8 +164,8 @@ context "if there is no windowmanager sysconfig file present on the system selected for upgrade" do it "returns true as there is nothing to do" do - default_product_control - Yast::FileUtils.stub(:Exists).with(/windowmanager/).and_return(false) + default_product_control_desktop + allow(Yast::FileUtils).to receive(:Exists).with(/windowmanager/).and_return(false) expect(Yast::Y2Logger.instance).to receive(:warn) do |msg| expect(msg).to match(/(Sysconfig file .* does not exist|cannot read default window manager)/i) @@ -172,9 +177,9 @@ context "if no upgrade path for the current windowmanager is defined" do it "returns true as there is nothing to do" do - default_product_control + default_product_control_desktop installed_desktop = "desktop-not-supported-for-upgrade" - Yast::Update.stub(:installed_desktop).and_return(installed_desktop) + allow(Yast::Update).to receive(:installed_desktop).and_return(installed_desktop) expect(Yast::Y2Logger.instance).to receive(:info) do |msg| expect(msg).to match(/no matching desktop found .* #{installed_desktop}/i) @@ -186,10 +191,10 @@ context "if desktop packages are not installed" do it "returns true as there is nothing to upgrade" do - default_product_control - Yast::Update.stub(:installed_desktop).and_return("sysconfig-desktop") - Yast::SCR.stub(:Execute).and_return(0) - Yast::SCR.stub(:Execute).with(kind_of(Yast::Path), /rpm -q/).and_return(-1) + default_product_control_desktop + allow(Yast::Update).to receive(:installed_desktop).and_return("sysconfig-desktop") + allow(Yast::SCR).to receive(:Execute).and_return(0) + allow(Yast::SCR).to receive(:Execute).with(kind_of(Yast::Path), /rpm -q/).and_return(-1) expect(Yast::Y2Logger.instance).to receive(:info) do |msg| expect(msg).to match(/(package .* installed: false|not all packages .* are installed)/i) @@ -203,7 +208,7 @@ context "and cannot select all patterns for installation" do it "returns false" do default_SetDesktopPattern_stubs - Yast::Pkg.stub(:ResolvableInstall).with(kind_of(String), :pattern).and_return(false) + allow(Yast::Pkg).to receive(:ResolvableInstall).with(kind_of(String), :pattern).and_return(false) expect(Yast::Report).to receive(:Error).with(/cannot select these patterns/i) expect(Yast::Update.SetDesktopPattern).to eq(false) @@ -213,7 +218,7 @@ context "and cannot select all packages for installation" do it "returns false" do default_SetDesktopPattern_stubs - Yast::Pkg.stub(:ResolvableInstall).with(kind_of(String), :package).and_return(false) + allow(Yast::Pkg).to receive(:ResolvableInstall).with(kind_of(String), :package).and_return(false) expect(Yast::Report).to receive(:Error).with(/cannot select these packages/i) expect(Yast::Update.SetDesktopPattern).to eq(false) @@ -228,6 +233,29 @@ end end end + end + + describe "#IsProductSupportedForUpgrade" do + it "returns whether upgrade of the installed system to the new product is supported" do + # uses stored product control file, test for bnc#947398 + default_product_control_system + + # Supported systems + allow(Yast::Update).to receive(:installed_product).and_return("openSUSE Leap 42.1 Milestone 2") + expect(Yast::Update.IsProductSupportedForUpgrade).to be(true) + + allow(Yast::Update).to receive(:installed_product).and_return("openSUSE 13.1") + expect(Yast::Update.IsProductSupportedForUpgrade).to be(true) + + allow(Yast::Update).to receive(:installed_product).and_return("openSUSE 12.2") + expect(Yast::Update.IsProductSupportedForUpgrade).to be(true) + + # Unsupported systems + allow(Yast::Update).to receive(:installed_product).and_return("openSUSE 11.2") + expect(Yast::Update.IsProductSupportedForUpgrade).to be(false) + allow(Yast::Update).to receive(:installed_product).and_return("Some Other Linux 8.4") + expect(Yast::Update.IsProductSupportedForUpgrade).to be(false) + end end end
