From: Walter Huf Date: Wed, 9 Jul 2014 14:32:17 +0000 (-0500) Subject: Tests out all the different ways to mount cephfs X-Git-Tag: v0.8.0~27^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4412f63595c969c25e26a5754fa8877344267c3d;p=ceph-cookbooks.git Tests out all the different ways to mount cephfs --- diff --git a/.kitchen.yml b/.kitchen.yml index 41f8cf4..ee21cc1 100644 --- a/.kitchen.yml +++ b/.kitchen.yml @@ -61,3 +61,4 @@ suites: - { device: "/dev/sdd" } run_list: - recipe[ceph::all_in_one] + - recipe[ceph_test::cephfs] diff --git a/Berksfile b/Berksfile index db8f00b..8b96da8 100644 --- 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 index 0000000..d6e3f13 --- /dev/null +++ b/test/cookbooks/ceph_test/CHANGELOG.md @@ -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 index 0000000..7b9b0ba --- /dev/null +++ b/test/cookbooks/ceph_test/README.md @@ -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 + + + + + + + + + + + + + +
KeyTypeDescriptionDefault
['ceph_test']['bacon']Booleanwhether to include bacontrue
+ +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 index 0000000..17f6f69 --- /dev/null +++ b/test/cookbooks/ceph_test/metadata.rb @@ -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 index 0000000..3ad328b --- /dev/null +++ b/test/cookbooks/ceph_test/recipes/cephfs.rb @@ -0,0 +1,53 @@ +# +# Author:: Kyle Bader +# 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 index 0000000..78d4f9d --- /dev/null +++ b/test/integration/aio/bats/cephfs.bats @@ -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 +