Gehel has submitted this change and it was merged.

Change subject: graphite - add tests to configparser_format
......................................................................


graphite - add tests to configparser_format

Change-Id: If20f0f73002dcd16b59eee4234f6e52c735461ca
---
A modules/graphite/.fixtures.yml
A modules/graphite/.rspec
A modules/graphite/Rakefile
A modules/graphite/spec/functions/configparser_format_spec.rb
A modules/graphite/spec/spec_helper.rb
5 files changed, 57 insertions(+), 0 deletions(-)

Approvals:
  Gehel: Looks good to me, approved
  Volans: Looks good to me, but someone else must approve
  jenkins-bot: Verified



diff --git a/modules/graphite/.fixtures.yml b/modules/graphite/.fixtures.yml
new file mode 100644
index 0000000..d05e772
--- /dev/null
+++ b/modules/graphite/.fixtures.yml
@@ -0,0 +1,3 @@
+fixtures:
+    symlinks:
+        graphite: "#{source_dir}"
diff --git a/modules/graphite/.rspec b/modules/graphite/.rspec
new file mode 100644
index 0000000..f449dae
--- /dev/null
+++ b/modules/graphite/.rspec
@@ -0,0 +1,2 @@
+--format doc
+--color
diff --git a/modules/graphite/Rakefile b/modules/graphite/Rakefile
new file mode 100644
index 0000000..cd3d379
--- /dev/null
+++ b/modules/graphite/Rakefile
@@ -0,0 +1 @@
+require 'puppetlabs_spec_helper/rake_tasks'
diff --git a/modules/graphite/spec/functions/configparser_format_spec.rb 
b/modules/graphite/spec/functions/configparser_format_spec.rb
new file mode 100644
index 0000000..9ad87cf
--- /dev/null
+++ b/modules/graphite/spec/functions/configparser_format_spec.rb
@@ -0,0 +1,41 @@
+require 'spec_helper'
+
+describe 'configparser_format' do
+
+  it 'should format hash into ini format' do
+    run.with_params({:section => {:param1 => 'value1', :param2 => 'value2'}})
+                          .and_return(
+                              "[section]\n"\
+                              "param1 = value1\n"\
+                              "param2 = value2\n"
+                          )
+  end
+
+  it 'should sort parameters alphabetically' do
+    run.with_params({:section => {:param2 => 'value2', :param1 => 'value1'}})
+        .and_return(
+            "[section]\n"\
+            "param1 = value1\n"\
+            "param2 = value2\n"
+        )
+  end
+
+  it 'should format multiple hashes' do
+    run.with_params({:section1 => {:param1 => 'value1'}}, {:section2 => 
{:param2 => 'value2'}})
+        .and_return(
+            "[section1]\n"\
+            "param1 = value1\n"\
+            "[section2]\n"\
+            "param2 = value2\n"
+        )
+  end
+
+  it 'should format array parameters' do
+    run.with_params({:section1 => {:param1 => %w(item1 item2)}})
+        .and_return(
+            "[section1]\n"\
+            "param1 = item1,item2\n"\
+        )
+  end
+
+end
diff --git a/modules/graphite/spec/spec_helper.rb 
b/modules/graphite/spec/spec_helper.rb
new file mode 100644
index 0000000..04f9311
--- /dev/null
+++ b/modules/graphite/spec/spec_helper.rb
@@ -0,0 +1,10 @@
+require 'rspec-puppet'
+
+fixture_path = File.expand_path(File.join(__FILE__, '..', 'fixtures'))
+
+
+RSpec.configure do |c|
+  c.module_path = File.expand_path("../..", File.dirname(__FILE__))
+  c.manifest_dir = File.join(fixture_path, 'manifests')
+  c.template_dir = File.join(fixture_path, 'templates')
+end

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If20f0f73002dcd16b59eee4234f6e52c735461ca
Gerrit-PatchSet: 3
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Gehel <gleder...@wikimedia.org>
Gerrit-Reviewer: Volans <rcocci...@wikimedia.org>
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