Skip to content

Commit

Permalink
Minor fixes to old getHostid test
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jan 26, 2016
1 parent 225ef0a commit 35c737f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/AutoInstallRules_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,15 @@
end
end

describe "#Host ID" do
let(:wicked_output_path) { File.join(root_path, 'test', 'fixtures', 'network', 'wicked_output') }
describe "#getHostid" do
let(:wicked_output_path) do
File.join(root_path, "test", "fixtures", "network", "wicked_partial.out")
end

it "returns host IP in hex format (initial Stage)" do
expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src").and_return({"stdout"=>File.read(wicked_output_path), "exit"=>0})
expect(Yast::SCR).to receive(:Execute).
with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src").
and_return("stdout" => File.read(wicked_output_path), "exit" => 0)
expect(Yast::Stage).to receive(:initial).and_return(true)

expect(subject.getHostid).to eq("C0A864DA")
Expand All @@ -129,7 +134,9 @@

it "returns nil if wicked does not find IP address" do
expect(Yast::Stage).to receive(:initial).and_return(true)
expect(Yast::SCR).to receive(:Execute).with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src").and_return({"stderr"=>"error from wicked", "exit"=>1})
expect(Yast::SCR).to receive(:Execute).
with(Yast::Path.new(".target.bash_output"), "/usr/sbin/wicked show --verbose all|grep pref-src").
and_return("stderr" => "error from wicked", "exit" => 1)

expect(subject.getHostid).to eq(nil)
end
Expand Down
File renamed without changes.

0 comments on commit 35c737f

Please sign in to comment.