Hello community, here is the log from the commit of package yast2-network for openSUSE:Factory checked in at 2015-07-05 17:52:53 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-network (Old) and /work/SRC/openSUSE:Factory/.yast2-network.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-network" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-network/yast2-network.changes 2015-06-18 06:37:03.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-network.new/yast2-network.changes 2015-07-05 17:52:55.000000000 +0200 @@ -1,0 +2,21 @@ +Tue Jun 30 16:18:26 UTC 2015 - mvid...@suse.com + +- Fixed warnings like 'duplicated key at line 230 ignored: + "rt73usb"' (boo#930870) + (recording a fix present in 3.1.116 already). + +------------------------------------------------------------------- +Thu Jun 25 14:15:06 UTC 2015 - mfi...@suse.com + +- bnc#922765, bnc#923990 + - fixed default domain proposal +- 3.1.121 + +------------------------------------------------------------------- +Thu Jun 18 08:56:20 UTC 2015 - mfi...@suse.com + +- bnc#930448 + - display proper startmode description in Overview dialogue +- 3.1.120 + +------------------------------------------------------------------- Old: ---- yast2-network-3.1.119.tar.bz2 New: ---- yast2-network-3.1.121.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-network.spec ++++++ --- /var/tmp/diff_new_pack.GwMHsl/_old 2015-07-05 17:52:56.000000000 +0200 +++ /var/tmp/diff_new_pack.GwMHsl/_new 2015-07-05 17:52:56.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.119 +Version: 3.1.121 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -35,8 +35,8 @@ # yast2 v3.1.86: Added ServicesProposal library BuildRequires: yast2 >= 3.1.86 -# yast2 v3.1.123: Added new API SuSEFirewallProposal.propose_iscsi -Requires: yast2 >= 3.1.123 +# yast2 v3.1.135: Fixed Hostname API +Requires: yast2 >= 3.1.136 #netconfig (FaTE #303618) Requires: sysconfig >= 0.80.0 ++++++ yast2-network-3.1.119.tar.bz2 -> yast2-network-3.1.121.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/.coveralls.yml new/yast2-network-3.1.121/.coveralls.yml --- old/yast2-network-3.1.119/.coveralls.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-network-3.1.121/.coveralls.yml 2015-07-02 17:17:43.000000000 +0200 @@ -0,0 +1 @@ +service_name: travis-ci diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/.travis.yml new/yast2-network-3.1.121/.travis.yml --- old/yast2-network-3.1.119/.travis.yml 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/.travis.yml 2015-07-02 17:17:43.000000000 +0200 @@ -5,13 +5,13 @@ # 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-storage yast2-proxy yast2-country yast2-packager" -g "rspec:2.14.1 yast-rake gettext rubocop:0.29.1" + - sh ./travis_setup.sh -p "rake yast2-devtools yast2-testsuite yast2 yast2-storage yast2-proxy yast2-country yast2-packager" -g "rspec:2.14.1 yast-rake gettext rubocop:0.29.1 simplecov coveralls" script: - rubocop - rake check:syntax - rake check:pot + - COVERAGE=1 rake test:unit - make -f Makefile.cvs - make - sudo make install - make check - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/README.md new/yast2-network-3.1.121/README.md --- old/yast2-network-3.1.119/README.md 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/README.md 2015-07-02 17:17:43.000000000 +0200 @@ -4,6 +4,7 @@ [![Travis Build](https://travis-ci.org/yast/yast-network.svg?branch=master)](https://travis-ci.org/yast/yast-network) [![Jenkins Build](http://img.shields.io/jenkins/s/https/ci.opensuse.org/yast-network-master.svg)](https://ci.opensuse.org/view/Yast/job/yast-network-master/) [![Code Climate](https://codeclimate.com/github/yast/yast-network/badges/gpa.svg)](https://codeclimate.com/github/yast/yast-network) +[![Coverage Status](https://coveralls.io/repos/yast/yast-network/badge.png)](https://coveralls.io/r/yast/yast-network) The YaST2 Network module manages network configuration including device configuration, DNS, Routing and more diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/package/yast2-network.changes new/yast2-network-3.1.121/package/yast2-network.changes --- old/yast2-network-3.1.119/package/yast2-network.changes 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/package/yast2-network.changes 2015-07-02 17:17:43.000000000 +0200 @@ -1,4 +1,25 @@ ------------------------------------------------------------------- +Tue Jun 30 16:18:26 UTC 2015 - mvid...@suse.com + +- Fixed warnings like 'duplicated key at line 230 ignored: + "rt73usb"' (boo#930870) + (recording a fix present in 3.1.116 already). + +------------------------------------------------------------------- +Thu Jun 25 14:15:06 UTC 2015 - mfi...@suse.com + +- bnc#922765, bnc#923990 + - fixed default domain proposal +- 3.1.121 + +------------------------------------------------------------------- +Thu Jun 18 08:56:20 UTC 2015 - mfi...@suse.com + +- bnc#930448 + - display proper startmode description in Overview dialogue +- 3.1.120 + +------------------------------------------------------------------- Mon Jun 15 10:46:18 UTC 2015 - igonzalezs...@suse.com - Fix handling of AutoYaST parameter keep_install_network diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/package/yast2-network.spec new/yast2-network-3.1.121/package/yast2-network.spec --- old/yast2-network-3.1.119/package/yast2-network.spec 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/package/yast2-network.spec 2015-07-02 17:17:43.000000000 +0200 @@ -17,7 +17,7 @@ Name: yast2-network -Version: 3.1.119 +Version: 3.1.121 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build @@ -35,8 +35,8 @@ # yast2 v3.1.86: Added ServicesProposal library BuildRequires: yast2 >= 3.1.86 -# yast2 v3.1.123: Added new API SuSEFirewallProposal.propose_iscsi -Requires: yast2 >= 3.1.123 +# yast2 v3.1.135: Fixed Hostname API +Requires: yast2 >= 3.1.136 #netconfig (FaTE #303618) Requires: sysconfig >= 0.80.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/src/clients/firewall_stage1_proposal.rb new/yast2-network-3.1.121/src/clients/firewall_stage1_proposal.rb --- old/yast2-network-3.1.119/src/clients/firewall_stage1_proposal.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/src/clients/firewall_stage1_proposal.rb 2015-07-02 17:17:43.000000000 +0200 @@ -76,7 +76,9 @@ # Don't override users settings SuSEFirewall4Network.prepare_proposal unless SuSEFirewallProposal.GetChangedByUser - adjust_configuration + # this method is not easily mockable in rspec and currently is out of scope + # for testing in firewall_stage1_proposal_test.rb + adjust_configuration if !Mode.test script_return = { "preformatted_proposal" => preformatted_proposal, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/src/modules/DNS.rb new/yast2-network-3.1.121/src/modules/DNS.rb --- old/yast2-network-3.1.119/src/modules/DNS.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/src/modules/DNS.rb 2015-07-02 17:17:43.000000000 +0200 @@ -246,24 +246,16 @@ end def ReadHostname - fqhostname = "" # In installation (standard, or AutoYaST one), prefer /etc/install.inf # (because HOSTNAME comes with netcfg.rpm already, #144687) if (Mode.installation || Mode.autoinst) && FileUtils.Exists("/etc/install.inf") fqhostname = read_hostname_from_install_inf end - fqhostname = read_hostname_from_etc if fqhostname.empty? + # reads setup from /etc/HOSTNAME, returns a default if nothing found + fqhostname = Hostname.CurrentFQ if fqhostname.nil? || fqhostname.empty? - split = Hostname.SplitFQ(fqhostname) - @hostname = split[0] || "" - @domain = split[1] || "" - - # last resort - if @hostname == "" - @hostname = "linux" - @domain = "site" - end + @hostname, @domain = *Hostname.SplitFQ(fqhostname) nil end @@ -695,25 +687,6 @@ fqhostname end - - def read_hostname_from_etc - if FileUtils.Exists(HOSTNAME_PATH) - hostname_path = HOSTNAME_PATH - elsif FileUtils.Exists("/etc/HOSTNAME") - # backward compatibility due to changes done in bnc#858908 - hostname_path = "/etc/HOSTNAME" - else - return "" - end - - fqhostname = SCR.Read(path(".target.string"), hostname_path) || "" - - # avoid passing nil argument when we get non-\n-terminated string (#445531) - fqhostname = String.FirstChunk(fqhostname, "\n") - log.info("Read #{fqhostname} from '/etc/'") - - fqhostname - end publish variable: :proposal_valid, type: "boolean" publish variable: :hostname, type: "string" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/src/modules/LanItems.rb new/yast2-network-3.1.121/src/modules/LanItems.rb --- old/yast2-network-3.1.119/src/modules/LanItems.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/src/modules/LanItems.rb 2015-07-02 17:17:43.000000000 +0200 @@ -301,6 +301,8 @@ end # Returns configuration of item (see LanItems::Items) with given id. + # + # @param itemId [Integer] a key for {#Items} def GetLanItem(itemId) Ops.get_map(@Items, itemId, {}) end @@ -312,6 +314,8 @@ # Returns true if the item (see LanItems::Items) has # netconfig configuration. + # + # @param itemId [Integer] a key for {#Items} def IsItemConfigured(itemId) ret = !GetLanItem(itemId)["ifcfg"].to_s.empty? log.info("IsItemConfigured: item=#{itemId} configured=#{ret}") @@ -329,6 +333,8 @@ # # First it looks into the item's netconfig and if it doesn't exist # it uses device name from hwinfo if available. + # + # @param item_id [Integer] a key for {#Items} def GetDeviceName(item_id) lan_item = GetLanItem(item_id) @@ -363,6 +369,8 @@ end # Returns device type for particular lan item + # + # @param itemId [Integer] a key for {#Items} def GetDeviceType(itemId) NetworkInterfaces.GetType(GetDeviceName(itemId)) end @@ -373,6 +381,8 @@ end # Returns ifcfg configuration for particular item + # + # @param itemId [Integer] a key for {#Items} def GetDeviceMap(itemId) return nil if !IsItemConfigured(itemId) @@ -394,6 +404,8 @@ # # It updates NetworkInterfaces according given map. Map is expected # to be a hash where both key even value are strings + # + # @param item_id [Integer] a key for {#Items} def SetDeviceMap(item_id, devmap) devname = GetDeviceName(item_id) return false if devname.nil? || devname.empty? @@ -404,6 +416,8 @@ # Sets one option in items sysconfig device map # # Currently no checks on sysconfig option validity are performed + # + # @param item_id [Integer] a key for {#Items} def SetItemSysconfigOpt(item_id, opt, value) devmap = GetDeviceMap(item_id) return false if devmap.nil? @@ -413,6 +427,8 @@ end # Returns udev rule known for particular item + # + # @param itemId [Integer] a key for {#Items} def GetItemUdevRule(itemId) Ops.get_list(GetLanItem(itemId), ["udev", "net"], []) end @@ -536,6 +552,8 @@ # Updating config name means that old configuration is deleted from # the system. # + # @param itemId [Integer] a key for {#Items} + # # Returns new name def SetItemName(itemId, name) lan_items = LanItems.Items @@ -579,6 +597,8 @@ end # Returns new name for current item + # + # @param item_id [Integer] a key for {#Items} def renamed_to(item_id) @Items[item_id]["renamed_to"] end @@ -588,6 +608,8 @@ end # Tells if current item was renamed + # + # @param item_id [Integer] a key for {#Items} def renamed?(item_id) return false if !LanItems.Items[item_id].key?("renamed_to") renamed_to(item_id) != GetDeviceName(item_id) @@ -1229,7 +1251,10 @@ deep_copy(index) end - def startmode_overview + # Creates item's startmode human description + # + # @param item_id [Integer] a key for {#Items} + def startmode_overview(item_id) startmode_descrs = { # summary description of STARTMODE=auto "auto" => _( @@ -1257,7 +1282,8 @@ ) } - startmode_descr = startmode_descrs[NetworkInterfaces.Current["STARTMODE"].to_s] || _("Started manually") + ifcfg = GetDeviceMap(item_id) || {} + startmode_descr = startmode_descrs[ifcfg["STARTMODE"].to_s] || _("Started manually") [startmode_descr] end @@ -1323,7 +1349,7 @@ ) bullets << _("Device Name: %s") % ifcfg_name - bullets += startmode_overview + bullets += startmode_overview(key) bullets += ip_overview(ip) if ifcfg_conf["STARTMODE"] != "managed" if LanItems.type == "wlan" && diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/Makefile.am new/yast2-network-3.1.121/test/Makefile.am --- old/yast2-network-3.1.119/test/Makefile.am 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/Makefile.am 2015-07-02 17:17:43.000000000 +0200 @@ -1,7 +1,12 @@ TESTS = \ bridge_test.rb \ + build_lan_overview_test.rb \ + complex_test.rb \ default_route_test.rb \ + dns_test.rb \ edit_nic_name_test.rb \ + firewall_stage1_proposal_test.rb \ + ifroute_test.rb \ install_inf_convertor_test.rb \ lan_items_helpers_test.rb \ lan_items_read_test.rb \ @@ -10,18 +15,16 @@ link_handlers_test.rb \ netcard_test.rb \ network_autoconfiguration_test.rb \ + network_autoyast_test.rb \ new_device_startmode_test.rb \ + read_hardware_test.rb \ + remote_test.rb \ + routines_test.rb \ routing_test.rb \ + s390_helpers_test.rb \ suse_firewall_4_network_test.rb \ - widgets_test.rb \ - complex_test.rb \ - read_hardware_test.rb \ udev_test.rb \ - ifroute_test.rb \ - s390_helpers_test.rb \ - build_lan_overview_test.rb \ - network_autoyast_test.rb \ - remote_test.rb + widgets_test.rb TEST_EXTENSIONS = .rb RB_LOG_COMPILER = rspec --format doc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/build_lan_overview_test.rb new/yast2-network-3.1.121/test/build_lan_overview_test.rb --- old/yast2-network-3.1.119/test/build_lan_overview_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/build_lan_overview_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -6,7 +6,6 @@ Yast.import "LanItems" -include Yast::UIShortcuts include Yast::I18n describe "LanItemsClass#BuildLanOverview" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/complex_test.rb new/yast2-network-3.1.121/test/complex_test.rb --- old/yast2-network-3.1.119/test/complex_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/complex_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -4,21 +4,18 @@ require "yast" -include Yast::UIShortcuts -include Yast::I18n - Yast.import "LanItems" Yast.import "Stage" -# creating a wrapper for Yast's 'header' file -$LOAD_PATH.unshift File.expand_path("../../src", __FILE__) -require "include/network/lan/complex" - -class NetworkLanComplexInclude - extend Yast::NetworkLanComplexInclude +class NetworkLanComplexIncludeClass < Yast::Module + def initialize + Yast.include self, "network/lan/complex.rb" + end end describe "NetworkLanComplexInclude::input_done?" do + subject { NetworkLanComplexIncludeClass.new } + BOOLEAN_PLACEHOLDER = "placeholder (true or false)" context "when not running in installer" do @@ -29,7 +26,7 @@ end it "returns true for input different than :abort" do - expect(NetworkLanComplexInclude.input_done?(:no_abort)).to eql true + expect(subject.input_done?(:no_abort)).to eql true end it "returns true for input equal to :abort in case of no user modifications" do @@ -37,7 +34,7 @@ .to receive(:modified) .and_return(false) - expect(NetworkLanComplexInclude.input_done?(:abort)).to eql true + expect(subject.input_done?(:abort)).to eql true end it "asks user for abort confirmation for input equal to :abort and user did modifications" do @@ -45,11 +42,11 @@ .to receive(:modified) .and_return(true) - expect(NetworkLanComplexInclude) + expect(subject) .to receive(:ReallyAbort) .and_return(BOOLEAN_PLACEHOLDER) - expect(NetworkLanComplexInclude.input_done?(:abort)).to eql BOOLEAN_PLACEHOLDER + expect(subject.input_done?(:abort)).to eql BOOLEAN_PLACEHOLDER end end @@ -65,7 +62,7 @@ .to receive(:ConfirmAbort) .and_return(BOOLEAN_PLACEHOLDER) - expect(NetworkLanComplexInclude.input_done?(:abort)).to eql BOOLEAN_PLACEHOLDER + expect(subject.input_done?(:abort)).to eql BOOLEAN_PLACEHOLDER end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/default_route_test.rb new/yast2-network-3.1.121/test/default_route_test.rb --- old/yast2-network-3.1.119/test/default_route_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/default_route_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -4,31 +4,6 @@ require "yast" -# A two level section/key => value store -# to remember values of /etc/sysconfig/network/ifcfg-* -class SectionKeyValue - def initialize - @sections = {} - end - - def sections - @sections.keys - end - - def keys(section) - @sections[section].keys - end - - def get(section, key) - @sections[section][key] - end - - def set(section, key, value) - section_hash = @sections[section] ||= {} - section_hash[key] = value - end -end - describe "Yast::LanItemsClass" do subject { Yast::LanItems } @@ -85,6 +60,7 @@ .to receive(:GetType) .with("") .and_return nil + Yast::NetworkInterfaces.instance_variable_set(:@initialized, false) allow(Yast::LanUdevAuto) .to receive(:AllowUdevModify).and_return false @@ -95,7 +71,7 @@ # Hardware detection expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".probe.netcard")) + .with(path(".probe.netcard")) .and_return([]) # miscellaneous uninteresting but hard to avoid stuff @@ -105,15 +81,15 @@ expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".etc.install_inf.BrokenModules")) + .with(path(".etc.install_inf.BrokenModules")) .and_return "" expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".udev_persistent.net")) + .with(path(".udev_persistent.net")) .and_return({}) expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".udev_persistent.drivers")) + .with(path(".udev_persistent.drivers")) .and_return({}) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/dns_test.rb new/yast2-network-3.1.121/test/dns_test.rb --- old/yast2-network-3.1.119/test/dns_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/dns_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -1,15 +1,10 @@ #!/usr/bin/env rspec -ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +require_relative "test_helper" require "yast" -require_relative "SCRStub" module Yast - RSpec.configure do |c| - c.include SCRStub - end - import "Arch" import "DNS" import "ProductControl" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/firewall_stage1_proposal_test.rb new/yast2-network-3.1.121/test/firewall_stage1_proposal_test.rb --- old/yast2-network-3.1.119/test/firewall_stage1_proposal_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/firewall_stage1_proposal_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -17,6 +17,13 @@ # Ensure a fixed proposal SuSEFirewallProposal.SetChangedByUser(true) SuSEFirewall4Network.SetSshEnabled1stStage(true) + + allow(SuSEFirewallServices) + .to receive(:all_services) + .and_return(SuSEFirewall4NetworkClass::SSH_SERVICES.zip([]).to_h) + allow(Mode) + .to receive(:test) + .and_return(true) end let(:proposal) do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/ifroute_test.rb new/yast2-network-3.1.121/test/ifroute_test.rb --- old/yast2-network-3.1.119/test/ifroute_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/ifroute_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -4,12 +4,10 @@ require "yast" -include Yast - Yast.import "NetworkInterfaces" Yast.import "Routing" -describe "Routing#Read" do +describe "Yast::Routing#Read" do ROUTES_FILE = [ { "destination" => "default", @@ -28,58 +26,58 @@ ] before(:each) do - allow(NetworkInterfaces) + allow(Yast::NetworkInterfaces) .to receive(:Read) .and_return(true) - allow(NetworkInterfaces) + allow(Yast::NetworkInterfaces) .to receive(:List) .and_return(["eth0"]) - allow(SCR) + allow(Yast::SCR) .to receive(:Read) .and_return(nil) end it "loades ifroute-* files" do - allow(SCR) + allow(Yast::SCR) .to receive(:Read) .with(path(".routes")) .and_return([]) - expect(SCR) + expect(Yast::SCR) .to receive(:Read) .with(path(".ifroute-eth0")) .and_return(IFROUTE_FILE) - expect(Routing.Read).to be true - expect(Routing.Routes).not_to be_empty + expect(Yast::Routing.Read).to be true + expect(Yast::Routing.Routes).not_to be_empty end it "replace implicit device name using explicit one" do - expect(SCR) + expect(Yast::SCR) .to receive(:Read) .with(path(".ifroute-eth0")) .and_return(IFROUTE_FILE) - expect(Routing.Read).to be true + expect(Yast::Routing.Read).to be true # check if implicit device name "-" is rewritten according device name # which ifroute belongs to - expect(Routing.Routes.first["device"]) + expect(Yast::Routing.Routes.first["device"]) .to eql "eth0" end it "removes duplicit routes" do - expect(SCR) + expect(Yast::SCR) .to receive(:Read) .with(path(".routes")) .and_return(ROUTES_FILE) - expect(SCR) + expect(Yast::SCR) .to receive(:Read) .with(path(".ifroute-eth0")) .and_return(IFROUTE_FILE) - expect(Routing.Read).to be true - expect(Routing.Routes.size).to eql 1 + expect(Yast::Routing.Read).to be true + expect(Yast::Routing.Routes.size).to eql 1 end end -describe "Routing#write_routes" do +describe "Yast::Routing#write_routes" do ROUTES_WITH_DEV = [ { "destination" => "default", @@ -96,39 +94,39 @@ ] it "writes device assigned routes into correct ifroute file" do - allow(SCR) + allow(Yast::SCR) .to receive(:Read) - .with(path(".target.size"), RoutingClass::ROUTES_FILE) + .with(path(".target.size"), Yast::RoutingClass::ROUTES_FILE) .and_return(1) - allow(Routing) + allow(Yast::Routing) .to receive(:devices) .and_return(["eth0", "eth1", "eth2"]) - expect(SCR) + expect(Yast::SCR) .to receive(:Execute) .with(path(".target.bash"), /^\/bin\/cp/) .and_return(0) - expect(SCR) + expect(Yast::SCR) .to receive(:Write) .with(path(".ifroute-eth0"), anything) .and_return(true) - expect(SCR) + expect(Yast::SCR) .to receive(:Write) .with(path(".ifroute-eth1"), anything) .and_return(true) - expect(SCR) + expect(Yast::SCR) .to receive(:Execute) .with(path(".target.remove"), "/etc/sysconfig/network/ifroute-eth2") .and_return(true) - expect(SCR) + expect(Yast::SCR) .to receive(:Write) .with(path(".target.string"), "/etc/sysconfig/network/routes", "") .and_return(true) - expect(Routing.write_routes(ROUTES_WITH_DEV)).to be true + expect(Yast::Routing.write_routes(ROUTES_WITH_DEV)).to be true end end -describe "Routing#Write" do +describe "Yast::Routing#Write" do AY_ROUTES = [ # empty AY config {}, @@ -161,20 +159,20 @@ it "does write route configuration files, ##{i}" do # Devices which have already been imported by Lan.Import have to be read. # (bnc#900352) - allow(NetworkInterfaces) + allow(Yast::NetworkInterfaces) .to receive(:List) .with("") .and_return(["eth0"]) - Routing.Import(ay_test) + Yast::Routing.Import(ay_test) - expect(Routing) + expect(Yast::Routing) .to receive(:write_route_file) .twice .with(kind_of(String), ay_test.fetch("routes", [])) .and_return true - Routing.Write + Yast::Routing.Write end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/install_inf_convertor_test.rb new/yast2-network-3.1.121/test/install_inf_convertor_test.rb --- old/yast2-network-3.1.119/test/install_inf_convertor_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/install_inf_convertor_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -4,7 +4,6 @@ require "yast" require "network/install_inf_convertor" -include Yast # for path shortcut and avoid namespace Yast.import "Proxy" @@ -67,7 +66,7 @@ it "returns empty string even in autoinst mode" do Yast.import "Mode" - allow(Mode).to receive(:autoinst) { true } + allow(Yast::Mode).to receive(:autoinst) { true } expect(@install_inf_convertor.send(:dev_name)).to be_empty end @@ -113,7 +112,7 @@ describe "#write_ifcfg" do it "creates ifcfg file for #{@device}" do - expect(SCR) + expect(Yast::SCR) .to receive(:Write) .with(path(".target.string"), /.*-#{@device}/, "") { true } expect(@install_inf_convertor.send(:write_ifcfg, "")).to eql true @@ -165,7 +164,7 @@ it "creates a valid ifcfg for netconfig" do expect(ifcfg = @install_inf_convertor.send(:create_ifcfg)).not_to be_empty expect(ifcfg).to include "BOOTPROTO='static'" - expect(ifcfg).to include "IPADDR='#{@ip}\/#{Netmask.ToBits(@netmask)}'" + expect(ifcfg).to include "IPADDR='#{@ip}\/#{Yast::Netmask.ToBits(@netmask)}'" end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/lan_udev_auto_test.rb new/yast2-network-3.1.121/test/lan_udev_auto_test.rb --- old/yast2-network-3.1.119/test/lan_udev_auto_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/lan_udev_auto_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -73,8 +73,6 @@ end describe "LanUdevAuto#Write" do - include Yast - ATTR = "ATTR{address}" VALUE = "aa:BB:cc:DD:ee:FF" NAME = "custom-name" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/link_handlers_test.rb new/yast2-network-3.1.121/test/link_handlers_test.rb --- old/yast2-network-3.1.119/test/link_handlers_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/link_handlers_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -12,7 +12,6 @@ end describe "phy_connected?" do - include Yast subject { LinkHandlersClass.new } before(:each) do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/netcard_test.rb new/yast2-network-3.1.121/test/netcard_test.rb --- old/yast2-network-3.1.119/test/netcard_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/netcard_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -69,10 +69,6 @@ require "yast" -include Yast -include UIShortcuts -include I18n - Yast.import "LanItems" describe "When querying netcard device name" do @@ -82,7 +78,7 @@ # mocking only neccessary parts of Yast::LanItems so we need not to call # and mock inputs for Yast::LanItems.Read here - @lan_items.Items = deep_copy(MOCKED_ITEMS) + @lan_items.Items = Yast.deep_copy(MOCKED_ITEMS) end it "returns empty list when querying device name with nil or empty input" do @@ -96,42 +92,48 @@ end end -describe "NetworkComplexInclude#HardwareName" do - before(:each) do +class NetworkComplexIncludeClass < Yast::Module + def initialize Yast.include self, "network/complex.rb" + end +end + +describe "NetworkComplexInclude#HardwareName" do + subject { NetworkComplexIncludeClass.new } + before(:each) do @hwinfo = MOCKED_ITEMS[0]["hwinfo"] @expected_desc = HWINFO_DEVICE_DESC end it "returns expected name when querying oldfashioned mac based id" do - expect(HardwareName([@hwinfo], "id-#{HWINFO_DEVICE_MAC}")) + expect(subject.HardwareName([@hwinfo], "id-#{HWINFO_DEVICE_MAC}")) .to eql @expected_desc end it "returns expected name when querying oldfashioned bus based id" do busid = "bus-#{HWINFO_DEVICE_BUS}-#{HWINFO_DEVICE_BUSID}" - expect(HardwareName([@hwinfo], busid)) + expect(subject.HardwareName([@hwinfo], busid)) .to eql @expected_desc end it "returns expected name when querying by device name" do - expect(HardwareName([@hwinfo], HWINFO_DEVICE_NAME)) + expect(subject.HardwareName([@hwinfo], HWINFO_DEVICE_NAME)) .to eql @expected_desc end it "returns empty string when id is not given" do - expect(HardwareName(@hwinfo, nil)).to be_empty - expect(HardwareName(@hwinfo, "")).to be_empty + expect(subject.HardwareName(@hwinfo, nil)).to be_empty + expect(subject.HardwareName(@hwinfo, "")).to be_empty end it "returns empty string when no hwinfo is available" do - expect(HardwareName(nil, HWINFO_DEVICE_NAME)).to be_empty - expect(HardwareName([], HWINFO_DEVICE_NAME)).to be_empty + expect(subject.HardwareName(nil, HWINFO_DEVICE_NAME)).to be_empty + expect(subject.HardwareName([], HWINFO_DEVICE_NAME)).to be_empty end it "returns empty string when querying unknown id" do - expect(HardwareName(@hwinfo, "unknown")).to be_empty + expect(subject.HardwareName(@hwinfo, "unknown")).to be_empty end end @@ -139,7 +141,7 @@ before(:each) do @lan_items = Yast::LanItems @lan_items.main - @lan_items.Items = deep_copy(MOCKED_ITEMS) + @lan_items.Items = Yast.deep_copy(MOCKED_ITEMS) end it "returns description and uses custom name if present" do @@ -183,7 +185,7 @@ before(:each) do @lan_items = Yast::LanItems @lan_items.main - @lan_items.Items = deep_copy(MOCKED_ITEMS) + @lan_items.Items = Yast.deep_copy(MOCKED_ITEMS) end it "removes an existing item" do @@ -218,7 +220,7 @@ before(:each) do @lan_items = Yast::LanItems @lan_items.main - @lan_items.Items = deep_copy(MOCKED_ITEMS) + @lan_items.Items = Yast.deep_copy(MOCKED_ITEMS) end it "returns name provided by hwinfo if not configured" do @@ -235,16 +237,17 @@ end describe "LanItemsClass#SetItemName" do + subject { Yast::LanItems } let(:new_name) { "new_name" } # this test covers bnc#914833 it "doesn't try to update udev rules when none exists for the item" do - allow(LanItems) + allow(subject) .to receive(:Items) .and_return(MOCKED_ITEMS) - item_id = LanItems.Items.find { |_k, v| !v.key?("udev") }.first - expect(LanItems.SetItemName(item_id, new_name)).to eql new_name + item_id = subject.Items.find { |_k, v| !v.key?("udev") }.first + expect(subject.SetItemName(item_id, new_name)).to eql new_name end end @@ -252,7 +255,7 @@ before(:each) do @lan_items = Yast::LanItems @lan_items.main - @lan_items.Items = deep_copy(MOCKED_ITEMS) + @lan_items.Items = Yast.deep_copy(MOCKED_ITEMS) end it "finds configured device" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/network_autoconfiguration_test.rb new/yast2-network-3.1.121/test/network_autoconfiguration_test.rb --- old/yast2-network-3.1.119/test/network_autoconfiguration_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/network_autoconfiguration_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -43,31 +43,6 @@ } end -# A two level section/key => value store -# to remember values of /etc/sysconfig/network/ifcfg-* -class SectionKeyValue - def initialize - @sections = {} - end - - def sections - @sections.keys - end - - def keys(section) - @sections[section].keys - end - - def get(section, key) - @sections[section][key] - end - - def set(section, key, value) - section_hash = @sections[section] ||= {} - section_hash[key] = value - end -end - describe Yast::NetworkAutoconfiguration do let(:instance) { Yast::NetworkAutoconfiguration.instance } let(:network_interfaces) { double("NetworkInterfaces") } @@ -116,22 +91,23 @@ .to receive(:GetType). with(/eth\d+/). and_return "eth" allow(Yast::NetworkInterfaces) .to receive(:GetType). with(""). and_return nil + Yast::NetworkInterfaces.instance_variable_set(:@initialized, false) # stub program execution # - interfaces are up allow(Yast::SCR) .to receive(:Execute) - .with(Yast::Path.new(".target.bash"), /^wicked ifstatus/) + .with(path(".target.bash"), /^wicked ifstatus/) .and_return 0 # - reload works allow(Yast::SCR) .to receive(:Execute) - .with(Yast::Path.new(".target.bash"), /^wicked ifreload/) + .with(path(".target.bash"), /^wicked ifreload/) .and_return 0 # - ping works allow(Yast::SCR) .to receive(:Execute) - .with(Yast::Path.new(".target.bash"), /^ping/) + .with(path(".target.bash"), /^ping/) .and_return 0 # These "expect" should be "allow", but then it does not work out, @@ -140,13 +116,13 @@ # Hardware detection expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".probe.netcard")) + .with(path(".probe.netcard")) .and_return([probe_netcard_factory(0), probe_netcard_factory(1)]) # link status expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".target.string"), %r{/sys/class/net/.*/carrier}) + .with(path(".target.string"), %r{/sys/class/net/.*/carrier}) .twice .and_return "1" @@ -156,15 +132,15 @@ allow(Yast::Confirm).to receive(:Detection).and_return true expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".etc.install_inf.BrokenModules")) + .with(path(".etc.install_inf.BrokenModules")) .and_return "" expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".udev_persistent.net")) + .with(path(".udev_persistent.net")) .and_return({}) expect(Yast::SCR) .to receive(:Read) - .with(Yast::Path.new(".udev_persistent.drivers")) + .with(path(".udev_persistent.drivers")) .and_return({}) end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/network_autoyast_test.rb new/yast2-network-3.1.121/test/network_autoyast_test.rb --- old/yast2-network-3.1.119/test/network_autoyast_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/network_autoyast_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -139,6 +139,8 @@ let(:network_autoyast) { Yast::NetworkAutoYast.instance } it "merges all necessary stuff" do + Yast.import "UI" + Yast::UI.as_null_object expect(network_autoyast).to receive(:merge_dns) expect(network_autoyast).to receive(:merge_routing) expect(network_autoyast).to receive(:merge_devices) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/read_hardware_test.rb new/yast2-network-3.1.121/test/read_hardware_test.rb --- old/yast2-network-3.1.119/test/read_hardware_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/read_hardware_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -1,16 +1,20 @@ #! /usr/bin/env rspec -ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +require_relative "test_helper" require "yast" -include Yast - require_relative "netcard_probe_helper" -Yast.include self, "network/routines.rb" +class ReadHardwareTestClass + def initialize + Yast.include self, "network/routines.rb" + end +end describe "#ReadHardware" do + subject { ReadHardwareTestClass.new } + def storage_only_devices devices = probe_netcard.select { |n| n["storageonly"] } devices.map { |d| d["dev_name"] } @@ -21,7 +25,7 @@ allow(Yast::SCR).to receive(:Read).and_return(nil) allow(Yast::SCR).to receive(:Read).with(path(".probe.netcard")) { probe_netcard } - read_storage_devices = ReadHardware("netcard").select do |d| + read_storage_devices = subject.ReadHardware("netcard").select do |d| storage_only_devices.include? d["dev_name"] end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/remote_test.rb new/yast2-network-3.1.121/test/remote_test.rb --- old/yast2-network-3.1.119/test/remote_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/remote_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -1,9 +1,8 @@ #!/usr/bin/env rspec -ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +require_relative "test_helper" require "yast" -require_relative "SCRStub" module Yast import "Remote" @@ -11,10 +10,6 @@ import "Package" import "Packages" - RSpec.configure do |c| - c.include SCRStub - end - describe Remote do describe ".Reset" do context "on vnc installation" do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/routines_test.rb new/yast2-network-3.1.121/test/routines_test.rb --- old/yast2-network-3.1.119/test/routines_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/routines_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -1,37 +1,41 @@ #! /usr/bin/env rspec -ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) +require_relative "test_helper" require "yast" -include Yast +class RoutinesTestClass + def initialize + Yast.include self, "network/routines.rb" -Yast.include self, "network/routines.rb" - -Yast.import "Stage" -Yast.import "Package" + Yast.import "Stage" + Yast.import "Package" + end +end describe "#PackagesInstall" do + subject { RoutinesTestClass.new } + context "when list of packages is empty" do it "returns :next without checking anything" do - expect(PackagesInstall([])).to eq(:next) - expect(Package).not_to receive(:InstalledAll) + expect(subject.PackagesInstall([])).to eq(:next) + expect(Yast::Package).not_to receive(:InstalledAll) end end context "in inst-sys" do it "returns :next without checking anything" do - allow(Stage).to receive(:stage).and_return("initial") - expect(PackagesInstall(["1", "2", "3"])).to eq(:next) - expect(Package).not_to receive(:InstalledAll) + allow(Yast::Stage).to receive(:stage).and_return("initial") + expect(subject.PackagesInstall(["1", "2", "3"])).to eq(:next) + expect(Yast::Package).not_to receive(:InstalledAll) end end context "on a running system" do it "checks whether all packages are installed and returns a symbol :next or :abort" do - allow(Stage).to receive(:stage).and_return("normal") - expect(Package).to receive(:InstalledAll).and_return(true) - expect(PackagesInstall(["1", "2", "3"])).to eq(:next) + allow(Yast::Stage).to receive(:stage).and_return("normal") + expect(Yast::Package).to receive(:InstalledAll).and_return(true) + expect(subject.PackagesInstall(["1", "2", "3"])).to eq(:next) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/routing_test.rb new/yast2-network-3.1.121/test/routing_test.rb --- old/yast2-network-3.1.119/test/routing_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/routing_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -4,17 +4,14 @@ require "yast" -include Yast -include UIShortcuts - -# This is needed bcs of Yast.includ(ed) dialog in UI tests -include I18n - +include Yast::I18n Yast.import "Routing" -describe Routing do - SYSCTL_IPV4_PATH = path(RoutingClass::SYSCTL_IPV4_PATH) - SYSCTL_IPV6_PATH = path(RoutingClass::SYSCTL_IPV6_PATH) +describe Yast::Routing do + before(:all) do + SYSCTL_IPV4_PATH = path(Yast::RoutingClass::SYSCTL_IPV4_PATH) + SYSCTL_IPV6_PATH = path(Yast::RoutingClass::SYSCTL_IPV6_PATH) + end # This describes how Routing should behave independently on the way how its # internal state was reached @@ -23,17 +20,17 @@ @value4 = forward_v4 ? "1" : "0" @value6 = forward_v6 ? "1" : "0" - allow(SCR).to receive(:Execute) { nil } + allow(Yast::SCR).to receive(:Execute) { nil } end def fw_independent_write_expects - expect(SCR) + expect(Yast::SCR) .to receive(:Execute) .with( path(".target.bash"), "echo #{@value4} > /proc/sys/net/ipv4/ip_forward" ) - expect(SCR) + expect(Yast::SCR) .to receive(:Execute) .with( path(".target.bash"), @@ -43,40 +40,40 @@ context "when Firewall is enabled" do before(:each) do - allow(SuSEFirewall).to receive(:IsEnabled) { true } + allow(Yast::SuSEFirewall).to receive(:IsEnabled) { true } end describe "#WriteIPForwarding" do it "Delegates setup to SuSEFirewall2" do - expect(SuSEFirewall) + expect(Yast::SuSEFirewall) .to receive(:SetSupportRoute) .with(forward_v4) fw_independent_write_expects - expect(Routing.WriteIPForwarding).to be_equal nil + expect(Yast::Routing.WriteIPForwarding).to be_equal nil end end end context "when Firewall is disabled" do before(:each) do - allow(SuSEFirewall).to receive(:IsEnabled) { false } + allow(Yast::SuSEFirewall).to receive(:IsEnabled) { false } end describe "#WriteIPForwarding" do it "Updates IPv4 and IPv6 forwarding in sysctl.conf" do - allow(SCR).to receive(:Write) { nil } - expect(SCR) + allow(Yast::SCR).to receive(:Write) { nil } + expect(Yast::SCR) .to receive(:Write) .with(SYSCTL_IPV4_PATH, @value4) - expect(SCR) + expect(Yast::SCR) .to receive(:Write) .with(SYSCTL_IPV6_PATH, @value6) fw_independent_write_expects - expect(Routing.WriteIPForwarding).to be_equal nil + expect(Yast::Routing.WriteIPForwarding).to be_equal nil end end end @@ -100,20 +97,20 @@ context "when user sets IPv4 Forwarding to #{ipv4} and IPv6 to #{ipv6}" do before(:each) do - Wizard.as_null_object - Label.as_null_object - Netmask.as_null_object - Popup.as_null_object + Yast::Wizard.as_null_object + Yast::Label.as_null_object + Yast::Netmask.as_null_object + Yast::Popup.as_null_object Yast.import "UI" - allow(UI).to receive(:QueryWidget) { "" } - expect(UI) + allow(Yast::UI).to receive(:QueryWidget) { "" } + expect(Yast::UI) .to receive(:QueryWidget) .with(Id(:forward_v4), :Value) { ipv4 } - expect(UI) + expect(Yast::UI) .to receive(:QueryWidget) .with(Id(:forward_v6), :Value) { ipv6 } - expect(UI) + expect(Yast::UI) .to receive(:WaitForEvent) { { "ID" => :ok } } Yast.include self, "network/services/routing.rb" @@ -156,7 +153,7 @@ context "when ip_forward is #{ipfw} in AutoYast profile" do before(:all) do - Routing.Import(config) + Yast::Routing.Import(config) end it_should_behave_like "routing setter" do @@ -168,11 +165,11 @@ describe "#Import" do it "Returns true for non nil settings" do - expect(Routing.Import({})).to be true + expect(Yast::Routing.Import({})).to be true end it "Returns true for nil settings" do - expect(Routing.Import(nil)).to be true + expect(Yast::Routing.Import(nil)).to be true end end @@ -222,14 +219,14 @@ AY_TESTS.each do |ay_test| it "Returns hash with proper values" do - Routing.Import(ay_test[:input]) - expect(Routing.Export).to include(*ay_test[:keys]) + Yast::Routing.Import(ay_test[:input]) + expect(Yast::Routing.Export).to include(*ay_test[:keys]) end it "Overloads generic ip_forward using concrete one" do - Routing.Import(ay_test[:input]) + Yast::Routing.Import(ay_test[:input]) - exported = Routing.Export + exported = Yast::Routing.Export expect(exported["ipv4_forward"]) .to eql(ay_test[:input]["ipv4_forward"]) if ay_test[:input].key?("ipv4_forward") expect(exported["ipv6_forward"]) @@ -258,18 +255,18 @@ context "when ipv4.ip_forward=#{ipv4} and .ipv6.conf.all.forwarding=#{ipv6}" do before(:each) do - allow(SCR).to receive(:Read) { nil } - expect(SCR) + allow(Yast::SCR).to receive(:Read) { nil } + expect(Yast::SCR) .to receive(:Read) .with(path(".routes")) { MOCKED_ROUTES } - expect(SCR) + expect(Yast::SCR) .to receive(:Read) .with(SYSCTL_IPV4_PATH) { ipv4 } - expect(SCR) + expect(Yast::SCR) .to receive(:Read) .with(SYSCTL_IPV6_PATH) { ipv6 } - Routing.Read + Yast::Routing.Read end it_should_behave_like "routing setter" do @@ -279,9 +276,9 @@ describe "#Read" do it "loads configuration from system" do - NetworkInterfaces.as_null_object + Yast::NetworkInterfaces.as_null_object - expect(Routing.Read).to be true + expect(Yast::Routing.Read).to be true end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/s390_helpers_test.rb new/yast2-network-3.1.121/test/s390_helpers_test.rb --- old/yast2-network-3.1.119/test/s390_helpers_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/s390_helpers_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -8,7 +8,7 @@ $LOAD_PATH.unshift File.expand_path("../../src", __FILE__) require "include/network/lan/s390" -class NetworkLanS390Include < Yast::Client +class NetworkLanS390IncludeTestClient < Yast::Client include Singleton def initialize @@ -20,6 +20,7 @@ Yast.import "FileUtils" describe "NetworkLanS390Include::s390_DriverLoaded" do + subject { NetworkLanS390IncludeTestClient.instance } DEVNAME = "devname" before(:each) do @@ -36,8 +37,7 @@ .with("#{Yast::NetworkLanS390Include::SYS_DIR}/#{DEVNAME}") .and_return(true) - expect(NetworkLanS390Include.instance.s390_DriverLoaded(DEVNAME)) - .to be true + expect(subject.s390_DriverLoaded(DEVNAME)).to be true end it "fails when driver is not loaded" do @@ -46,7 +46,6 @@ .with("#{Yast::NetworkLanS390Include::SYS_DIR}/#{DEVNAME}") .and_return(false) - expect(NetworkLanS390Include.instance.s390_DriverLoaded(DEVNAME)) - .to be false + expect(subject.s390_DriverLoaded(DEVNAME)).to be false end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/test_helper.rb new/yast2-network-3.1.121/test/test_helper.rb --- old/yast2-network-3.1.119/test/test_helper.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/test_helper.rb 2015-07-02 17:17:43.000000000 +0200 @@ -1,3 +1,59 @@ srcdir = File.expand_path("../../src", __FILE__) y2dirs = ENV.fetch("Y2DIR", "").split(":") ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":") + +require "yast" +require "yast/rspec" + +require_relative "SCRStub" + +RSpec.configure do |c| + c.include SCRStub +end + +# A two level section/key => value store +# to remember values of /etc/sysconfig/network/ifcfg-* +class SectionKeyValue + def initialize + @sections = {} + end + + def sections + @sections.keys + end + + def keys(section) + @sections[section].keys + end + + def get(section, key) + @sections[section][key] + end + + def set(section, key, value) + section_hash = @sections[section] ||= {} + section_hash[key] = value + end +end + +if ENV["COVERAGE"] + require "simplecov" + SimpleCov.start do + add_filter "/test/" + end + + # For coverage we need to load all ruby files + # Note that clients/ are excluded because they run too eagerly by design + Dir["#{srcdir}/{include,modules}/**/*.rb"].each do |f| + require_relative f + end + + # use coveralls for on-line code coverage reporting at Travis CI + if ENV["TRAVIS"] + require "coveralls" + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter + ] + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/test/widgets_test.rb new/yast2-network-3.1.121/test/widgets_test.rb --- old/yast2-network-3.1.119/test/widgets_test.rb 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/test/widgets_test.rb 2015-07-02 17:17:43.000000000 +0200 @@ -4,18 +4,21 @@ require "yast" -include Yast -include UIShortcuts -include I18n - Yast.import "LanItems" -Yast.include self, "network/widgets.rb" + +class WidgetsTestClass < Yast::Module + def initialize + Yast.include self, "network/widgets.rb" + end +end describe "NetworkWidgetsInclude::ipoib_mode_widget" do + subject { WidgetsTestClass.new } + it "contains known IPoIB modes" do - widget_def = ipoib_mode_widget + widget_def = subject.ipoib_mode_widget expect(widget_def).to include("items") - expect(widget_def["items"]).to be_eql LanItems.ipoib_modes.to_a + expect(widget_def["items"]).to be_eql Yast::LanItems.ipoib_modes.to_a end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-network-3.1.119/testsuite/tests/Network_YaPI.out new/yast2-network-3.1.121/testsuite/tests/Network_YaPI.out --- old/yast2-network-3.1.119/testsuite/tests/Network_YaPI.out 2015-06-15 13:27:08.000000000 +0200 +++ new/yast2-network-3.1.121/testsuite/tests/Network_YaPI.out 2015-07-02 17:17:43.000000000 +0200 @@ -6,8 +6,7 @@ Read .sysconfig.network.config.NETCONFIG_DNS_POLICY nil Read .sysconfig.network.config.NETCONFIG_DNS_STATIC_SERVERS "208.67.222.222 208.67.220.220" Read .sysconfig.network.config.NETCONFIG_DNS_STATIC_SEARCHLIST "suse.cz suse.de" -Read .target.stat "/etc/hostname" $["exists":true] -Read .target.string "/etc/hostname" "laptop.suse.cz" +Execute .target.bash_output "hostname --fqdn" $["exit":0, "stderr":"", "stdout":"laptop.suse.cz"] Dir .network.section: ["eth0", "eth1", "eth2", "eth3", "eth4", "eth5", "eth5.23"] Dir .network.value."eth0": ["BOOTPROTO", "STARTMODE"] Read .network.value."eth0".BOOTPROTO "dhcp4"