Alexandros Kosiaris has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/299151 )

Change subject: zuul: rspec tests
......................................................................


zuul: rspec tests

Tie it to wmflib modules for os_version and to apt for the pbr pinning.

Had to add some facts for $os_version and apt module switching on
$operatingsystem.

include ::apt else apt::pin can't find Exec['apt-get update'].

Change-Id: I927864de5eb92e448b7c6c39975b27ef90dd1657
---
A modules/zuul/.fixtures.yml
A modules/zuul/.rspec
A modules/zuul/Rakefile
M modules/zuul/manifests/init.pp
A modules/zuul/spec/classes/zuul_spec.rb
A modules/zuul/spec/fixtures/hiera.yaml
A modules/zuul/spec/fixtures/hieradata/common.yaml
A modules/zuul/spec/spec_helper.rb
8 files changed, 50 insertions(+), 0 deletions(-)

Approvals:
  Hashar: Looks good to me, but someone else must approve
  Alexandros Kosiaris: Verified; Looks good to me, approved



diff --git a/modules/zuul/.fixtures.yml b/modules/zuul/.fixtures.yml
new file mode 100644
index 0000000..30962bd
--- /dev/null
+++ b/modules/zuul/.fixtures.yml
@@ -0,0 +1,5 @@
+fixtures:
+    symlinks:
+        zuul: "#{source_dir}"
+        apt: "../../../../apt"
+        wmflib: "../../../../wmflib"
diff --git a/modules/zuul/.rspec b/modules/zuul/.rspec
new file mode 100644
index 0000000..f449dae
--- /dev/null
+++ b/modules/zuul/.rspec
@@ -0,0 +1,2 @@
+--format doc
+--color
diff --git a/modules/zuul/Rakefile b/modules/zuul/Rakefile
new file mode 100644
index 0000000..cd3d379
--- /dev/null
+++ b/modules/zuul/Rakefile
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/rake_tasks'
diff --git a/modules/zuul/manifests/init.pp b/modules/zuul/manifests/init.pp
index 0a46f99..94ec139 100644
--- a/modules/zuul/manifests/init.pp
+++ b/modules/zuul/manifests/init.pp
@@ -17,6 +17,7 @@
     # Ideally we should rebuild Zuul with a new version string,
     # but for now this will do.
     if os_version('debian == jessie') {
+        include ::apt
         apt::pin { 'python-pbr':
             pin      => 'release o=debian',
             priority => '1002',
diff --git a/modules/zuul/spec/classes/zuul_spec.rb 
b/modules/zuul/spec/classes/zuul_spec.rb
new file mode 100644
index 0000000..97b34cb
--- /dev/null
+++ b/modules/zuul/spec/classes/zuul_spec.rb
@@ -0,0 +1,24 @@
+require 'spec_helper'
+
+describe 'zuul' do
+    context "on production" do
+        let(:facts) {{
+            :realm => 'production',
+            :operatingsystem => 'Debian',
+            # for wmflib os_version
+            :lsbdistid      => 'Debian',
+            :lsbdistrelease => '8.7',
+        }}
+        it { should compile }
+    end
+    context "on labs" do
+        let(:facts) {{
+            :realm => 'labs',
+            :operatingsystem => 'Debian',
+            # for wmflib os_version
+            :lsbdistid       => 'Debian',
+            :lsbdistrelease  => '8.7',
+        }}
+        it { should compile }
+    end
+end
diff --git a/modules/zuul/spec/fixtures/hiera.yaml 
b/modules/zuul/spec/fixtures/hiera.yaml
new file mode 100644
index 0000000..4f2ee1c
--- /dev/null
+++ b/modules/zuul/spec/fixtures/hiera.yaml
@@ -0,0 +1,6 @@
+:backends:
+  - yaml
+:yaml:
+  :datadir: 'spec/fixtures/hieradata'
+:hierarchy:
+  - common
diff --git a/modules/zuul/spec/fixtures/hieradata/common.yaml 
b/modules/zuul/spec/fixtures/hieradata/common.yaml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/modules/zuul/spec/fixtures/hieradata/common.yaml
diff --git a/modules/zuul/spec/spec_helper.rb b/modules/zuul/spec/spec_helper.rb
new file mode 100644
index 0000000..7965c90
--- /dev/null
+++ b/modules/zuul/spec/spec_helper.rb
@@ -0,0 +1,11 @@
+require 'rspec-puppet'
+require 'puppetlabs_spec_helper/module_spec_helper'
+
+fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
+
+RSpec.configure do |c|
+  c.module_path = File.join(fixture_path, 'modules')
+  c.manifest_dir = File.join(fixture_path, 'manifests')
+  c.environmentpath = File.join(Dir.pwd, 'spec')
+  c.hiera_config = File.join(fixture_path, 'hiera.yaml')
+end

-- 
To view, visit https://gerrit.wikimedia.org/r/299151
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I927864de5eb92e448b7c6c39975b27ef90dd1657
Gerrit-PatchSet: 5
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Hashar <has...@free.fr>
Gerrit-Reviewer: Alexandros Kosiaris <akosia...@wikimedia.org>
Gerrit-Reviewer: Gehel <guillaume.leder...@wikimedia.org>
Gerrit-Reviewer: Giuseppe Lavagetto <glavage...@wikimedia.org>
Gerrit-Reviewer: Hashar <has...@free.fr>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to