Commit 7e3566c

mo khan <mo@mokhan.ca>
2015-11-11 20:25:34
add suite for postgresql db.
1 parent 11efa3f
Changed files (5)
recipes/postgres.rb
@@ -2,16 +2,16 @@ include_recipe "postgresql::server"
 include_recipe "postgresql::contrib"
 include_recipe "database::postgresql"
 
-database = node['postgres']["database"]
-username = node['postgres']['username']
-password = node['postgres']["password"]
-host = node['postgres']['host']
+database = node["postgres"]["database"]
+username = node["postgres"]["username"]
+password = node["postgres"]["password"]
+host = node["postgres"]["host"]
 
 postgresql_connection_info = {
   host: host,
   port: 5432,
-  username: 'postgres',
-  password: node['postgresql']['password']['postgres'],
+  username: "postgres",
+  password: node["postgresql"]["password"]["postgres"],
 }
 
 postgresql_database_user username do
test/integration/db/serverspec/default_spec.rb
@@ -0,0 +1,10 @@
+require "serverspec"
+
+set :backend, :exec
+
+describe "db" do
+  it "runs postgres" do
+    expect(service("postgresql")).to be_running
+    expect(port("5432")).to be_listening
+  end
+end
.kitchen.yml
@@ -1,4 +1,4 @@
-#<% require 'kitchen-sync' %>
+#<% require "kitchen-sync" %>
 ---
 driver:
   name: vagrant
@@ -19,8 +19,21 @@ suites:
       - recipe[stronglifters::rails]
     attributes:
       env:
-        app_api_key: 'api-key'
-        app_secret_key: 'secret-key'
+        app_api_key: "api-key"
+        app_secret_key: "secret-key"
+      postgres:
+        database: "mydb"
+        username: "rails"
+        password: "password"
+        host: "localhost"
+  - name: db
+    run_list:
+      - recipe[stronglifters::default]
+      - recipe[stronglifters::postgres]
+    attributes:
+      postgresql:
+        password:
+          postgres: "iloverandompasswordsbutthiswilldo"
       postgres:
         database: "mydb"
         username: "rails"
Berksfile.lock
@@ -4,8 +4,21 @@ DEPENDENCIES
     metadata: true
 
 GRAPH
+  apt (2.9.2)
+  build-essential (2.2.4)
+  chef-sugar (3.1.1)
+  database (4.0.9)
+    postgresql (>= 1.0.0)
+  openssl (4.4.0)
+    chef-sugar (>= 3.1.1)
   packagecloud (0.1.0)
+  postgresql (3.4.21)
+    apt (>= 1.9.0)
+    build-essential (>= 0.0.0)
+    openssl (~> 4.0)
   runit (1.7.4)
     packagecloud (>= 0.0.0)
   stronglifters (0.2.0)
+    database (>= 0.0.0)
+    postgresql (>= 0.0.0)
     runit (>= 0.0.0)
metadata.rb
@@ -1,11 +1,11 @@
-name             'stronglifters'
-maintainer       'mo khan'
-maintainer_email 'mo@mokhan.ca'
-license          'All rights reserved'
-description      'Installs/Configures stronglifters'
-long_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))
-version          '0.2.0'
+name             "stronglifters"
+maintainer       "mo khan"
+maintainer_email "mo@mokhan.ca"
+license          "All rights reserved"
+description      "Installs/Configures stronglifters"
+long_description IO.read(File.join(File.dirname(__FILE__), "README.md"))
+version          "0.2.0"
 
-#depends "database"
-#depends "postgresql"
+depends "database"
+depends "postgresql"
 depends "runit"