nextcloud_spec.rb 2.9 KB
Newer Older
1
require 'spec_helper_acceptance'
Matthieu FAURE's avatar
Matthieu FAURE committed
2

3 4
describe 'NextCloud class' do
  context 'with default parameters' do
Matthieu FAURE's avatar
Matthieu FAURE committed
5 6
    pp = <<-EOS
      class { 'nextcloud':
7 8 9
        db_password       => 'S3cr#TPassw0rdz',
        nc_admin_username => 'ncadmin',
        nc_admin_password => 'ncadminPassword',
Matthieu FAURE's avatar
Matthieu FAURE committed
10 11
      }
    EOS
12
    it 'applies without error' do
Matthieu FAURE's avatar
Matthieu FAURE committed
13
      apply_manifest(pp, catch_failures: true)
14 15
    end
    it 'applies idempotently' do
Matthieu FAURE's avatar
Matthieu FAURE committed
16 17 18 19 20 21
      apply_manifest(pp, catch_changes: true)
    end

    # TODO: once actual code is created in the module, add tests here with `describe` and expectations
  end

22 23
  context 'with managed_apache=true' do
    pp = <<-EOS
Matthieu FAURE's avatar
Matthieu FAURE committed
24
      class { 'nextcloud':
25 26 27
        db_password       => 'S3cr#TPassw0rdz',
        nc_admin_username => 'ncadmin',
        nc_admin_password => 'ncadminPassword',
Matthieu FAURE's avatar
Matthieu FAURE committed
28
        manage_apache     => true,
Matthieu FAURE's avatar
Matthieu FAURE committed
29
      }
30
    EOS
Matthieu FAURE's avatar
Matthieu FAURE committed
31

32
    it 'applies without error' do
Matthieu FAURE's avatar
Matthieu FAURE committed
33
      apply_manifest(pp, catch_failures: true)
34
    end
35 36 37 38 39
    # Following test disabled ; waiting for upstream feedback
    # See https://github.com/voxpupuli/puppet-php/issues/548
    # it 'applies idempotently' do
    #   apply_manifest(pp, catch_changes: true)
    # end
40

41 42 43 44 45 46
    describe service('php7.2-fpm') do
      it { is_expected.to be_running }
    end
    describe service('apache2') do
      it { is_expected.to be_running }
    end
47
    describe file('/var/www/nextcloud/index.php') do
Matthieu FAURE's avatar
Matthieu FAURE committed
48 49
      it { is_expected.to be_file }
    end
50
    describe file('/var/www/nextcloud/core/') do
Matthieu FAURE's avatar
Matthieu FAURE committed
51 52
      it { is_expected.to be_directory }
    end
53

54
    # TODO: once actual code is created in the module, add tests here with `describe` and expectations
Matthieu FAURE's avatar
Matthieu FAURE committed
55
  end
Matthieu FAURE's avatar
Matthieu FAURE committed
56

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
  # /!\ Commented out as puppet-redis does not support Ubuntu 18.04 yet (as of 2019-10-06)
  #
  # context 'with managed_redis=true' do
  #   pp = <<-EOS
  #     class { 'nextcloud':
  #       db_password       => 'S3cr#TPassw0rdz',
  #       nc_admin_username => 'ncadmin',
  #       nc_admin_password => 'ncadminPassword',
  #       manage_redis      => true,
  #     }
  #   EOS
  #
  #   it 'applies without error' do
  #     apply_manifest(pp, catch_failures: true)
  #   end
  #   it 'applies idempotently' do
  #     apply_manifest(pp, catch_changes: true)
  #   end
  #
  #   # TODO: once actual code is created in the module, add tests here with `describe` and expectations
  # end
Matthieu FAURE's avatar
Matthieu FAURE committed
78 79 80 81

  context 'with managed_mariadb=true' do
    pp = <<-EOS
      class { 'nextcloud':
82 83 84
        db_password       => 'S3cr#TPassw0rdz',
        nc_admin_username => 'ncadmin',
        nc_admin_password => 'ncadminPassword',
Matthieu FAURE's avatar
Matthieu FAURE committed
85 86 87 88 89 90 91 92 93 94 95
        manage_mariadb    => true,
      }
    EOS

    it 'applies without error' do
      apply_manifest(pp, catch_failures: true)
    end
    it 'applies idempotently' do
      apply_manifest(pp, catch_changes: true)
    end

96 97 98
    describe service('mariadb') do
      it { is_expected.to be_running }
    end
Matthieu FAURE's avatar
Matthieu FAURE committed
99 100 101

    # TODO: once actual code is created in the module, add tests here with `describe` and expectations
  end
Matthieu FAURE's avatar
Matthieu FAURE committed
102
end