Hello community, here is the log from the commit of package yast2-fcoe-client for openSUSE:Factory checked in at 2017-09-21 12:31:14 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2-fcoe-client (Old) and /work/SRC/openSUSE:Factory/.yast2-fcoe-client.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-fcoe-client" Thu Sep 21 12:31:14 2017 rev:45 rq:526976 version:3.1.15 Changes: -------- --- /work/SRC/openSUSE:Factory/yast2-fcoe-client/yast2-fcoe-client.changes 2016-08-10 19:54:01.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2-fcoe-client.new/yast2-fcoe-client.changes 2017-09-21 12:31:15.061612332 +0200 @@ -1,0 +2,6 @@ +Fri Sep 15 11:31:03 UTC 2017 - mvid...@suse.com + +- Fix wrong interface name with auto_vlan=yes (bsc#1043419) +- 3.1.15 + +------------------------------------------------------------------- Old: ---- yast2-fcoe-client-3.1.14.tar.bz2 New: ---- yast2-fcoe-client-3.1.15.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2-fcoe-client.spec ++++++ --- /var/tmp/diff_new_pack.VQvSmU/_old 2017-09-21 12:31:16.069470497 +0200 +++ /var/tmp/diff_new_pack.VQvSmU/_new 2017-09-21 12:31:16.069470497 +0200 @@ -1,7 +1,7 @@ # # spec file for package yast2-fcoe-client # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: yast2-fcoe-client -Version: 3.1.14 +Version: 3.1.15 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build ++++++ yast2-fcoe-client-3.1.14.tar.bz2 -> yast2-fcoe-client-3.1.15.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/.coveralls.yml new/yast2-fcoe-client-3.1.15/.coveralls.yml --- old/yast2-fcoe-client-3.1.14/.coveralls.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-fcoe-client-3.1.15/.coveralls.yml 2017-09-18 11:10:14.469313087 +0200 @@ -0,0 +1 @@ +service_name: travis-ci diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/.travis.yml new/yast2-fcoe-client-3.1.15/.travis.yml --- old/yast2-fcoe-client-3.1.14/.travis.yml 2016-07-27 11:40:42.450145716 +0200 +++ new/yast2-fcoe-client-3.1.15/.travis.yml 2017-09-18 11:10:14.469313087 +0200 @@ -1,16 +1,14 @@ -language: cpp -compiler: - - gcc +sudo: required +language: bash +services: + - docker + before_install: - # 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" -g "rspec:3.3.0 yast-rake gettext" -script: - - rake check:syntax - - rake check:pot - - make -f Makefile.cvs - - make - - sudo make install - - make check + - docker build -t yast-fcoe-client-image . + # list the installed packages (just for easier debugging) + - docker run --rm -it yast-fcoe-client-image rpm -qa | sort +script: + # the "yast-travis-ruby" script is included in the base yastdevel/ruby image + # see https://github.com/yast/docker-yast-ruby/blob/master/yast-travis-ruby + - docker run -it -e TRAVIS=1 -e TRAVIS_JOB_ID="$TRAVIS_JOB_ID" yast-fcoe-client-image yast-travis-ruby diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/.yardopts new/yast2-fcoe-client-3.1.15/.yardopts --- old/yast2-fcoe-client-3.1.14/.yardopts 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-fcoe-client-3.1.15/.yardopts 2017-09-18 11:10:14.469313087 +0200 @@ -0,0 +1,6 @@ +--no-private +--markup markdown +--protected +--output-dir ./doc/autodocs +--files *.md +src/**/*.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/CONTRIBUTING.md new/yast2-fcoe-client-3.1.15/CONTRIBUTING.md --- old/yast2-fcoe-client-3.1.14/CONTRIBUTING.md 2016-07-27 11:40:42.450145716 +0200 +++ new/yast2-fcoe-client-3.1.15/CONTRIBUTING.md 2017-09-18 11:10:14.469313087 +0200 @@ -3,7 +3,7 @@ YaST is an open source project and as such it welcomes all kinds of contributions. If you decide to contribute, please follow these guidelines to -ensure the process is effective and pleasant both for you and YaST maintainers. +ensure the process is effective and pleasant both for you and the YaST maintainers. There are two main forms of contribution: reporting bugs and performing code changes. @@ -17,13 +17,11 @@ registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp) if you don't have an account yet.) -If you find a problem, please report it either using -[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee -that every bug will be fixed, but we'll try. - When creating a bug report, please follow our [bug reporting guidelines](http://en.opensuse.org/openSUSE:Report_a_YaST_bug). +We can't guarantee that every bug will be fixed, but we'll try. + Code Changes ------------ @@ -44,15 +42,22 @@ to the [Ruby style guide](https://github.com/SUSE/style-guides/blob/master/Ruby.md). - 4. Make sure your change didn't break anything by building the RPM package + 4. Update the package version (in `packages/*.spec`, usually by + `rake version:bump`) and add a new entry to the `package/*.changes` file + (by `osc vc package`). + For bigger changes or changes which need longer discussion it is advised to + add this as a separate last commit so it can be easily updated when another + change is merged in the meantime. + + 5. Make sure your change didn't break anything by building the RPM package (`rake osc:build`). The build process includes running the full testsuite. - 5. Publish the branch and create a pull request. + 6. Publish the branch and create a pull request. - 6. YaST developers will review your change and possibly point out issues. + 7. YaST developers will review your change and possibly point out issues. Adapt the code under their guidance until they are all resolved. - 7. Finally, the pull request will get merged or rejected. + 8. Finally, the pull request will get merged or rejected. See also [GitHub's guide on contributing](https://help.github.com/articles/fork-a-repo). @@ -60,9 +65,6 @@ If you want to do multiple unrelated changes, use separate branches and pull requests. -Do not change the `VERSION` and `*.changes` files as this could lead to -conflicts. - ### Commits Each commit in the pull request should do only one thing, which is clearly diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/Dockerfile new/yast2-fcoe-client-3.1.15/Dockerfile --- old/yast2-fcoe-client-3.1.14/Dockerfile 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-fcoe-client-3.1.15/Dockerfile 2017-09-18 11:10:14.469313087 +0200 @@ -0,0 +1,3 @@ +FROM yastdevel/ruby +COPY . /usr/src/app + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.changes new/yast2-fcoe-client-3.1.15/package/yast2-fcoe-client.changes --- old/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.changes 2016-07-27 11:40:42.490145716 +0200 +++ new/yast2-fcoe-client-3.1.15/package/yast2-fcoe-client.changes 2017-09-18 11:10:14.469313087 +0200 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Sep 15 11:31:03 UTC 2017 - mvid...@suse.com + +- Fix wrong interface name with auto_vlan=yes (bsc#1043419) +- 3.1.15 + +------------------------------------------------------------------- Tue Jul 26 09:43:33 CEST 2016 - g...@suse.de - handle duplicate vlan ids correctly (bsc#988050) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.spec new/yast2-fcoe-client-3.1.15/package/yast2-fcoe-client.spec --- old/yast2-fcoe-client-3.1.14/package/yast2-fcoe-client.spec 2016-07-27 11:40:42.490145716 +0200 +++ new/yast2-fcoe-client-3.1.15/package/yast2-fcoe-client.spec 2017-09-18 11:10:14.473313087 +0200 @@ -17,7 +17,7 @@ Name: yast2-fcoe-client -Version: 3.1.14 +Version: 3.1.15 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/src/clients/fcoe-client_auto.rb new/yast2-fcoe-client-3.1.15/src/clients/fcoe-client_auto.rb --- old/yast2-fcoe-client-3.1.14/src/clients/fcoe-client_auto.rb 2016-07-27 11:40:42.490145716 +0200 +++ new/yast2-fcoe-client-3.1.15/src/clients/fcoe-client_auto.rb 2017-09-18 11:10:14.473313087 +0200 @@ -145,7 +145,6 @@ # FCoE is possible. We can not start exactly the interface from imported # data because the numeration of interfaces (eth0, eth1...) may differ. Builtins.foreach(@detected_netcards) do |card| - vlan_interface = "" fcoe_vlan_interface = "" command = "" output = {} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/src/include/fcoe-client/complex.rb new/yast2-fcoe-client-3.1.15/src/include/fcoe-client/complex.rb --- old/yast2-fcoe-client-3.1.14/src/include/fcoe-client/complex.rb 2016-07-27 11:40:42.534145716 +0200 +++ new/yast2-fcoe-client-3.1.15/src/include/fcoe-client/complex.rb 2017-09-18 11:10:14.473313087 +0200 @@ -182,7 +182,6 @@ end def ShowInterfaces - vlan_interface = "" row = 0 netcards = FcoeClient.GetNetworkCards @@ -314,9 +313,7 @@ # Handle # - def HandleServicesDialog(id, event) - event = deep_copy(event) - action = Ops.get(event, "ID") + def HandleServicesDialog(_id, _event) nil end @@ -351,6 +348,7 @@ card = FcoeClient.GetCurrentNetworkCard Builtins.y2milestone("Selected card: %1", card) dev_name = Ops.get_string(card, "dev_name", "") + vlan_interface = card.fetch("vlan_interface", "") # eg. "200" configured_vlans = FcoeClient.IsConfigured(dev_name) @@ -365,28 +363,22 @@ # text of an error popup Popup.Error( Builtins.sformat( - _( - "Cannot start FCoE on VLAN interface %1\n" + + _("Cannot start FCoE on VLAN interface %1\n" + "because FCoE is already configured on\n" + - "network interface %2 itself." - ), - Ops.get_string(card, "vlan_interface", ""), - dev_name + "network interface %2 itself."), + vlan_interface, dev_name ) ) return nil end - if Ops.get_string(card, "vlan_interface", "") == "0" + if vlan_interface == "0" # text of an error popup Popup.Error( Builtins.sformat( - _( - "Cannot start FCoE on network interface %1 itself\n" + + _("Cannot start FCoE on network interface %1 itself\n" + "because FCoE is already configured on\n" + - "VLAN interface(s) %2." - ), - dev_name, - configured_vlans + "VLAN interface(s) %2."), + dev_name, configured_vlans ) ) return nil @@ -400,30 +392,27 @@ ) end - command = Builtins.sformat("fipvlan -c -s %1", dev_name) + if card["auto_vlan"] == "yes" || vlan_interface == "0" + command = "fipvlan -c -s -f '-fcoe' #{dev_name}" + else + command = "fipvlan -c -s #{dev_name}" + end output = {} fcoe_vlan_interface = "" status_map = {} - ifcfg_file = Builtins.sformat( - "/etc/sysconfig/network/ifcfg-%1.%2", - dev_name, - Ops.get_string(card, "vlan_interface", "") - ) + ifcfg_file = "/etc/sysconfig/network/ifcfg-#{dev_name}.#{vlan_interface}" # headline of a popup: creating and starting Fibre Channel over Ethernet ret = Popup.YesNoHeadline( _("Creating and Starting FCoE on Detected VLAN Device"), # question to the user: really create and start FCoE Builtins.sformat( - _( - "Do you really want to create a FCoE network\n" + + _("Do you really want to create a FCoE network\n" + "interface for discovered VLAN interface %1\n" + - "on %2 and start the FCoE initiator?" - ), - Ops.get_string(card, "vlan_interface", ""), - dev_name + "on %2 and start the FCoE initiator?"), + vlan_interface, dev_name ) ) if ret == true @@ -450,11 +439,7 @@ # if /etc/sysconfig/network/ifcfg-<if>.<vlan> already exists # call 'ifup' for the interface (creates /proc/net/vlan/<if>.<vlan>) if FileUtils.Exists(ifcfg_file) - cmd_ifup = Builtins.sformat( - "ifup %1.%2", - dev_name, - Ops.get_string(card, "vlan_interface", "") - ) + cmd_ifup = Builtins.sformat("ifup %1.%2", dev_name, vlan_interface) Builtins.y2milestone("Executing command: %1", cmd_ifup) output = Convert.to_map( SCR.Execute(path(".target.bash_output"), cmd_ifup) @@ -774,9 +759,7 @@ nil end - def HandleConfigurationDialog(id, event) - event = deep_copy(event) - action = Ops.get(event, "ID") + def HandleConfigurationDialog(_id, _event) nil end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/src/modules/FcoeClient.rb new/yast2-fcoe-client-3.1.15/src/modules/FcoeClient.rb --- old/yast2-fcoe-client-3.1.14/src/modules/FcoeClient.rb 2016-07-27 11:40:42.574145716 +0200 +++ new/yast2-fcoe-client-3.1.15/src/modules/FcoeClient.rb 2017-09-18 11:10:14.477313087 +0200 @@ -36,6 +36,27 @@ FCOE_PKG_NAME = "fcoe-utils" + # Used by FcoeClientClass to keep data about an individual network interface + # (Not a real class; documents the structure of a Hash) + class Interface < Hash + # @!method [](k) + # I am not sure when the keys are present/absent :-/ + # @option k [String] 'fcoe_vlan' + # "eth1.500" or "not configured" or "not available" + # @option k [String] 'vlan_interface' + # "500", or "0" for no VLAN used; yes, the name is nonsense, should be "vid" + # @option k [String] 'dev_name' "eth1" + # @option k [String] 'auto_vlan' "yes" or "no" + # @option k [String] 'mac_addr' "00:11:22:33:44:55" + # @option k [String] 'fcoe_enable' "yes" or "no" + # @option k [String] 'dcb_required' "yes" or "no" + # @option k [String] 'dcb_capable' "yes" or "no" + # @option k [String] 'cfg_device' "eth1.500" or "" ??? + # @option k [Boolean] 'fcoe_flag' fcoe offload + # @option k [Boolean] 'iscsi_flag' scsi offload + # @option k [Boolean] 'storage_only' + end + def main Yast.import "UI" textdomain "fcoe-client" @@ -369,6 +390,7 @@ end # Get currently selected network card + # @return [Interface] def GetCurrentNetworkCard Ops.get(@network_interfaces, @current_card, {}) end @@ -673,7 +695,6 @@ # def GetFcoeStatus(vlan_device_name, device_name) status_map = {} - content = "" file_name = "" device = vlan_device_name @@ -934,7 +955,8 @@ # # Check whether there are configured FCoE VLANs for the given network interface # Return list of configured VLANs - # + # @param device_name [String] "eth1" + # @return [Array<String>] ["200", "300"] def IsConfigured(device_name) configured_vlans = [] interfaces = GetNetworkCards() @@ -952,9 +974,9 @@ deep_copy(configured_vlans) end - # # Detect network interface cards (hardware probe) - # + # @return [Array<Hash>] .probe.netcard output + # (except the items without dev_name) def ProbeNetcards if !TestMode() netcards = Convert.convert( @@ -1012,7 +1034,8 @@ # eth3 08:00:... Gigabit... 200 eth3.200 yes/no yes/no yes/no yes/no eth3.200 # # Get the network cards and check Fcoe status - # + # @param netcards [Array<Hash>] .probe.netcard output + # @return [Array<Interface>] def DetectNetworkCards(netcards) return [] if netcards == nil @@ -1223,107 +1246,33 @@ success = true Builtins.foreach(netcards) do |card| - if Ops.get_string(card, "fcoe_vlan", "") != @NOT_AVAILABLE && - Ops.get_string(card, "fcoe_vlan", "") != @NOT_CONFIGURED + fcoe_vlan = card.fetch("fcoe_vlan", "") + if fcoe_vlan != @NOT_AVAILABLE && + fcoe_vlan != @NOT_CONFIGURED # write ifcfg-<if>.>VLAN> only if VLAN was created (not for VLAN = 0 which means # FCoE is started on the network interface itself) - if Ops.get_string(card, "vlan_interface", "") != "0" - Builtins.y2milestone( - "Writing /etc/sysconfig/network/ifcfg-%1", - Ops.get_string(card, "fcoe_vlan", "") - ) + dev_name = card.fetch("dev_name", "") + vid = card.fetch("vlan_interface", "") + if vid != "0" + Builtins.y2milestone("Writing /etc/sysconfig/network/ifcfg-%1", fcoe_vlan) + vifcfg_path = path(".network.value") + fcoe_vlan # write /etc/sysconfig/network/ifcfg-<fcoe-vlan-interface>, e.g. ifcfg-eth3.200 - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "fcoe_vlan", "") - ), - "BOOTPROTO" - ), - "static" - ) - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "fcoe_vlan", "") - ), - "STARTMODE" - ), - "nfsroot" - ) - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "fcoe_vlan", "") - ), - "ETHERDEVICE" - ), - Ops.get_string(card, "dev_name", "") - ) - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "fcoe_vlan", "") - ), - "USERCONTROL" - ), - "no" - ) + SCR.Write(vifcfg_path + "BOOTPROTO", "static") + SCR.Write(vifcfg_path + "STARTMODE", "nfsroot") + SCR.Write(vifcfg_path + "ETHERDEVICE", dev_name) + SCR.Write(vifcfg_path + "USERCONTROL", "no") + SCR.Write(vifcfg_path + "VLAN_ID", vid) end - ifcfg_file = Builtins.sformat( - "/etc/sysconfig/network/ifcfg-%1", - Ops.get_string(card, "dev_name", "") - ) + ifcfg_file = "/etc/sysconfig/network/ifcfg-#{dev_name}" Builtins.y2milestone("Writing %1", ifcfg_file) # write /etc/sysconfig/network/ifcfg-<interface> (underlying interface), e.g. ifcfg-eth3 + ifcfg_path = path(".network.value") + dev_name + SCR.Write(ifcfg_path + "STARTMODE", "nfsroot") + # don't overwrite BOOTPROTO !!! if !FileUtils.Exists(ifcfg_file) - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "dev_name", "") - ), - "BOOTPROTO" - ), - "static" - ) - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "dev_name", "") - ), - "STARTMODE" - ), - "nfsroot" - ) - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "dev_name", "") - ), - "NAME" - ), - Ops.get_string(card, "device", "") - ) - else - # don't overwrite BOOTPROTO !!! - SCR.Write( - Ops.add( - Ops.add( - path(".network.value"), - Ops.get_string(card, "dev_name", "") - ), - "STARTMODE" - ), - "nfsroot" - ) + SCR.Write(ifcfg_path + "BOOTPROTO", "static") + SCR.Write(ifcfg_path + "NAME", card.fetch("device", "")) end end end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/test/DetectNetworkCards_spec.rb new/yast2-fcoe-client-3.1.15/test/DetectNetworkCards_spec.rb --- old/yast2-fcoe-client-3.1.14/test/DetectNetworkCards_spec.rb 2016-07-27 11:40:42.594145716 +0200 +++ new/yast2-fcoe-client-3.1.15/test/DetectNetworkCards_spec.rb 2017-09-18 11:10:14.477313087 +0200 @@ -1,5 +1,6 @@ #!/usr/bin/env rspec -require_relative '../src/modules/FcoeClient' +require_relative "test_helper" +Yast.import "FcoeClient" describe Yast::FcoeClientClass do before :each do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/test/GetVlanInterfaces_spec.rb new/yast2-fcoe-client-3.1.15/test/GetVlanInterfaces_spec.rb --- old/yast2-fcoe-client-3.1.14/test/GetVlanInterfaces_spec.rb 2016-07-27 11:40:42.594145716 +0200 +++ new/yast2-fcoe-client-3.1.15/test/GetVlanInterfaces_spec.rb 2017-09-18 11:10:14.481313087 +0200 @@ -1,5 +1,6 @@ #!/usr/bin/env rspec -require_relative '../src/modules/FcoeClient' +require_relative "test_helper" +Yast.import "FcoeClient" describe Yast::FcoeClientClass do before :each do diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/test/Makefile.am new/yast2-fcoe-client-3.1.15/test/Makefile.am --- old/yast2-fcoe-client-3.1.14/test/Makefile.am 2016-07-27 11:40:42.594145716 +0200 +++ new/yast2-fcoe-client-3.1.15/test/Makefile.am 2017-09-18 11:10:14.481313087 +0200 @@ -1,4 +1,5 @@ TESTS = \ + fcoe_client_write_spec.rb \ DetectNetworkCards_spec.rb \ GetVlanInterfaces_spec.rb diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/test/fcoe_client_complex_include_test.rb new/yast2-fcoe-client-3.1.15/test/fcoe_client_complex_include_test.rb --- old/yast2-fcoe-client-3.1.14/test/fcoe_client_complex_include_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-fcoe-client-3.1.15/test/fcoe_client_complex_include_test.rb 2017-09-18 11:10:14.481313087 +0200 @@ -0,0 +1,44 @@ +#!/usr/bin/env rspec +require_relative "test_helper" + +Yast.import "Popup" + +class ComplexIncludeTest < Yast::Module + def initialize + Yast.include self, "fcoe-client/complex.rb" + end +end + +describe "Yast::FcoeClientComplexInclude" do + subject { ComplexIncludeTest.new } + + describe "#HandleInterfacesDialog" do + context "when handling :create" do + let(:event) { { "ID" => :create } } + + before do + card = { + "dev_name" => "eth9", + "fcoe_vlan" => "eth9.500", + "vlan_interface" => "500" + } + expect(Yast::FcoeClient) + .to receive(:GetCurrentNetworkCard).twice + .and_return(card) + expect(Yast::FcoeClient) + .to receive(:GetNetworkCards).twice + .and_return([card]) + expect(Yast::Popup).to receive(:YesNoHeadline).and_return(true) + end + + it "smokes not" do + expect(Yast::SCR) + .to receive(:Execute) + .with(path(".target.bash_output"), "fipvlan -c -s eth9") + .and_return({"exit" => 0}) + expect(Yast::FcoeClient).to receive(:GetFcoeVlanInterface).and_return("eth9.500") + expect { subject.HandleInterfacesDialog(nil, event) }.to_not raise_error + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/test/fcoe_client_write_spec.rb new/yast2-fcoe-client-3.1.15/test/fcoe_client_write_spec.rb --- old/yast2-fcoe-client-3.1.14/test/fcoe_client_write_spec.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-fcoe-client-3.1.15/test/fcoe_client_write_spec.rb 2017-09-18 11:10:14.481313087 +0200 @@ -0,0 +1,48 @@ +#!/usr/bin/env rspec +require_relative "test_helper" +Yast.import "FcoeClient" + +describe Yast::FcoeClientClass do + subject { Yast::FcoeClient } + + describe "#ProbeNetcards" do + before do + expect(subject).to receive(:TestMode).and_return true + end + + it "returns an array" do + expect(subject.ProbeNetcards).to be_an Array + end + end + + describe "#WriteSysconfigFiles" do + context "for odd cases" do + before do + interfaces = [ + { "fcoe_vlan" => "not available" }, + { "fcoe_vlan" => "not configured" }, + ] + expect(subject).to receive(:GetNetworkCards).and_return(interfaces) + end + + it "smokes not" do + expect { subject.WriteSysconfigFiles }.to_not raise_error + end + end + + context "for a small FCoE setup" do + before do + interfaces = [ + { "fcoe_vlan" => "eth1.500" } + ] + expect(subject).to receive(:GetNetworkCards).and_return(interfaces) + allow(Yast::SCR).to receive(:Write).and_return(true) + allow(Yast::FileUtils).to receive(:Exists).and_return(false) + end + + it "smokes not" do + expect { subject.WriteSysconfigFiles }.to_not raise_error + end + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-fcoe-client-3.1.14/test/test_helper.rb new/yast2-fcoe-client-3.1.15/test/test_helper.rb --- old/yast2-fcoe-client-3.1.14/test/test_helper.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-fcoe-client-3.1.15/test/test_helper.rb 2017-09-18 11:10:14.481313087 +0200 @@ -0,0 +1,25 @@ +srcdir = File.expand_path("../../src", __FILE__) +y2dirs = ENV.fetch("Y2DIR", "").split(":") +ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":") + +require "yast" +require "yast/rspec" + +if ENV["COVERAGE"] + require "simplecov" + SimpleCov.start do + add_filter "/test/" + end + + # track all ruby files under src + SimpleCov.track_files("#{srcdir}/**/*.rb") + + # use coveralls for on-line code coverage reporting at Travis CI + if ENV["TRAVIS"] + require "coveralls" + SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter.new [ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter + ] + end +end