Skip to content

Commit

Permalink
use https sources for cloning
Browse files Browse the repository at this point in the history
  • Loading branch information
bfraser committed Apr 30, 2016
2 parents 9a343f9 + 684f54e commit 35947ed
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 14 deletions.
10 changes: 5 additions & 5 deletions .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
fixtures:
repositories:
stdlib: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
archive: "git://github.com/voxpupuli/puppet-archive.git"
docker: "git://github.com/garethr/garethr-docker.git"
wget: "git://github.com/maestrodev/puppet-wget.git"
apt: https://github.com/puppetlabs/puppetlabs-apt.git
stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git"
archive: "https://github.com/voxpupuli/puppet-archive.git"
docker: "https://github.com/garethr/garethr-docker.git"
wget: "https://github.com/maestrodev/puppet-wget.git"
apt: "https://github.com/puppetlabs/puppetlabs-apt.git"
symlinks:
grafana: "#{source_dir}"
3 changes: 3 additions & 0 deletions lib/puppet/type/grafana_dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,7 @@ def is_to_s(value)
validate do
fail('content is required when ensure is present') if self[:ensure] == :present and self[:content].nil?
end
autorequire(:service) do
'grafana-server'
end
end
3 changes: 3 additions & 0 deletions lib/puppet/type/grafana_datasource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,7 @@
end
end
end
autorequire(:service) do
'grafana-server'
end
end
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"author": "bfraser",
"summary": "This module provides Grafana, a dashboard and graph editor for Graphite and InfluxDB.",
"license": "Apache 2.0",
"source": "git://github.com/bfraser/puppet-grafana.git",
"source": "https://github.com/bfraser/puppet-grafana.git",
"project_page": "https://github.com/bfraser/puppet-grafana",
"issues_url": "https://github.com/bfraser/puppet-grafana/issues",
"tags": [
Expand Down
26 changes: 22 additions & 4 deletions spec/unit/puppet/type/grafana_dashboard_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
require 'spec_helper'

describe Puppet::Type.type(:grafana_dashboard) do
let(:gdashboard) {
described_class.new :name => "foo", :grafana_url => "http://example.com/", :content => "{}", :ensure => :present
}
context "when setting parameters" do

it "should fail if grafana_url isn't HTTP-based" do
Expand All @@ -35,10 +38,25 @@
end

it "should accept valid parameters" do
resource = described_class.new :name => "foo", :grafana_url => "http://example.com/", :content => "{}", :ensure => :present
expect(resource[:name]).to eq('foo')
expect(resource[:grafana_url]).to eq('http://example.com/')
expect(resource[:content]).to eq({})
expect(gdashboard[:name]).to eq('foo')
expect(gdashboard[:grafana_url]).to eq('http://example.com/')
expect(gdashboard[:content]).to eq({})
end
it "should autorequire the grafana-server for proper ordering" do
catalog = Puppet::Resource::Catalog.new
service = Puppet::Type.type(:service).new(:name => "grafana-server")
catalog.add_resource service
catalog.add_resource gdashboard

relationship = gdashboard.autorequire.find do |rel|
(rel.source.to_s == "Service[grafana-server]") and (rel.target.to_s == gdashboard.to_s)
end
expect(relationship).to be_a Puppet::Relationship
end
it "should not autorequire the service it is not managed" do
catalog = Puppet::Resource::Catalog.new
catalog.add_resource gdashboard
expect(gdashboard.autorequire).to be_empty
end
end
end
26 changes: 22 additions & 4 deletions spec/unit/puppet/type/grafana_datasource_type_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
require 'spec_helper'

describe Puppet::Type.type(:grafana_datasource) do
let(:gdatasource) {
described_class.new :name => "foo", :grafana_url => "http://example.com", :url => 'http://influx.example.com'
}
context "when setting parameters" do

it "should fail if grafana_url isn't HTTP-based" do
Expand All @@ -29,10 +32,25 @@
end

it "should accept valid parameters" do
resource = described_class.new :name => "foo", :grafana_url => "http://example.com", :url => 'http://influx.example.com'
expect(resource[:name]).to eq('foo')
expect(resource[:grafana_url]).to eq('http://example.com')
expect(resource[:url]).to eq('http://influx.example.com')
expect(gdatasource[:name]).to eq('foo')
expect(gdatasource[:grafana_url]).to eq('http://example.com')
expect(gdatasource[:url]).to eq('http://influx.example.com')
end
it "should autorequire the grafana-server for proper ordering" do
catalog = Puppet::Resource::Catalog.new
service = Puppet::Type.type(:service).new(:name => "grafana-server")
catalog.add_resource service
catalog.add_resource gdatasource

relationship = gdatasource.autorequire.find do |rel|
(rel.source.to_s == "Service[grafana-server]") and (rel.target.to_s == gdatasource.to_s)
end
expect(relationship).to be_a Puppet::Relationship
end
it "should not autorequire the service it is not managed" do
catalog = Puppet::Resource::Catalog.new
catalog.add_resource gdatasource
expect(gdatasource.autorequire).to be_empty
end
end
end

0 comments on commit 35947ed

Please sign in to comment.