Browse Source

test: add some more tests to see if diaspora is working

tags/v1.0.0
Benjamin Neff 4 years ago
parent
commit
2690d370ea
No account linked to committer's email address
10 changed files with 68 additions and 0 deletions
  1. +1
    -0
      test/integration/_mapdata/files/_mapdata/centos-7.yaml
  2. +1
    -0
      test/integration/_mapdata/files/_mapdata/centos-8.yaml
  3. +1
    -0
      test/integration/_mapdata/files/_mapdata/debian-10.yaml
  4. +1
    -0
      test/integration/_mapdata/files/_mapdata/debian-9.yaml
  5. +1
    -0
      test/integration/_mapdata/files/_mapdata/ubuntu-18.yaml
  6. +1
    -0
      test/integration/_mapdata/files/_mapdata/ubuntu-20.yaml
  7. +24
    -0
      test/integration/default/controls/config_spec.rb
  8. +24
    -0
      test/integration/default/controls/http_spec.rb
  9. +10
    -0
      test/integration/default/controls/install_spec.rb
  10. +4
    -0
      test/salt/pillar/tests.sls

+ 1
- 0
test/integration/_mapdata/files/_mapdata/centos-7.yaml View File

certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt
url: https://example.org/ url: https://example.org/
server: server:
listen: 127.0.0.1:3000
rails_environment: production rails_environment: production
settings: settings:
pod_name: example diaspora* pod pod_name: example diaspora* pod

+ 1
- 0
test/integration/_mapdata/files/_mapdata/centos-8.yaml View File

certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt certificate_authorities: /etc/pki/tls/certs/ca-bundle.crt
url: https://example.org/ url: https://example.org/
server: server:
listen: 127.0.0.1:3000
rails_environment: production rails_environment: production
settings: settings:
pod_name: example diaspora* pod pod_name: example diaspora* pod

+ 1
- 0
test/integration/_mapdata/files/_mapdata/debian-10.yaml View File

certificate_authorities: /etc/ssl/certs/ca-certificates.crt certificate_authorities: /etc/ssl/certs/ca-certificates.crt
url: https://example.org/ url: https://example.org/
server: server:
listen: 127.0.0.1:3000
rails_environment: production rails_environment: production
settings: settings:
pod_name: example diaspora* pod pod_name: example diaspora* pod

+ 1
- 0
test/integration/_mapdata/files/_mapdata/debian-9.yaml View File

certificate_authorities: /etc/ssl/certs/ca-certificates.crt certificate_authorities: /etc/ssl/certs/ca-certificates.crt
url: https://example.org/ url: https://example.org/
server: server:
listen: 127.0.0.1:3000
rails_environment: production rails_environment: production
settings: settings:
pod_name: example diaspora* pod pod_name: example diaspora* pod

+ 1
- 0
test/integration/_mapdata/files/_mapdata/ubuntu-18.yaml View File

certificate_authorities: /etc/ssl/certs/ca-certificates.crt certificate_authorities: /etc/ssl/certs/ca-certificates.crt
url: https://example.org/ url: https://example.org/
server: server:
listen: 127.0.0.1:3000
rails_environment: production rails_environment: production
settings: settings:
pod_name: example diaspora* pod pod_name: example diaspora* pod

+ 1
- 0
test/integration/_mapdata/files/_mapdata/ubuntu-20.yaml View File

certificate_authorities: /etc/ssl/certs/ca-certificates.crt certificate_authorities: /etc/ssl/certs/ca-certificates.crt
url: https://example.org/ url: https://example.org/
server: server:
listen: 127.0.0.1:3000
rails_environment: production rails_environment: production
settings: settings:
pod_name: example diaspora* pod pod_name: example diaspora* pod

+ 24
- 0
test/integration/default/controls/config_spec.rb View File

it { should be_owned_by 'diaspora' } it { should be_owned_by 'diaspora' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
its('mode') { should cmp '0600' } its('mode') { should cmp '0600' }

its('content') do its('content') do
should include '# This file is managed by Salt! Do not edit by hand!' should include '# This file is managed by Salt! Do not edit by hand!'
end end

its('content') do
should include <<~CONTENT
postgresql: &postgresql
adapter: postgresql
host: localhost
port: 5432
username: diaspora
password: "secret"
encoding: unicode
CONTENT
end
end end


ca_file =
case platform[:family]
when 'debian'
'/etc/ssl/certs/ca-certificates.crt'
when 'redhat'
'/etc/pki/tls/certs/ca-bundle.crt'
end

describe file('/srv/diaspora/config/diaspora.yml') do describe file('/srv/diaspora/config/diaspora.yml') do
it { should be_file } it { should be_file }
it { should be_owned_by 'diaspora' } it { should be_owned_by 'diaspora' }
it { should be_grouped_into 'root' } it { should be_grouped_into 'root' }
its('mode') { should cmp '0600' } its('mode') { should cmp '0600' }

its('content') do its('content') do
should include '# This file is managed by Salt! Do not edit by hand!' should include '# This file is managed by Salt! Do not edit by hand!'
end end

its('content') { should include 'rails_environment: production' } its('content') { should include 'rails_environment: production' }
its('content') { should include "certificate_authorities: #{ca_file}" }
end end
end end

+ 24
- 0
test/integration/default/controls/http_spec.rb View File

# frozen_string_literal: true

control 'diaspora webserver' do
impact 0.5
title 'should be working'

https_header = { 'X-Forwarded-Proto': 'https' }

30.times do
break if port(3000).listening?

puts "Port 3000 isn't ready, retrying.."
sleep 1
end

describe http('http://localhost:3000', headers: https_header) do
its('status') { should cmp 302 }
its('headers.Location') { should cmp 'https://localhost:3000/podmin' }
end

describe http('http://localhost:3000/podmin', headers: https_header) do
its('status') { should cmp 200 }
end
end

+ 10
- 0
test/integration/default/controls/install_spec.rb View File

# frozen_string_literal: true

control 'diaspora' do
impact 0.5
title 'should be installed'

describe directory('/srv/diaspora/.git') do
it { should be_owned_by 'diaspora' }
end
end

+ 4
- 0
test/salt/pillar/tests.sls View File



user: user:
shell: /bin/bash shell: /bin/bash

configuration:
server:
listen: 127.0.0.1:3000

Loading…
Cancel
Save