From 489e31241678ec127285a5a0d05486108fb86037 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 15 Oct 2024 10:11:45 +0900 Subject: [PATCH] Add acceptance tests ... to check a few more details of the deployment result. The existing spec file is removed because it can't be run by litmus. Change-Id: Ic4ffbebbf3c1d7ed82088703bce2681cb218de91 --- .zuul.yaml | 1 + spec/acceptance/10_basic_ceph_spec.rb | 76 +++++++++++++++++++++++++++ spec/acceptance/ceph_mon_osd_spec.rb | 75 -------------------------- 3 files changed, 77 insertions(+), 75 deletions(-) create mode 100644 spec/acceptance/10_basic_ceph_spec.rb delete mode 100644 spec/acceptance/ceph_mon_osd_spec.rb diff --git a/.zuul.yaml b/.zuul.yaml index 04692c1d..5af34f3e 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -4,4 +4,5 @@ - puppet-openstack-module-unit-jobs - puppet-openstack-integration-jobs-scenario001 - puppet-openstack-integration-jobs-scenario004 + - puppet-openstack-litmus-jobs - release-notes-jobs-python3 diff --git a/spec/acceptance/10_basic_ceph_spec.rb b/spec/acceptance/10_basic_ceph_spec.rb new file mode 100644 index 00000000..0b0beee7 --- /dev/null +++ b/spec/acceptance/10_basic_ceph_spec.rb @@ -0,0 +1,76 @@ +# 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. +# +require 'spec_helper_acceptance' + +describe 'basic ceph' do + + context 'default parameters' do + + it 'should work with no errors' do + pp = <<-EOS + include openstack_integration + include openstack_integration::apache + include openstack_integration::mysql + include openstack_integration::memcached + include openstack_integration::keystone + class { 'openstack_integration::ceph': + deploy_rgw => true, + create_cephfs => true, + } + include openstack_integration::repos + EOS + + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + it 'should deploy mon' do + command('ceph -s') do |r| + expect(r.exit_code).to eq 0 + expect(r.stdout).to match(/mon: 1 daemons/) + expect(r.stderr).to be_empty + end + end + + it 'should deploy osd' do + command('ceph osd tree') do |r| + expect(r.exit_code).to eq 0 + expect(r.stdout).to match(/\s+osd.0\s+up\s+/) + expect(r.stderr).to be_empty + end + end + + it 'should create pools' do + command('ceph osd pool ls') do |r| + expect(r.exit_code).to eq 0 + expect(r.stdout).to match(/^nova$/) + expect(r.stdout).to match(/^glance$/) + expect(r.stdout).to match(/^cephfs_data$/) + expect(r.stdout).to match(/^cephfs_metadata$/) + expect(r.stderr).to be_empty + end + end + + it 'should create fs' do + command('ceph fs ls') do |r| + expect(r.exit_code).to eq 0 + expect(r.stdout).to match(/^cephfs$/) + expect(r.stderr).to be_empty + end + end + + describe port(8080) do + it { is_expected.to be_listening } + end + end +end diff --git a/spec/acceptance/ceph_mon_osd_spec.rb b/spec/acceptance/ceph_mon_osd_spec.rb deleted file mode 100644 index a44bfa3a..00000000 --- a/spec/acceptance/ceph_mon_osd_spec.rb +++ /dev/null @@ -1,75 +0,0 @@ -# -# Copyright (C) 2015 David Gurtner -# -# Author: David Gurtner -# -# 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. -# -require 'spec_helper_acceptance' - -describe 'ceph mon osd' do - - context 'default parameters' do - - it 'should install one monitor and one OSD on /srv/data' do - pp = <<-EOS - class { 'ceph::repo': - enable_sig => true, - enable_epel => false, - ceph_mirror => $ceph_mirror, - } - class { 'ceph': - fsid => '82274746-9a2c-426b-8c51-107fb0d890c6', - mon_host => $::ipaddress, - authentication_type => 'none', - osd_pool_default_size => '1', - osd_pool_default_min_size => '1', - osd_max_object_namespace_len => '64', - osd_max_object_name_len => '256', - } - ceph_config { - 'global/osd_journal_size': value => '100'; - } - ceph::mgr { 'a': - authentication_type => 'none', - } - ceph::mon { 'a': - public_addr => $::ipaddress, - authentication_type => 'none', - } - ceph::osd { '/srv/data': } - EOS - - apply_manifest(pp, :catch_failures => true) - apply_manifest(pp, :catch_changes => true) - - if os[:family].casecmp('RedHat') == 0 - describe command('sleep 10') do - its(:exit_status) { should eq 0 } - end - - describe command('ceph -s') do - its(:exit_status) { should eq 0 } - its(:stdout) { should match /mon: 1 daemons/) } - its(:stderr) { should be_empty } - end - - describe command('ceph osd tree | grep osd.0') do - its(:exit_status) { should eq 0 } - its(:stdout) { should match /up/ } - its(:stderr) { should be_empty } - end - end - end - -end