diff --git a/test/integration/mysql/bats/cron.bats b/test/integration/mysql/bats/cron.bats deleted file mode 100644 index d993eda..0000000 --- a/test/integration/mysql/bats/cron.bats +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bats - -@test "owncloud cron should be enabled" { - if id www-data >/dev/null 2>&1 - then - APACHE_USER='www-data' - else - APACHE_USER='apache' - fi - crontab -l -u "${APACHE_USER}" | grep -q "php -f '.*/owncloud/cron.php'" -} diff --git a/test/integration/mysql/bats/default.bats b/test/integration/mysql/bats/default.bats deleted file mode 100644 index 26162a4..0000000 --- a/test/integration/mysql/bats/default.bats +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bats - -@test "database should be created" { - echo "show databases" | mysql -uroot -h 127.0.0.1 -pvagrant_root | grep -q "^owncloud$" -} - -@test "owncloud should be installed" { - wget -qO- 'localhost/status.php' | grep -qE '"installed":"?true"?' -} - -@test "ssl should be enabled" { - wget --no-check-certificate -qO- 'https://localhost' -} - -@test "admin user should be created" { - wget -qO- 'http://test:test@localhost/ocs/v1.php/privatedata/getattribute' | grep -qF 'ok' -} diff --git a/test/integration/mysql/bats/mail.bats b/test/integration/mysql/bats/mail.bats deleted file mode 100644 index 14d75c0..0000000 --- a/test/integration/mysql/bats/mail.bats +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bats - -@test "owncloud should be able to send emails" { - wget -qO/dev/null 'http://localhost/emailtest.php' - sleep 1 - if [ -f '/var/spool/mail/root' ] - then - MAIL_FILE='/var/spool/mail/root' - else - MAIL_FILE='/var/spool/mail/vagrant' - fi - grep -qF 'kitchen-test@' "${MAIL_FILE}" -} diff --git a/test/integration/mysql/serverspec/Gemfile b/test/integration/mysql/serverspec/Gemfile new file mode 100644 index 0000000..17e9432 --- /dev/null +++ b/test/integration/mysql/serverspec/Gemfile @@ -0,0 +1,9 @@ +# encoding: UTF-8 +# -*- mode: ruby -*- +# vi: set ft=ruby : + +source 'https://rubygems.org' + +gem 'serverspec', '~> 2.0' +gem 'infrataster', '~> 0.3.0' +gem 'infrataster-plugin-mysql', '~> 0.2.0' diff --git a/test/integration/mysql/serverspec/apache_spec.rb b/test/integration/mysql/serverspec/apache_spec.rb new file mode 100644 index 0000000..b509688 --- /dev/null +++ b/test/integration/mysql/serverspec/apache_spec.rb @@ -0,0 +1,58 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase +apache = + if %w(centos redhat fedora scientific amazon).include?(family) + 'httpd' + else + 'apache2' + end + +describe 'apache' do + describe package(apache) do + it { should be_installed } + end + + describe port(80) do + it { should be_listening } + end + + describe port(443) do + it { should be_listening } + end + + describe process(apache) do + it { should be_running } + end + + describe process('nginx') do + it { should_not be_running } + end + + describe server(:web) do + describe http('/') do + it 'runs Apache httpd' do + expect(response['Server']).to include 'Apache' + end + end # http /login.php + end # server web +end # apache diff --git a/test/integration/mysql/serverspec/cron_spec.rb b/test/integration/mysql/serverspec/cron_spec.rb new file mode 100644 index 0000000..ffc424f --- /dev/null +++ b/test/integration/mysql/serverspec/cron_spec.rb @@ -0,0 +1,44 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase + +web_user = + case family + when 'debian', 'ubuntu' + 'www-data' + when 'redhat', 'centos', 'fedora', 'scientific', 'amazon' + 'apache' + when 'suse', 'opensuse' + 'wwwrun' + when 'arch' + 'http' + when 'freebsd' + 'www' + else + 'www-data' + end + +describe 'owncloud cron' do + describe command("crontab -l -u #{web_user}") do + its(:stdout) { should match %r{php -f '.*/owncloud/cron.php'} } + end +end # owncloud cron diff --git a/test/integration/mysql/serverspec/mail_spec.rb b/test/integration/mysql/serverspec/mail_spec.rb new file mode 100644 index 0000000..d67e5df --- /dev/null +++ b/test/integration/mysql/serverspec/mail_spec.rb @@ -0,0 +1,41 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +describe 'owncloud email test' do + describe server(:web) do + describe http('http://127.0.0.1/emailtest.php') do + it 'returns OK status' do + expect(response.status).to eq 200 + end + + it 'sends an email' do + sleep(1) + spool_file = + if ::File.exist?('/var/spool/mail/root') + '/var/spool/mail/root' + else + '/var/spool/mail/vagrant' + end + expect(file(spool_file).content).to contain('kitchen-test@') + end + end # http /emailtest.php + end # server web +end # owncloud diff --git a/test/integration/mysql/serverspec/mysql_spec.rb b/test/integration/mysql/serverspec/mysql_spec.rb new file mode 100644 index 0000000..28e25c9 --- /dev/null +++ b/test/integration/mysql/serverspec/mysql_spec.rb @@ -0,0 +1,40 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'mysql' do + describe process('mysqld') do + it { should be_running } + end + + describe port(3306) do + it { should be_listening.with('tcp') } + end + + describe server(:db) do + describe mysql_query('SHOW DATABASES') do + it 'includes `ownloud` database' do + databases = results.map { |r| r['Database'] } + expect(databases).to include('owncloud') + end + end + end # server db +end # mysql diff --git a/test/integration/mysql/serverspec/owncloud_spec.rb b/test/integration/mysql/serverspec/owncloud_spec.rb new file mode 100644 index 0000000..fe0adf2 --- /dev/null +++ b/test/integration/mysql/serverspec/owncloud_spec.rb @@ -0,0 +1,68 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'owncloud' do + describe server(:web) do + describe http('http://127.0.0.1/') do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # http / + + describe http('http://127.0.0.1/status.php') do + let(:body_json) { JSON.parse(response.body) } + + it 'returns a JSON body' do + expect { body_json }.to_not raise_error + end + + it 'is installed' do + expect(body_json['installed']).to eq(true) + end + end # http /status.php + + describe http('https://127.0.0.1/', ssl: { verify: false }) do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # https / + + describe http('http://127.0.0.1/ocs/v1.php/privatedata/getattribute') do + it 'returns 401 status' do + expect(response.status).to eq 401 + end + + it 'returns unauthorised message' do + expect(response.body).to include('Unauthorised') + end + end # https /ocs/v1.php/privatedata/getattribute unauthorised + + describe http( + 'http://127.0.0.1/ocs/v1.php/privatedata/getattribute', + basic_auth: %w(test test) + ) do + it 'returns OK status' do + expect(response.body).to include('ok') + end + end # https /ocs/v1.php/privatedata/getattribute with basic auth + end # server web +end # owncloud diff --git a/test/integration/mysql/serverspec/spec_helper.rb b/test/integration/mysql/serverspec/spec_helper.rb new file mode 100644 index 0000000..bdb76ad --- /dev/null +++ b/test/integration/mysql/serverspec/spec_helper.rb @@ -0,0 +1,49 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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 'serverspec' +require 'infrataster/rspec' +require 'infrataster-plugin-mysql' + +# Set backend type +set :backend, :exec + +ENV['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' + +Infrataster::Server.define(:web, '127.0.0.1') + +Infrataster::Server.define( + :db, + '127.0.0.1', + mysql: { user: 'root', password: 'vagrant_root' } +) + +# Infrataster hack to ignore phantomjs SSL errors +Infrataster::Contexts::CapybaraContext.class_eval do + def self.prepare_session + driver = Infrataster::Contexts::CapybaraContext::CAPYBARA_DRIVER_NAME + Capybara.register_driver driver do |app| + Capybara::Poltergeist::Driver.new( + app, + phantomjs_options: %w(--ignore-ssl-errors=true) + ) + end + Capybara::Session.new(driver) + end +end diff --git a/test/integration/nginx/bats/default.bats b/test/integration/nginx/bats/default.bats deleted file mode 100644 index 0727f00..0000000 --- a/test/integration/nginx/bats/default.bats +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bats - -@test "nginx should be listening" { - wget --server-response --no-check-certificate -O- 'https://localhost' 2>&1 > /dev/null | grep -q '^\s*Server: nginx' -} - -@test "owncloud should be installed" { - wget -qO- 'localhost/status.php' | grep -qE '"installed":"?true"?' -} - -@test "ssl should be enabled" { - wget --no-check-certificate -qO- 'https://localhost' -} - -@test "admin user should be created" { - wget -qO- 'http://test:test@localhost/ocs/v1.php/privatedata/getattribute' | grep -qF 'ok' -} diff --git a/test/integration/nginx/serverspec/Gemfile b/test/integration/nginx/serverspec/Gemfile new file mode 100644 index 0000000..17e9432 --- /dev/null +++ b/test/integration/nginx/serverspec/Gemfile @@ -0,0 +1,9 @@ +# encoding: UTF-8 +# -*- mode: ruby -*- +# vi: set ft=ruby : + +source 'https://rubygems.org' + +gem 'serverspec', '~> 2.0' +gem 'infrataster', '~> 0.3.0' +gem 'infrataster-plugin-mysql', '~> 0.2.0' diff --git a/test/integration/nginx/serverspec/cron_spec.rb b/test/integration/nginx/serverspec/cron_spec.rb new file mode 100644 index 0000000..ffc424f --- /dev/null +++ b/test/integration/nginx/serverspec/cron_spec.rb @@ -0,0 +1,44 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase + +web_user = + case family + when 'debian', 'ubuntu' + 'www-data' + when 'redhat', 'centos', 'fedora', 'scientific', 'amazon' + 'apache' + when 'suse', 'opensuse' + 'wwwrun' + when 'arch' + 'http' + when 'freebsd' + 'www' + else + 'www-data' + end + +describe 'owncloud cron' do + describe command("crontab -l -u #{web_user}") do + its(:stdout) { should match %r{php -f '.*/owncloud/cron.php'} } + end +end # owncloud cron diff --git a/test/integration/nginx/serverspec/mail_spec.rb b/test/integration/nginx/serverspec/mail_spec.rb new file mode 100644 index 0000000..d67e5df --- /dev/null +++ b/test/integration/nginx/serverspec/mail_spec.rb @@ -0,0 +1,41 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +describe 'owncloud email test' do + describe server(:web) do + describe http('http://127.0.0.1/emailtest.php') do + it 'returns OK status' do + expect(response.status).to eq 200 + end + + it 'sends an email' do + sleep(1) + spool_file = + if ::File.exist?('/var/spool/mail/root') + '/var/spool/mail/root' + else + '/var/spool/mail/vagrant' + end + expect(file(spool_file).content).to contain('kitchen-test@') + end + end # http /emailtest.php + end # server web +end # owncloud diff --git a/test/integration/nginx/serverspec/mysql_spec.rb b/test/integration/nginx/serverspec/mysql_spec.rb new file mode 100644 index 0000000..28e25c9 --- /dev/null +++ b/test/integration/nginx/serverspec/mysql_spec.rb @@ -0,0 +1,40 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'mysql' do + describe process('mysqld') do + it { should be_running } + end + + describe port(3306) do + it { should be_listening.with('tcp') } + end + + describe server(:db) do + describe mysql_query('SHOW DATABASES') do + it 'includes `ownloud` database' do + databases = results.map { |r| r['Database'] } + expect(databases).to include('owncloud') + end + end + end # server db +end # mysql diff --git a/test/integration/nginx/serverspec/nginx_spec.rb b/test/integration/nginx/serverspec/nginx_spec.rb new file mode 100644 index 0000000..2ea3535 --- /dev/null +++ b/test/integration/nginx/serverspec/nginx_spec.rb @@ -0,0 +1,54 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +describe 'nginx' do + describe package('nginx') do + it { should be_installed } + end + + describe port(80) do + it { should be_listening } + end + + describe port(443) do + it { should be_listening } + end + + describe process('nginx') do + it { should be_running } + end + + describe process('apache') do + it { should_not be_running } + end + + describe process('httpd') do + it { should_not be_running } + end + + describe server(:web) do + describe http('/') do + it 'runs Apache httpd' do + expect(response['Server']).to include 'nginx' + end + end # http /login.php + end # server web +end # apache diff --git a/test/integration/nginx/serverspec/owncloud_spec.rb b/test/integration/nginx/serverspec/owncloud_spec.rb new file mode 100644 index 0000000..fe0adf2 --- /dev/null +++ b/test/integration/nginx/serverspec/owncloud_spec.rb @@ -0,0 +1,68 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'owncloud' do + describe server(:web) do + describe http('http://127.0.0.1/') do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # http / + + describe http('http://127.0.0.1/status.php') do + let(:body_json) { JSON.parse(response.body) } + + it 'returns a JSON body' do + expect { body_json }.to_not raise_error + end + + it 'is installed' do + expect(body_json['installed']).to eq(true) + end + end # http /status.php + + describe http('https://127.0.0.1/', ssl: { verify: false }) do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # https / + + describe http('http://127.0.0.1/ocs/v1.php/privatedata/getattribute') do + it 'returns 401 status' do + expect(response.status).to eq 401 + end + + it 'returns unauthorised message' do + expect(response.body).to include('Unauthorised') + end + end # https /ocs/v1.php/privatedata/getattribute unauthorised + + describe http( + 'http://127.0.0.1/ocs/v1.php/privatedata/getattribute', + basic_auth: %w(test test) + ) do + it 'returns OK status' do + expect(response.body).to include('ok') + end + end # https /ocs/v1.php/privatedata/getattribute with basic auth + end # server web +end # owncloud diff --git a/test/integration/nginx/serverspec/spec_helper.rb b/test/integration/nginx/serverspec/spec_helper.rb new file mode 100644 index 0000000..bdb76ad --- /dev/null +++ b/test/integration/nginx/serverspec/spec_helper.rb @@ -0,0 +1,49 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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 'serverspec' +require 'infrataster/rspec' +require 'infrataster-plugin-mysql' + +# Set backend type +set :backend, :exec + +ENV['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' + +Infrataster::Server.define(:web, '127.0.0.1') + +Infrataster::Server.define( + :db, + '127.0.0.1', + mysql: { user: 'root', password: 'vagrant_root' } +) + +# Infrataster hack to ignore phantomjs SSL errors +Infrataster::Contexts::CapybaraContext.class_eval do + def self.prepare_session + driver = Infrataster::Contexts::CapybaraContext::CAPYBARA_DRIVER_NAME + Capybara.register_driver driver do |app| + Capybara::Poltergeist::Driver.new( + app, + phantomjs_options: %w(--ignore-ssl-errors=true) + ) + end + Capybara::Session.new(driver) + end +end diff --git a/test/integration/postgresql/bats/cron.bats b/test/integration/postgresql/bats/cron.bats deleted file mode 100644 index d993eda..0000000 --- a/test/integration/postgresql/bats/cron.bats +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bats - -@test "owncloud cron should be enabled" { - if id www-data >/dev/null 2>&1 - then - APACHE_USER='www-data' - else - APACHE_USER='apache' - fi - crontab -l -u "${APACHE_USER}" | grep -q "php -f '.*/owncloud/cron.php'" -} diff --git a/test/integration/postgresql/bats/default.bats b/test/integration/postgresql/bats/default.bats deleted file mode 100644 index 952c2c0..0000000 --- a/test/integration/postgresql/bats/default.bats +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bats - -@test "database should be created" { - su -c "psql -qlt" postgres | cut -d\| -f1 | grep -q '^ *owncloud *$' -} - -@test "owncloud should be installed" { - wget -qO- 'localhost/status.php' | grep -qE '"installed":"?true"?' -} - -@test "ssl should be enabled" { - wget --no-check-certificate -qO- 'https://localhost' -} - -@test "admin user should be created" { - wget -qO- 'http://test:test@localhost/ocs/v1.php/privatedata/getattribute' | grep -qF 'ok' -} diff --git a/test/integration/postgresql/bats/mail.bats b/test/integration/postgresql/bats/mail.bats deleted file mode 100644 index 14d75c0..0000000 --- a/test/integration/postgresql/bats/mail.bats +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bats - -@test "owncloud should be able to send emails" { - wget -qO/dev/null 'http://localhost/emailtest.php' - sleep 1 - if [ -f '/var/spool/mail/root' ] - then - MAIL_FILE='/var/spool/mail/root' - else - MAIL_FILE='/var/spool/mail/vagrant' - fi - grep -qF 'kitchen-test@' "${MAIL_FILE}" -} diff --git a/test/integration/postgresql/serverspec/Gemfile b/test/integration/postgresql/serverspec/Gemfile new file mode 100644 index 0000000..5be5304 --- /dev/null +++ b/test/integration/postgresql/serverspec/Gemfile @@ -0,0 +1,9 @@ +# encoding: UTF-8 +# -*- mode: ruby -*- +# vi: set ft=ruby : + +source 'https://rubygems.org' + +gem 'serverspec', '~> 2.0' +gem 'infrataster', '~> 0.2.0' +gem 'infrataster-plugin-pgsql', '~> 0.1.0' diff --git a/test/integration/postgresql/serverspec/apache_spec.rb b/test/integration/postgresql/serverspec/apache_spec.rb new file mode 100644 index 0000000..b509688 --- /dev/null +++ b/test/integration/postgresql/serverspec/apache_spec.rb @@ -0,0 +1,58 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase +apache = + if %w(centos redhat fedora scientific amazon).include?(family) + 'httpd' + else + 'apache2' + end + +describe 'apache' do + describe package(apache) do + it { should be_installed } + end + + describe port(80) do + it { should be_listening } + end + + describe port(443) do + it { should be_listening } + end + + describe process(apache) do + it { should be_running } + end + + describe process('nginx') do + it { should_not be_running } + end + + describe server(:web) do + describe http('/') do + it 'runs Apache httpd' do + expect(response['Server']).to include 'Apache' + end + end # http /login.php + end # server web +end # apache diff --git a/test/integration/postgresql/serverspec/cron_spec.rb b/test/integration/postgresql/serverspec/cron_spec.rb new file mode 100644 index 0000000..ffc424f --- /dev/null +++ b/test/integration/postgresql/serverspec/cron_spec.rb @@ -0,0 +1,44 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase + +web_user = + case family + when 'debian', 'ubuntu' + 'www-data' + when 'redhat', 'centos', 'fedora', 'scientific', 'amazon' + 'apache' + when 'suse', 'opensuse' + 'wwwrun' + when 'arch' + 'http' + when 'freebsd' + 'www' + else + 'www-data' + end + +describe 'owncloud cron' do + describe command("crontab -l -u #{web_user}") do + its(:stdout) { should match %r{php -f '.*/owncloud/cron.php'} } + end +end # owncloud cron diff --git a/test/integration/postgresql/serverspec/mail_spec.rb b/test/integration/postgresql/serverspec/mail_spec.rb new file mode 100644 index 0000000..d67e5df --- /dev/null +++ b/test/integration/postgresql/serverspec/mail_spec.rb @@ -0,0 +1,41 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +describe 'owncloud email test' do + describe server(:web) do + describe http('http://127.0.0.1/emailtest.php') do + it 'returns OK status' do + expect(response.status).to eq 200 + end + + it 'sends an email' do + sleep(1) + spool_file = + if ::File.exist?('/var/spool/mail/root') + '/var/spool/mail/root' + else + '/var/spool/mail/vagrant' + end + expect(file(spool_file).content).to contain('kitchen-test@') + end + end # http /emailtest.php + end # server web +end # owncloud diff --git a/test/integration/postgresql/serverspec/owncloud_spec.rb b/test/integration/postgresql/serverspec/owncloud_spec.rb new file mode 100644 index 0000000..fe0adf2 --- /dev/null +++ b/test/integration/postgresql/serverspec/owncloud_spec.rb @@ -0,0 +1,68 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'owncloud' do + describe server(:web) do + describe http('http://127.0.0.1/') do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # http / + + describe http('http://127.0.0.1/status.php') do + let(:body_json) { JSON.parse(response.body) } + + it 'returns a JSON body' do + expect { body_json }.to_not raise_error + end + + it 'is installed' do + expect(body_json['installed']).to eq(true) + end + end # http /status.php + + describe http('https://127.0.0.1/', ssl: { verify: false }) do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # https / + + describe http('http://127.0.0.1/ocs/v1.php/privatedata/getattribute') do + it 'returns 401 status' do + expect(response.status).to eq 401 + end + + it 'returns unauthorised message' do + expect(response.body).to include('Unauthorised') + end + end # https /ocs/v1.php/privatedata/getattribute unauthorised + + describe http( + 'http://127.0.0.1/ocs/v1.php/privatedata/getattribute', + basic_auth: %w(test test) + ) do + it 'returns OK status' do + expect(response.body).to include('ok') + end + end # https /ocs/v1.php/privatedata/getattribute with basic auth + end # server web +end # owncloud diff --git a/test/integration/postgresql/serverspec/postgresql_spec.rb b/test/integration/postgresql/serverspec/postgresql_spec.rb new file mode 100644 index 0000000..ab101d1 --- /dev/null +++ b/test/integration/postgresql/serverspec/postgresql_spec.rb @@ -0,0 +1,73 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +def centos? + File.exist?('/etc/centos-release') +end + +family = os[:family].downcase +release = os[:release].to_i + +postgres = + if %w(centos redhat scientific amazon).include?(family) + if centos? && release >= 7 + 'postgres' + else + 'postmaster' + end + else + 'postgres' + end + +describe 'postgresql' do + describe process(postgres) do + it { should be_running } + end + + describe port(5432) do + it { should be_listening.with('tcp') } + end + + describe server(:db) do + describe pgsql_query('SELECT * from pg_stat_activity') do + it 'allows connection' do + connection.status.should == PG::CONNECTION_OK + end + + it 'shows database name' do + row = result.find { |r| r['usename'] == 'postgres' } + expect(row['datname']).to be == 'postgres' + end + end + + describe pgsql_query('SELECT datname from pg_database') do + it 'allows connection' do + connection.status.should == PG::CONNECTION_OK + end + + it 'includes `owncloud` database' do + databases = result.map { |r| r['datname'] } + expect(databases).to include('owncloud') + end + end + end # server db +end # postgresql diff --git a/test/integration/postgresql/serverspec/spec_helper.rb b/test/integration/postgresql/serverspec/spec_helper.rb new file mode 100644 index 0000000..98fb9a1 --- /dev/null +++ b/test/integration/postgresql/serverspec/spec_helper.rb @@ -0,0 +1,49 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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 'serverspec' +require 'infrataster/rspec' +require 'infrataster-plugin-pgsql' + +# Set backend type +set :backend, :exec + +ENV['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' + +Infrataster::Server.define(:web, '127.0.0.1') + +Infrataster::Server.define( + :db, + '127.0.0.1', + pgsql: { user: 'postgres', password: 'vagrant_postgres' } +) + +# Infrataster hack to ignore phantomjs SSL errors +Infrataster::Contexts::CapybaraContext.class_eval do + def self.prepare_session + driver = Infrataster::Contexts::CapybaraContext::CAPYBARA_DRIVER_NAME + Capybara.register_driver driver do |app| + Capybara::Poltergeist::Driver.new( + app, + phantomjs_options: %w(--ignore-ssl-errors=true) + ) + end + Capybara::Session.new(driver) + end +end diff --git a/test/integration/sqlite/bats/cron.bats b/test/integration/sqlite/bats/cron.bats deleted file mode 100644 index d993eda..0000000 --- a/test/integration/sqlite/bats/cron.bats +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bats - -@test "owncloud cron should be enabled" { - if id www-data >/dev/null 2>&1 - then - APACHE_USER='www-data' - else - APACHE_USER='apache' - fi - crontab -l -u "${APACHE_USER}" | grep -q "php -f '.*/owncloud/cron.php'" -} diff --git a/test/integration/sqlite/bats/default.bats b/test/integration/sqlite/bats/default.bats deleted file mode 100644 index 0f7bf5f..0000000 --- a/test/integration/sqlite/bats/default.bats +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/env bats - -@test "database should be created" { - test -e /var/www/owncloud/data/owncloud.db || \ - test -e /var/www/html/owncloud/data/owncloud.db -} - -@test "owncloud should be installed" { - wget -qO- 'localhost/status.php' | grep -qE '"installed":"?true"?' -} - -@test "ssl should be enabled" { - wget --no-check-certificate -qO- 'https://localhost' -} - -@test "admin user should be created" { - wget -qO- 'http://test:test@localhost/ocs/v1.php/privatedata/getattribute' | grep -qF 'ok' -} diff --git a/test/integration/sqlite/bats/mail.bats b/test/integration/sqlite/bats/mail.bats deleted file mode 100644 index 14d75c0..0000000 --- a/test/integration/sqlite/bats/mail.bats +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bats - -@test "owncloud should be able to send emails" { - wget -qO/dev/null 'http://localhost/emailtest.php' - sleep 1 - if [ -f '/var/spool/mail/root' ] - then - MAIL_FILE='/var/spool/mail/root' - else - MAIL_FILE='/var/spool/mail/vagrant' - fi - grep -qF 'kitchen-test@' "${MAIL_FILE}" -} diff --git a/test/integration/sqlite/serverspec/Gemfile b/test/integration/sqlite/serverspec/Gemfile new file mode 100644 index 0000000..8db22b4 --- /dev/null +++ b/test/integration/sqlite/serverspec/Gemfile @@ -0,0 +1,8 @@ +# encoding: UTF-8 +# -*- mode: ruby -*- +# vi: set ft=ruby : + +source 'https://rubygems.org' + +gem 'serverspec', '~> 2.0' +gem 'infrataster', '~> 0.3.0' diff --git a/test/integration/sqlite/serverspec/apache_spec.rb b/test/integration/sqlite/serverspec/apache_spec.rb new file mode 100644 index 0000000..b509688 --- /dev/null +++ b/test/integration/sqlite/serverspec/apache_spec.rb @@ -0,0 +1,58 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase +apache = + if %w(centos redhat fedora scientific amazon).include?(family) + 'httpd' + else + 'apache2' + end + +describe 'apache' do + describe package(apache) do + it { should be_installed } + end + + describe port(80) do + it { should be_listening } + end + + describe port(443) do + it { should be_listening } + end + + describe process(apache) do + it { should be_running } + end + + describe process('nginx') do + it { should_not be_running } + end + + describe server(:web) do + describe http('/') do + it 'runs Apache httpd' do + expect(response['Server']).to include 'Apache' + end + end # http /login.php + end # server web +end # apache diff --git a/test/integration/sqlite/serverspec/cron_spec.rb b/test/integration/sqlite/serverspec/cron_spec.rb new file mode 100644 index 0000000..ffc424f --- /dev/null +++ b/test/integration/sqlite/serverspec/cron_spec.rb @@ -0,0 +1,44 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +family = os[:family].downcase + +web_user = + case family + when 'debian', 'ubuntu' + 'www-data' + when 'redhat', 'centos', 'fedora', 'scientific', 'amazon' + 'apache' + when 'suse', 'opensuse' + 'wwwrun' + when 'arch' + 'http' + when 'freebsd' + 'www' + else + 'www-data' + end + +describe 'owncloud cron' do + describe command("crontab -l -u #{web_user}") do + its(:stdout) { should match %r{php -f '.*/owncloud/cron.php'} } + end +end # owncloud cron diff --git a/test/integration/sqlite/serverspec/mail_spec.rb b/test/integration/sqlite/serverspec/mail_spec.rb new file mode 100644 index 0000000..d67e5df --- /dev/null +++ b/test/integration/sqlite/serverspec/mail_spec.rb @@ -0,0 +1,41 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' + +describe 'owncloud email test' do + describe server(:web) do + describe http('http://127.0.0.1/emailtest.php') do + it 'returns OK status' do + expect(response.status).to eq 200 + end + + it 'sends an email' do + sleep(1) + spool_file = + if ::File.exist?('/var/spool/mail/root') + '/var/spool/mail/root' + else + '/var/spool/mail/vagrant' + end + expect(file(spool_file).content).to contain('kitchen-test@') + end + end # http /emailtest.php + end # server web +end # owncloud diff --git a/test/integration/sqlite/serverspec/owncloud_spec.rb b/test/integration/sqlite/serverspec/owncloud_spec.rb new file mode 100644 index 0000000..fe0adf2 --- /dev/null +++ b/test/integration/sqlite/serverspec/owncloud_spec.rb @@ -0,0 +1,68 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'owncloud' do + describe server(:web) do + describe http('http://127.0.0.1/') do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # http / + + describe http('http://127.0.0.1/status.php') do + let(:body_json) { JSON.parse(response.body) } + + it 'returns a JSON body' do + expect { body_json }.to_not raise_error + end + + it 'is installed' do + expect(body_json['installed']).to eq(true) + end + end # http /status.php + + describe http('https://127.0.0.1/', ssl: { verify: false }) do + it 'returns ownCloud text' do + expect(response.body).to include('ownCloud') + end + end # https / + + describe http('http://127.0.0.1/ocs/v1.php/privatedata/getattribute') do + it 'returns 401 status' do + expect(response.status).to eq 401 + end + + it 'returns unauthorised message' do + expect(response.body).to include('Unauthorised') + end + end # https /ocs/v1.php/privatedata/getattribute unauthorised + + describe http( + 'http://127.0.0.1/ocs/v1.php/privatedata/getattribute', + basic_auth: %w(test test) + ) do + it 'returns OK status' do + expect(response.body).to include('ok') + end + end # https /ocs/v1.php/privatedata/getattribute with basic auth + end # server web +end # owncloud diff --git a/test/integration/sqlite/serverspec/spec_helper.rb b/test/integration/sqlite/serverspec/spec_helper.rb new file mode 100644 index 0000000..4043873 --- /dev/null +++ b/test/integration/sqlite/serverspec/spec_helper.rb @@ -0,0 +1,42 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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 'serverspec' +require 'infrataster/rspec' + +# Set backend type +set :backend, :exec + +ENV['PATH'] = '/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin' + +Infrataster::Server.define(:web, '127.0.0.1') + +# Infrataster hack to ignore phantomjs SSL errors +Infrataster::Contexts::CapybaraContext.class_eval do + def self.prepare_session + driver = Infrataster::Contexts::CapybaraContext::CAPYBARA_DRIVER_NAME + Capybara.register_driver driver do |app| + Capybara::Poltergeist::Driver.new( + app, + phantomjs_options: %w(--ignore-ssl-errors=true) + ) + end + Capybara::Session.new(driver) + end +end diff --git a/test/integration/sqlite/serverspec/sqliste_spec.rb b/test/integration/sqlite/serverspec/sqliste_spec.rb new file mode 100644 index 0000000..acb321d --- /dev/null +++ b/test/integration/sqlite/serverspec/sqliste_spec.rb @@ -0,0 +1,33 @@ +# encoding: UTF-8 +# +# Author:: Xabier de Zuazo () +# Copyright:: Copyright (c) 2015 Xabier de Zuazo +# License:: Apache License, Version 2.0 +# +# 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_relative 'spec_helper' +require 'json' + +describe 'sqlite' do + describe file('/var/www/owncloud/data') do + it { should be_directory } + it { should be_mode 750 } + end + + describe file('/var/www/owncloud/data/owncloud.db') do + it { should be_file } + it { should be_mode 644 } + end +end # sqlite