From 6dd7a6596a11addd5eda3f1bdc655e8497f4bfb2 Mon Sep 17 00:00:00 2001 From: Alfredo Palhares Date: Fri, 20 Feb 2015 17:13:54 +0000 Subject: [PATCH 1/5] Add Gemfile with kitchen-salt dependencies --- Gemfile | 5 +++++ Gemfile.lock | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 Gemfile create mode 100644 Gemfile.lock diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..4c95fc1 --- /dev/null +++ b/Gemfile @@ -0,0 +1,5 @@ +source "https://rubygems.org" + +gem "test-kitchen", "> 1.2.0" +gem "kitchen-vagrant" +gem "kitchen-salt" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..14f77c6 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,26 @@ +GEM + remote: https://rubygems.org/ + specs: + kitchen-salt (0.0.19) + kitchen-vagrant (0.15.0) + test-kitchen (~> 1.0) + mixlib-shellout (2.0.1) + net-scp (1.2.1) + net-ssh (>= 2.6.5) + net-ssh (2.9.2) + safe_yaml (1.0.4) + test-kitchen (1.3.1) + mixlib-shellout (>= 1.2, < 3.0) + net-scp (~> 1.1) + net-ssh (~> 2.7) + safe_yaml (~> 1.0) + thor (~> 0.18) + thor (0.19.1) + +PLATFORMS + ruby + +DEPENDENCIES + kitchen-salt + kitchen-vagrant + test-kitchen (> 1.2.0) From 438811d03fcf5f0aa9e7bb99c895ba67b7a034b0 Mon Sep 17 00:00:00 2001 From: Alfredo Palhares Date: Fri, 20 Feb 2015 17:29:34 +0000 Subject: [PATCH 2/5] Add test-kitchen configuration file --- .kitchen.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .kitchen.yml diff --git a/.kitchen.yml b/.kitchen.yml new file mode 100644 index 0000000..d9c06bf --- /dev/null +++ b/.kitchen.yml @@ -0,0 +1,26 @@ +--- +driver: + name: vagrant + network: + - ["private_network", { ip: "192.168.33.33" }] + +provisioner: + name: salt_solo + formula: postgres + pillars-from-files: + postgres.sls: pillar.example + pillars: + top.sls: + base: + "*": + - postgres + state_top: + base: + "*": + - postgres + +platforms: + - name: ubuntu-14.04 + +suites: + - name: default From 007ed90859d9be84d3593e3d26ce2a1eeb582f69 Mon Sep 17 00:00:00 2001 From: Alfredo Palhares Date: Fri, 20 Feb 2015 17:34:20 +0000 Subject: [PATCH 3/5] Add ServerSpec test --- test/integration/default/serverspec/postgres_spec.rb | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 test/integration/default/serverspec/postgres_spec.rb diff --git a/test/integration/default/serverspec/postgres_spec.rb b/test/integration/default/serverspec/postgres_spec.rb new file mode 100644 index 0000000..8977a5a --- /dev/null +++ b/test/integration/default/serverspec/postgres_spec.rb @@ -0,0 +1,10 @@ +require "serverspec" + +describe service("postgres") do + it { should be_enabled } + it { should be_running } +end + +describe port("5432") do + it { should be_listening } +end From debf1a5a7f189d5bff0c5f3290adf9beba7a292b Mon Sep 17 00:00:00 2001 From: Alfredo Palhares Date: Fri, 20 Feb 2015 17:38:03 +0000 Subject: [PATCH 4/5] Add gitignore --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ab1b3b9 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +.kitchen/ +*.swp +*.swo From 52b92b6a01fc6a1ada4be7afcde9daa52d6701de Mon Sep 17 00:00:00 2001 From: Alfredo Palhares Date: Mon, 23 Feb 2015 10:33:21 +0000 Subject: [PATCH 5/5] Add kitchen-salt documentation to the README file --- README.rst | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/README.rst b/README.rst index e4f2c09..a3077ae 100644 --- a/README.rst +++ b/README.rst @@ -22,3 +22,29 @@ Installs the postgresql package. ------------------- Installs the postgresql python module + +Testing +======= + +Testing is done wit kitchen-salt + +``kitchen converge`` +-------------------- + +Runs the postgres main state + +``kitchen verify`` +------------------ + +Runs serverspec tests on the actual instance + +``kitchen test`` +---------------- + +Builds and runs test from scratch + +``kitchen login`` +----------------- + +Gives you ssh to the vagrant machine for manual testing +