瀏覽代碼

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

tags/v1.0.0
Benjamin Neff 4 年之前
父節點
當前提交
2690d370ea
沒有連結到貢獻者的電子郵件帳戶。
共有 10 個檔案被更改,包括 68 行新增0 行删除
  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 查看文件

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

+ 1
- 0
test/integration/_mapdata/files/_mapdata/centos-8.yaml 查看文件

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

+ 1
- 0
test/integration/_mapdata/files/_mapdata/debian-10.yaml 查看文件

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

+ 1
- 0
test/integration/_mapdata/files/_mapdata/debian-9.yaml 查看文件

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

+ 1
- 0
test/integration/_mapdata/files/_mapdata/ubuntu-18.yaml 查看文件

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

+ 1
- 0
test/integration/_mapdata/files/_mapdata/ubuntu-20.yaml 查看文件

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

+ 24
- 0
test/integration/default/controls/config_spec.rb 查看文件

@@ -8,19 +8,43 @@ control 'diaspora configuration' do
it { should be_owned_by 'diaspora' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0600' }

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

its('content') do
should include <<~CONTENT
postgresql: &postgresql
adapter: postgresql
host: localhost
port: 5432
username: diaspora
password: "secret"
encoding: unicode
CONTENT
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
it { should be_file }
it { should be_owned_by 'diaspora' }
it { should be_grouped_into 'root' }
its('mode') { should cmp '0600' }

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

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

+ 24
- 0
test/integration/default/controls/http_spec.rb 查看文件

@@ -0,0 +1,24 @@
# 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 查看文件

@@ -0,0 +1,10 @@
# 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 查看文件

@@ -6,3 +6,7 @@ diaspora:

user:
shell: /bin/bash

configuration:
server:
listen: 127.0.0.1:3000

Loading…
取消
儲存