Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F8391589
grafana_plugin_spec.rb
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
grafana_plugin_spec.rb
View Options
require
'spec_helper_acceptance'
describe
'grafana_plugin'
do
context
'create plugin resource'
do
it
'runs successfully'
do
pp
=
<<-
EOS
class { 'grafana':}
include grafana::validator
grafana_plugin { 'grafana-simple-json-datasource': }
EOS
apply_manifest
(
pp
,
catch_failures
:
true
)
apply_manifest
(
pp
,
catch_changes
:
true
)
end
it
'has the plugin'
do
shell
(
'grafana-cli plugins ls'
)
do
|
r
|
expect
(
r
.
stdout
)
.
to
match
(
%r{grafana-simple-json-datasource}
)
end
end
end
context
'create plugin resource with repo'
do
it
'runs successfully'
do
pp
=
<<-
EOS
class { 'grafana':}
include grafana::validator
grafana_plugin { 'grafana-simple-json-datasource':
ensure => present,
repo => 'https://nexus.company.com/grafana/plugins',
}
EOS
apply_manifest
(
pp
,
catch_failures
:
true
)
apply_manifest
(
pp
,
catch_changes
:
true
)
end
it
'has the plugin'
do
shell
(
'grafana-cli plugins ls'
)
do
|
r
|
expect
(
r
.
stdout
)
.
to
match
(
%r{grafana-simple-json-datasource}
)
end
end
end
context
'create plugin resource with url'
do
it
'runs successfully'
do
# Reset and reinstall the same plugin by URL
shell
(
'grafana-cli plugins uninstall grafana-simple-json-datasource'
)
pp
=
<<-
EOS
class { 'grafana':}
include grafana::validator
grafana_plugin { 'grafana-simple-json-datasource':
ensure => 'present',
plugin_url => 'https://grafana.com/api/plugins/grafana-simple-json-datasource/versions/latest/download',
}
EOS
apply_manifest
(
pp
,
catch_failures
:
true
)
apply_manifest
(
pp
,
catch_changes
:
true
)
end
it
'has the plugin'
do
shell
(
'grafana-cli plugins ls'
)
do
|
r
|
expect
(
r
.
stdout
)
.
to
match
(
%r{grafana-simple-json-datasource}
)
end
end
end
context
'destroy plugin resource'
do
it
'runs successfully'
do
pp
=
<<-
EOS
class { 'grafana':}
include grafana::validator
grafana_plugin { 'grafana-simple-json-datasource':
ensure => absent,
}
EOS
apply_manifest
(
pp
,
catch_failures
:
true
)
apply_manifest
(
pp
,
catch_changes
:
true
)
end
it
'does not have the plugin'
do
shell
(
'grafana-cli plugins ls'
)
do
|
r
|
expect
(
r
.
stdout
)
.
not_to
match
(
%r{grafana-simple-json-datasource}
)
end
end
end
end
File Metadata
Details
Attached
Mime Type
text/x-ruby
Expires
Jun 4 2025, 6:46 PM (14 w, 13 h ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3398751
Attached To
R142 puppet-puppet-grafana
Event Timeline
Log In to Comment