Skip to content

Commit

Permalink
add fstab agent test
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 7, 2016
1 parent 2d71de8 commit 85fddad
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
29 changes: 29 additions & 0 deletions library/general/test/agents_test/fstab_agent_test.rb
@@ -0,0 +1,29 @@
#!/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 "returned array contains 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 "returned array contains tmpfs entry" do
expect(content).to satisfy { |r| r.find { |e| e["file"] == "/tmp" } }
end
end
end
6 changes: 6 additions & 0 deletions library/general/test/agents_test/test_root/etc/fstab
@@ -0,0 +1,6 @@
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
tmpfs /tmp tmpfs defaults,size=25% 0 0

0 comments on commit 85fddad

Please sign in to comment.