Skip to content

Commit

Permalink
merged with sles12-sp4
Browse files Browse the repository at this point in the history
  • Loading branch information
schubi2 committed Jan 3, 2019
2 parents d6ace80 + b3b53ea commit 859578f
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 31 deletions.
6 changes: 6 additions & 0 deletions package/yast2-network.changes
@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 2 17:17:58 CET 2019 - schubi@suse.de

- Showing correct start mode for nfsroot device (bsc#1105692).
- 4.1.26

-------------------------------------------------------------------
Tue Dec 18 12:49:47 UTC 2018 - mfilka@suse.com

Expand Down
2 changes: 1 addition & 1 deletion package/yast2-network.spec
Expand Up @@ -17,7 +17,7 @@


Name: yast2-network
Version: 4.1.25
Version: 4.1.26
Release: 0
BuildArch: noarch

Expand Down
4 changes: 4 additions & 0 deletions src/modules/LanItems.rb
Expand Up @@ -1384,6 +1384,10 @@ def startmode_overview(item_id)
"hotplug" => _(
"Started automatically at boot"
),
# summary description of STARTMODE=nfsroot
"nfsroot" => _(
"Started automatically at boot"
),
# summary description of STARTMODE=ifplugd
"ifplugd" => _(
"Started automatically on cable connection"
Expand Down
113 changes: 83 additions & 30 deletions test/build_lan_overview_test.rb
Expand Up @@ -33,42 +33,95 @@
"WIRELESS_KEY_0" => ""
}
end
let(:lan_items) do
{
0 => { "hwinfo" => {
"name" => "Ethernet Card 0",
"type" => "eth",
"udi" => "",
"sysfs_id" => "/devices/pci0000:00/0000:00:03.0/virtio0",
"dev_name" => "eth0",
"requires" => [],
"modalias" => "virtio:d00000001v00001AF4",
"unique" => "vWuh.VIRhsc57kTD",
"driver" => "virtio_net",
"num" => 0,
"active" => true,
"module" => "virtio_net",
"bus" => "Virtio",
"busid" => "virtio0",
"mac" => "02:00:00:12:34:56",
"link" => true
},
"udev" => {
"net" => ["SUBSYSTEM==\"net\"", "ACTION==\"add\"", "DRIVERS==\"virtio-pci\"",
"ATTR{dev_id}==\"0x0\"", "KERNELS==\"0000:00:03.0\"",
"ATTR{type}==\"1\"", "KERNEL==\"eth*\"", "NAME=\"eth0\""],
"driver" => ""
},
"ifcfg" => "eth0" }
}
end
let(:lan_ifcfg) do
{ "STARTMODE" => "nfsroot",
"BOOTPROTO" => "dhcp",
"DHCLIENT_SET_DEFAULT_ROUTE" => "yes" }
end

# targeted mainly against bnc#906694
it "returns translated network device textual description for wlan device" do
allow(Yast::LanItems)
.to receive(:Items)
.and_return(wlan_items)
allow(Yast::LanItems)
.to receive(:GetDeviceMap)
.and_return(wlan_ifcfg)
allow(Yast::NetworkInterfaces)
.to receive(:Current)
.and_return(wlan_ifcfg)
allow(Yast::NetworkInterfaces)
.to receive(:GetType)
.and_call_original
allow(Yast::NetworkInterfaces)
.to receive(:GetType)
.with("wlan0")
.and_return("wlan")
allow(FastGettext)
.to receive(:locale)
.and_return("de")
context "with an wlan interface" do
before do
allow(Yast::LanItems)
.to receive(:Items)
.and_return(wlan_items)
allow(Yast::LanItems)
.to receive(:GetDeviceMap)
.and_return(wlan_ifcfg)
allow(Yast::NetworkInterfaces)
.to receive(:Current)
.and_return(wlan_ifcfg)
allow(Yast::NetworkInterfaces)
.to receive(:GetType)
.and_call_original
allow(Yast::NetworkInterfaces)
.to receive(:GetType)
.with("wlan0")
.and_return("wlan")
allow(FastGettext)
.to receive(:locale)
.and_return("de")
end
it "returns translated network device textual description for wlan device" do
# locale search path
stub_const("Yast::I18n::LOCALE_DIR", File.expand_path("../locale", __FILE__))

# locale search path
stub_const("Yast::I18n::LOCALE_DIR", File.expand_path("../locale", __FILE__))
textdomain("network")

textdomain("network")
# other checks depends on this
# - output of BuildLanOverview changes according number of devices
# even for "failing" (unknown devices) path
expect(Yast::LanItems.Items.size).to eql 1

# other checks depends on this
# - output of BuildLanOverview changes according number of devices
# even for "failing" (unknown devices) path
expect(Yast::LanItems.Items.size).to eql 1
overview = Yast::LanItems.BuildLanOverview
expect(overview).not_to eql unknown_device_overview
expect(overview).to eql german_translation_overview
end
end

overview = Yast::LanItems.BuildLanOverview
expect(overview).not_to eql unknown_device_overview
expect(overview).to eql german_translation_overview
context "with an lan interface" do
before do
allow(Yast::LanItems).to receive(:Items)
.and_return(lan_items)
allow(Yast::LanItems).to receive(:GetDeviceMap)
.and_return(lan_ifcfg)
allow(Yast::NetworkInterfaces).to receive(:Current)
.and_return(lan_ifcfg)
end
it "returns description for lan device with the correct start option" do
Yast::LanItems.BuildLanOverview
expect(Yast::LanItems.Items.size).to eql 1
expect(Yast::LanItems.Items[0]["table_descr"]["rich_descr"].include?("Started automatically at boot")).to eql(true)
end
end
end

Expand Down

0 comments on commit 859578f

Please sign in to comment.