]> git.openstreetmap.org Git - chef.git/commitdiff
Add test for dev cookbook
authorTom Hughes <tom@compton.nu>
Wed, 4 Sep 2024 09:03:54 +0000 (10:03 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 4 Sep 2024 09:03:54 +0000 (10:03 +0100)
.github/workflows/test-kitchen.yml
.kitchen.yml
test/integration/dev/inspec/apache_spec.rb [new file with mode: 0644]
test/integration/dev/inspec/mysql_spec.rb [new file with mode: 0644]
test/integration/dev/inspec/postgresql_spec.rb [new file with mode: 0644]

index 3152db471273574f27fb8ffcfa9912099b41417d..7e738b38bc1c5c7e964a7e83d4946d1644ba76dd 100644 (file)
@@ -34,6 +34,7 @@ jobs:
           - db-base
           - db-master
           - db-slave
+          - dev
           - devices
           - dhcpd
           - dmca
@@ -124,6 +125,8 @@ jobs:
             suite: osqa
           - os: debian-12
             suite: apt-repository
+          - os: debian-12
+            suite: dev
           - os: debian-12
             suite: dns
           - os: debian-12
@@ -149,6 +152,8 @@ jobs:
         exclude:
           - suite: apt-repository
             os: ubuntu-2204
+          - suite: dev
+            os: ubuntu-2204
           - suite: dns
             os: ubuntu-2204
           - suite: git-server
index db96649406dedc96ab79bf139afb7a52cea140cc..805d15b74f2579a538b4417118abc128026316a5 100644 (file)
@@ -116,6 +116,13 @@ suites:
   - name: db-slave
     run_list:
       - recipe[db::slave]
+  - name: dev
+    run_list:
+      - recipe[dev::default]
+    attributes:
+      postgresql:
+        versions:
+          - 15
   - name: devices
     run_list:
       - recipe[devices::default]
diff --git a/test/integration/dev/inspec/apache_spec.rb b/test/integration/dev/inspec/apache_spec.rb
new file mode 100644 (file)
index 0000000..8006330
--- /dev/null
@@ -0,0 +1,18 @@
+describe package("apache2") do
+  it { should be_installed }
+end
+
+describe service("apache2") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(80) do
+  it { should be_listening }
+  its("protocols") { should cmp "tcp" }
+end
+
+describe port(443) do
+  it { should be_listening }
+  its("protocols") { should cmp "tcp" }
+end
diff --git a/test/integration/dev/inspec/mysql_spec.rb b/test/integration/dev/inspec/mysql_spec.rb
new file mode 100644 (file)
index 0000000..549f33d
--- /dev/null
@@ -0,0 +1,19 @@
+mysql_variant = if os.name == "ubuntu"
+                  "mysql"
+                else
+                  "mariadb"
+                end
+
+describe package("#{mysql_variant}-server") do
+  it { should be_installed }
+end
+
+describe service("#{mysql_variant}") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(3306) do
+  it { should be_listening }
+  its("protocols") { should cmp "tcp" }
+end
diff --git a/test/integration/dev/inspec/postgresql_spec.rb b/test/integration/dev/inspec/postgresql_spec.rb
new file mode 100644 (file)
index 0000000..4c5872e
--- /dev/null
@@ -0,0 +1,13 @@
+describe package("postgresql-15") do
+  it { should be_installed }
+end
+
+describe service("postgresql@15-main") do
+  it { should be_enabled }
+  it { should be_running }
+end
+
+describe port(5432) do
+  it { should be_listening }
+  its("protocols") { should cmp %w[tcp tcp6] }
+end