forked from bfraser/puppet-grafana
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update README.md/create acceptance tests (bfraser#3)
* initial commit to implement grafana_folder resource type * add required parameters for grafana objects * remove references to dashboard objects (dashboard used as template) * update tests * remove whitespace for rubocop * rubocop fixes * fix global var assignment clause logic * update README.md/created acceptance test for grafana_folder resource
- Loading branch information
1 parent
a448ec0
commit b13f3d5
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'grafana_folder' do | ||
context 'create folder resource' do | ||
it 'runs successfully' do | ||
pp = <<-EOS | ||
class { 'grafana': | ||
cfg => { | ||
security => { | ||
admin_user => 'admin', | ||
admin_password => 'admin' | ||
} | ||
} | ||
} | ||
grafana_folder { 'example-folder': | ||
ensure => present, | ||
grafana_url => 'http://localhost:3000', | ||
grafana_user => 'admin', | ||
grafana_password => 'admin', | ||
} | ||
EOS | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
it 'has the folder' do | ||
shell('curl --user admin:admin http://localhost:3000/api/folders') do |f| | ||
expect(f.stdout).to match(%r{example-folder}) | ||
end | ||
end | ||
end | ||
|
||
context 'destroy folder resource' do | ||
it 'runs successfully' do | ||
pp = <<-EOS | ||
class { 'grafana': | ||
cfg => { | ||
security => { | ||
admin_user => 'admin', | ||
admin_password => 'admin' | ||
} | ||
} | ||
} | ||
grafana_folder { 'example-folder': | ||
ensure => absent, | ||
grafana_url => 'http://localhost:3000', | ||
grafana_user => 'admin', | ||
grafana_password => 'admin', | ||
} | ||
EOS | ||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
it 'does not have the folder' do | ||
shell('curl --user admin:admin http://localhost:3000/api/folders') do |f| | ||
expect(f.stdout).not_to match(%r{example-folder}) | ||
end | ||
end | ||
end | ||
end |