Skip to content

Commit

Permalink
Remove duplicate entry from .gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed May 20, 2020
1 parent 488267d commit 649cf79
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
1 change: 0 additions & 1 deletion .gitignore
Expand Up @@ -32,5 +32,4 @@ testsuite/run/
.yardoc
/coverage
*.pot
config.*
/test/data/scr_read/var/log
6 changes: 4 additions & 2 deletions src/lib/y2network/sysconfig/interfaces_writer.rb
Expand Up @@ -23,8 +23,6 @@
require "y2network/sysconfig/interface_file"
require "y2network/sysconfig/routes_file"

Yast.import "Mode"

module Y2Network
module Sysconfig
# This class writes interfaces specific configuration
Expand All @@ -33,6 +31,7 @@ module Sysconfig
# hardware specific configuration through udev rules.
#
# @see Y2Network::InterfacesCollection
# @param reload [Boolean] whether the udev rules should be reloaded or not
class InterfacesWriter
def initialize(reload: true)
@reload = reload
Expand All @@ -48,6 +47,9 @@ def write(interfaces)

private

# Whether the udev rules should be reloaded or not
#
# @return [Boolean] true if needs to be reloaded after written
def reload?
@reload
end
Expand Down
18 changes: 11 additions & 7 deletions test/y2network/sysconfig/interfaces_writer_test.rb
Expand Up @@ -70,19 +70,23 @@
eth0.rename("eth1", renaming_mechanism)
end

it "sets the interface down" do
expect(Yast::Execute).to receive(:on_target).with("/sbin/ifdown", "eth0")
subject.write(interfaces)
context "and the reload is forced" do
it "sets the interface down" do
expect(Yast::Execute).to receive(:on_target).with("/sbin/ifdown", "eth0")
subject.write(interfaces)
end
end

context "during autoinstallation" do
context "and the reload is not forced (ie: autoinstallation)" do
before do
allow(Yast::Mode).to receive(:autoinst).and_return(true)
end

it "does not set the interface down" do
expect(Yast::Execute).to_not receive(:on_target).with("/sbin/ifdown", any_args)
subject.write(interfaces)
context "if not forced the reload" do
it "does not set the interface down" do
expect(Yast::Execute).to receive(:on_target).with("/sbin/ifdown", any_args)
subject.write(interfaces)
end
end
end

Expand Down

0 comments on commit 649cf79

Please sign in to comment.