ansible/test/integration/targets/grafana_datasource/tasks/elastic.yml
Rémi REY 9c17c7ad19 Add integration tests for grafana_datasource module (#63986)
* Add setup_grafana role for integration tests

* grafana_datasource: add integration tests for elastic datasource

* grafana_datasource: add integration tests for influxdb datasource

* grafana_datasource: add integration tests for postgres datasource

* grafana_datasource: add integration tests for cloudwatch datasource
2019-10-29 22:39:38 +01:00

77 lines
2.4 KiB
YAML

---
- name: Create elasticsearch datasource
grafana_datasource:
name: "datasource-elastic"
grafana_url: "http://127.0.0.1:3000"
grafana_user: "admin"
grafana_password: "admin"
org_id: "1"
ds_type: "elasticsearch"
ds_url: "https://elastic.company.com:9200"
database: "[logstash_]YYYY.MM.DD"
basic_auth_user: "grafana"
basic_auth_password: "******"
time_field: "@timestamp"
time_interval: "1m"
interval: "Daily"
es_version: 56
max_concurrent_shard_requests: 42
tls_ca_cert: "/etc/ssl/certs/ca.pem"
register: result
- debug:
var: result
- assert:
that:
- "result.changed == true"
- "result.name == 'datasource-elastic'"
- "result.msg == 'Datasource datasource-elastic created : Datasource added'"
- name: Check elasticsearch datasource creation idempotency
grafana_datasource:
name: "datasource-elastic"
grafana_url: "http://127.0.0.1:3000"
grafana_user: "admin"
grafana_password: "admin"
org_id: "1"
ds_type: "elasticsearch"
ds_url: "https://elastic.company.com:9200"
database: "[logstash_]YYYY.MM.DD"
basic_auth_user: "grafana"
basic_auth_password: "******"
time_field: "@timestamp"
time_interval: "1m"
interval: "Daily"
es_version: 56
max_concurrent_shard_requests: 42
tls_ca_cert: "/etc/ssl/certs/ca.pem"
register: result
- debug:
var: result
- assert:
that:
# Idempotency is not working currently
# "result.changed == false"
- "result.name == 'datasource-elastic'"
- "result.after.basicAuth == true"
- "result.after.basicAuthUser == 'grafana'"
- "result.after.access == 'proxy'"
- "result.after.database == '[logstash_]YYYY.MM.DD'"
- "result.after.isDefault == false"
- "result.after.jsonData.esVersion == 56"
- "result.after.jsonData.interval == 'Daily'"
- "result.after.jsonData.maxConcurrentShardRequests == 42"
- "result.after.jsonData.timeField == '@timestamp'"
- "result.after.jsonData.tlsAuth == false"
- "result.after.jsonData.tlsAuthWithCACert == false"
- "result.after.name == 'datasource-elastic'"
- "result.after.orgId == 1"
- "result.after.password == ''"
- "result.after.type == 'elasticsearch'"
- "result.after.url == 'https://elastic.company.com:9200'"
- "result.after.user == ''"
- "result.after.withCredentials == false"