Skip to content

Commit

Permalink
Merge pull request #508 from yast/fstab_agent_test
Browse files Browse the repository at this point in the history
Fstab agent test
  • Loading branch information
jreidinger committed Nov 7, 2016
2 parents 2d71de8 + f8ea1ed commit a7a38af
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
34 changes: 34 additions & 0 deletions library/general/test/agents_test/fstab_agent_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env rspec

require_relative "../test_helper"
require "yast"

describe ".proc.meminfo" do
around :each do |example|
root = File.join(File.dirname(__FILE__), "test_root")
change_scr_root(root, &example)
end

describe ".Read" do
let(:content) { Yast::SCR.Read(path(".etc.fstab")) }

it "reads content of /etc/fstab and returns array" do
expect(content).to be_a(Array)
end

it "returns an array containing nfs entries" do
expect(content).to satisfy { |r| r.find { |e| e["file"] == "/home/kv2" } }
expect(content).to satisfy { |r| r.find { |e| e["file"] == "/media/new" } }
expect(content).to satisfy { |r| r.find { |e| e["file"] == "/media/new2" } }
end

it "returns an array containing tmpfs entry" do
expect(content).to satisfy { |r| r.find { |e| e["file"] == "/tmp" } }
end

it "is able to parse comments" do
pending "need to be fixed"
expect(content).to include("#comment")
end
end
end
7 changes: 7 additions & 0 deletions library/general/test/agents_test/test_root/etc/fstab
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
UUID=b66c1028-cd4a-4c08-b92d-fc4b9840845d / ext4 noatime,data=writeback,acl,user_xattr 1 1
UUID=d2811ace-66e0-4ef2-9b68-9b2758359391 /home ext4 noatime,data=writeback,acl 1 2
192.168.1.2:/home/kv /home/kv2 nfs defaults 0 0
192.168.1.2:/media/new2 /media/new2 nfs defaults 0 0
192.168.1.2:/media/new /media/new nfs defaults 0 0
# my fine comment
tmpfs /tmp tmpfs defaults,size=25% 0 0

0 comments on commit a7a38af

Please sign in to comment.