Skip to content

Commit

Permalink
Refactor test attributes into the control files
Browse files Browse the repository at this point in the history
  • Loading branch information
AgarFu committed Feb 14, 2017
1 parent eca7412 commit f3ae5a5
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 49 deletions.
24 changes: 0 additions & 24 deletions .kitchen.docker.yml
Expand Up @@ -11,9 +11,6 @@ provisioner:

platforms:
- name: debian-7
verifier:
attributes:
pg_version: '9.1'
driver:
image: debian:7
pid_one_command: /sbin/init
Expand All @@ -30,9 +27,6 @@ platforms:
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: centos-5
verifier:
attributes:
pg_version: '8.4'
driver:
image: centos:5
platform: rhel
Expand All @@ -41,9 +35,6 @@ platforms:
- RUN yum install -y which initscripts net-tools wget

- name: centos-6
verifier:
attributes:
pg_version: '8.4'
driver:
image: centos:6
platform: rhel
Expand All @@ -52,9 +43,6 @@ platforms:
- RUN yum -y install which initscripts net-tools wget

- name: centos-7
verifier:
attributes:
pg_version: '9.2'
driver:
image: centos:7
platform: rhel
Expand All @@ -63,19 +51,13 @@ platforms:
- RUN yum -y install lsof which systemd-sysv initscripts wget net-tools

- name: fedora-25
verifier:
attributes:
pg_version: '9.5'
driver:
image: fedora:25
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN dnf -y install yum which systemd-sysv initscripts wget net-tools

- name: ubuntu-12.04
verifier:
attributes:
pg_version: '9.1'
driver:
image: ubuntu-upstart:12.04
pid_one_command: /sbin/init
Expand All @@ -84,9 +66,6 @@ platforms:
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: ubuntu-14.04
verifier:
attributes:
pg_version: '9.3'
driver:
image: ubuntu-upstart:14.04
pid_one_command: /sbin/init
Expand All @@ -95,9 +74,6 @@ platforms:
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools -y

- name: ubuntu-16.04
verifier:
attributes:
pg_version: '9.5'
driver:
image: ubuntu:16.04
pid_one_command: /bin/systemd
Expand Down
24 changes: 0 additions & 24 deletions .kitchen.yml
Expand Up @@ -17,9 +17,6 @@ verifier:

platforms:
- name: debian-7
verifier:
attributes:
pg_version: '9.1'
driver:
box: bento/debian-7.11

Expand All @@ -28,52 +25,31 @@ platforms:
box: bento/debian-8.5

- name: centos-5
verifier:
attributes:
pg_version: '8.4'
driver:
box: bento/centos-5.11

- name: centos-6
verifier:
attributes:
pg_version: '8.4'
driver:
box: bento/centos-6.8

- name: centos-7
verifier:
attributes:
pg_version: '9.2'
driver:
box: bento/centos-7.2

- name: fedora-25
verifier:
attributes:
pg_version: '9.5'
driver:
box: bento/fedora-25
run_list: yum::dnf_yum_compat

- name: ubuntu-12.04
verifier:
attributes:
pg_version: '9.1'
driver:
box: bento/ubuntu-12.04

- name: ubuntu-14.04
verifier:
attributes:
pg_version: '9.3'
driver:
box: bento/ubuntu-14.04

- name: ubuntu-16.04
verifier:
attributes:
pg_version: '9.5'
driver:
box: bento/ubuntu-16.04

Expand Down
50 changes: 49 additions & 1 deletion test/integration/client/controls/client_spec.rb
@@ -1,5 +1,53 @@
# frozen_string_literal: true
pg_version = attribute('pg_version', default: '9.4', description: 'PostgreSQL installed version by default')
pg_version = attribute('pg_version', default: nil, description: 'PostgreSQL installed version by default')

if pg_version.nil?
# Default values per platform/version
case os[:family]
when 'redhat'
case os[:release]
when /(5|6)\.\d+/
pg_version = '8.4'

when /7\.\d+/
pg_version = '9.2'
end

when 'fedora'
case os[:release]
when '25'
pg_version = '9.5'
end

when 'debian'
case os[:release]
when /7\.\d+/
pg_version = '9.1'

when /8\.\d+/
pg_version = '9.4'

# Ubuntu versions
when '12.04'
pg_version = '9.1'

when '14.04'
pg_version = '9.3'

when '16.04'
pg_version = '9.5'
end

when 'suse'
case os[:release]
when '42.2'
pg_version = '9.4'

when '13.2'
pg_version = '9.3'
end
end
end

describe command('/usr/bin/psql --help') do
its('exit_status') { should eq 0 }
Expand Down

0 comments on commit f3ae5a5

Please sign in to comment.