]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-cookbooks.git/commitdiff
Tests out all the different ways to mount cephfs
authorWalter Huf <walter.huf@corvisa.com>
Wed, 9 Jul 2014 14:32:17 +0000 (09:32 -0500)
committerWalter Huf <walter.huf@corvisa.com>
Wed, 9 Jul 2014 14:56:13 +0000 (09:56 -0500)
.kitchen.yml
Berksfile
test/cookbooks/ceph_test/CHANGELOG.md [new file with mode: 0644]
test/cookbooks/ceph_test/README.md [new file with mode: 0644]
test/cookbooks/ceph_test/metadata.rb [new file with mode: 0644]
test/cookbooks/ceph_test/recipes/cephfs.rb [new file with mode: 0644]
test/integration/aio/bats/cephfs.bats [new file with mode: 0644]

index 41f8cf4f86485a7cd2214645f7b48966acde417b..ee21cc1681a61d50ac82f34e25d295a8b9f50d68 100644 (file)
@@ -61,3 +61,4 @@ suites:
         - { device: "/dev/sdd" }
   run_list:
     - recipe[ceph::all_in_one]
+    - recipe[ceph_test::cephfs]
index db8f00b47be99a424c3a5d6f3a1b35c098f85550..8b96da8afd7fdc19c964ea2711553953b227251b 100644 (file)
--- a/Berksfile
+++ b/Berksfile
@@ -4,4 +4,5 @@ metadata
 
 group :integration do
   cookbook 'apt'
+  cookbook 'ceph_test', path: 'test/cookbooks/ceph_test'
 end
diff --git a/test/cookbooks/ceph_test/CHANGELOG.md b/test/cookbooks/ceph_test/CHANGELOG.md
new file mode 100644 (file)
index 0000000..d6e3f13
--- /dev/null
@@ -0,0 +1,13 @@
+ceph_test CHANGELOG
+===================
+
+This file is used to list changes made in each version of the ceph_test cookbook.
+
+0.1.0
+-----
+- [your_name] - Initial release of ceph_test
+
+- - -
+Check the [Markdown Syntax Guide](http://daringfireball.net/projects/markdown/syntax) for help with Markdown.
+
+The [Github Flavored Markdown page](http://github.github.com/github-flavored-markdown/) describes the differences between markdown on github and standard markdown.
diff --git a/test/cookbooks/ceph_test/README.md b/test/cookbooks/ceph_test/README.md
new file mode 100644 (file)
index 0000000..7b9b0ba
--- /dev/null
@@ -0,0 +1,68 @@
+ceph_test Cookbook
+==================
+TODO: Enter the cookbook description here.
+
+e.g.
+This cookbook makes your favorite breakfast sandwich.
+
+Requirements
+------------
+TODO: List your cookbook requirements. Be sure to include any requirements this cookbook has on platforms, libraries, other cookbooks, packages, operating systems, etc.
+
+e.g.
+#### packages
+- `toaster` - ceph_test needs toaster to brown your bagel.
+
+Attributes
+----------
+TODO: List your cookbook attributes here.
+
+e.g.
+#### ceph_test::default
+<table>
+  <tr>
+    <th>Key</th>
+    <th>Type</th>
+    <th>Description</th>
+    <th>Default</th>
+  </tr>
+  <tr>
+    <td><tt>['ceph_test']['bacon']</tt></td>
+    <td>Boolean</td>
+    <td>whether to include bacon</td>
+    <td><tt>true</tt></td>
+  </tr>
+</table>
+
+Usage
+-----
+#### ceph_test::default
+TODO: Write usage instructions for each cookbook.
+
+e.g.
+Just include `ceph_test` in your node's `run_list`:
+
+```json
+{
+  "name":"my_node",
+  "run_list": [
+    "recipe[ceph_test]"
+  ]
+}
+```
+
+Contributing
+------------
+TODO: (optional) If this is a public cookbook, detail the process for contributing. If this is a private cookbook, remove this section.
+
+e.g.
+1. Fork the repository on Github
+2. Create a named feature branch (like `add_component_x`)
+3. Write your change
+4. Write tests for your change (if applicable)
+5. Run the tests, ensuring they all pass
+6. Submit a Pull Request using Github
+
+License and Authors
+-------------------
+Authors: TODO: List authors
diff --git a/test/cookbooks/ceph_test/metadata.rb b/test/cookbooks/ceph_test/metadata.rb
new file mode 100644 (file)
index 0000000..17f6f69
--- /dev/null
@@ -0,0 +1,8 @@
+name 'ceph_test'
+maintainer 'Kyle Bader'
+maintainer_email 'kyle.bader@dreamhost.com'
+license 'Apache 2.0'
+description 'Installs/Configures ceph_test'
+long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
+version '0.1.0'
+depends 'ceph'
diff --git a/test/cookbooks/ceph_test/recipes/cephfs.rb b/test/cookbooks/ceph_test/recipes/cephfs.rb
new file mode 100644 (file)
index 0000000..3ad328b
--- /dev/null
@@ -0,0 +1,53 @@
+#
+# Author:: Kyle Bader <kyle.bader@dreamhost.com>
+# Cookbook Name:: ceph_test
+# Recipe:: cephfs
+#
+# Copyright 2011, DreamHost Web Hosting
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+requires_fuse =
+  case node['platform']
+  when 'debian'
+    node['platform_version'].to_f < 7.0
+  when 'ubuntu'
+    node['platform_version'].to_f < 12.04
+  when 'redhat'
+    node['platform_version'].to_f < 7.0
+  when 'fedora'
+    node['platform_version'].to_f < 17.0
+  else
+    true
+end
+
+ceph_cephfs '/ceph' do
+  use_fuse requires_fuse
+  action [:mount, :enable]
+end
+ceph_cephfs '/ceph.fuse' do
+  use_fuse true
+  action [:mount]
+end
+directory '/ceph/subdir'
+file '/ceph/subdir/file' do
+  content "It works\n"
+end
+
+unless requires_fuse
+  ceph_cephfs '/subceph' do
+    use_fuse false
+    cephfs_subdir '/subdir'
+    action [:mount]
+  end
+end
diff --git a/test/integration/aio/bats/cephfs.bats b/test/integration/aio/bats/cephfs.bats
new file mode 100644 (file)
index 0000000..78d4f9d
--- /dev/null
@@ -0,0 +1,37 @@
+@test "/ceph is mounted" {
+  grep -q -E '^\S+\s+/ceph\s+' /proc/mounts
+}
+@test "/ceph.fuse is mounted" {
+  grep -q -E '^\S+\s+/ceph\.fuse\s+fuse' /proc/mounts
+}
+
+@test "/ceph is in fstab" {
+  grep -q -E '^\S+\s+/ceph\s+' /etc/fstab
+}
+@test "/ceph.fuse is NOT in fstab" {
+  grep -v -q -E '^\S+\s+/ceph.fuse\s+' /etc/fstab
+}
+
+@test "test file exists in /ceph" {
+  test -e /ceph/subdir/file
+  grep -q 'It works' /ceph/subdir/file
+}
+@test "test file exists in /ceph.fuse" {
+  test -e /ceph.fuse/subdir/file
+  grep -q 'It works' /ceph.fuse/subdir/file
+}
+
+# if we are using kernel cephfs
+if grep -q -E '^\S+\s+/ceph\s+ceph' /proc/mounts; then
+  @test "/subceph is mounted" {
+    grep -q -E '^\S+\s+/subceph\s+ceph' /proc/mounts
+  }
+  @test "/subceph is NOT in fstab" {
+    grep -v -q -E '^\S+\s+/subceph\s+' /etc/fstab
+  }
+  @test "test file exists in /subceph" {
+    test -e /subceph/file
+    grep -q 'It works' /subceph/file
+  }
+fi
+