Skip to content

Commit

Permalink
Fix indentation in elastic tests and invalid assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
rrey committed Oct 13, 2020
1 parent 11a0b03 commit 8644da8
Showing 1 changed file with 98 additions and 100 deletions.
198 changes: 98 additions & 100 deletions tests/integration/targets/grafana_datasource/tasks/elastic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,111 +134,109 @@
- result.datasource.user == ''
- not result.datasource.withCredentials

- name: update elasticsearch datasource (ignoring secureJsonData)
register: result
grafana_datasource:
name: datasource-elastic
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: elasticsearch
ds_url: https://elastic.example.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
enforce_secure_data: false
additional_json_data:
nonSecureTest: "nonsecure"
additional_secure_json_data:
secureTest: "secure"
- name: update elasticsearch datasource (ignoring secureJsonData)
register: result
grafana_datasource:
name: datasource-elastic
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: elasticsearch
ds_url: https://elastic.example.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
enforce_secure_data: false
additional_json_data:
nonSecureTest: "nonsecure"
additional_secure_json_data:
secureTest: "secure"

- debug:
var: result
- debug:
var: result

- assert:
that:
- result.changed
- result.datasource.basicAuth
- result.datasource.basicAuthUser == 'grafana'
- result.datasource.access == 'proxy'
- result.datasource.database == '[logstash_]YYYY.MM.DD'
- not result.datasource.isDefault
- result.datasource.jsonData.esVersion == 56
- result.datasource.jsonData.interval == 'Daily'
- result.datasource.jsonData.maxConcurrentShardRequests == 42
- result.datasource.jsonData.timeField == '@timestamp'
- not result.datasource.jsonData.tlsAuth
- not result.datasource.jsonData.tlsAuthWithCACert
- result.datasource.name == 'datasource-elastic'
- result.datasource.orgId == 1
- result.datasource.password == ''
- result.datasource.type == 'elasticsearch'
- result.datasource.url == 'https://elastic.example.com:9200'
- result.datasource.user == ''
- not result.datasource.withCredentials
- result.datasource.jsonData.nonSecureTest == 'nonsecure'
- result.datasource.secureJsonFields is not defined
- result.diff.after.secureJsonData is not defined
- assert:
that:
- result.changed
- result.datasource.basicAuth
- result.datasource.basicAuthUser == 'grafana'
- result.datasource.access == 'proxy'
- result.datasource.database == '[logstash_]YYYY.MM.DD'
- not result.datasource.isDefault
- result.datasource.jsonData.esVersion == 56
- result.datasource.jsonData.interval == 'Daily'
- result.datasource.jsonData.maxConcurrentShardRequests == 42
- result.datasource.jsonData.timeField == '@timestamp'
- not result.datasource.jsonData.tlsAuth
- not result.datasource.jsonData.tlsAuthWithCACert
- result.datasource.name == 'datasource-elastic'
- result.datasource.orgId == 1
- result.datasource.password == ''
- result.datasource.type == 'elasticsearch'
- result.datasource.url == 'https://elastic.example.com:9200'
- result.datasource.user == ''
- not result.datasource.withCredentials
- result.datasource.jsonData.nonSecureTest == 'nonsecure'

- name: update elasticsearch datasource (including secureJsonData)
register: result
grafana_datasource:
name: datasource-elastic
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: elasticsearch
ds_url: https://elastic.example.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
enforce_secure_data: true
additional_json_data:
nonSecureTest: "nonsecure"
additional_secure_json_data:
secureTest: "secure"
- name: update elasticsearch datasource (including secureJsonData)
register: result
grafana_datasource:
name: datasource-elastic
grafana_url: "{{ grafana_url }}"
grafana_user: "{{ grafana_username }}"
grafana_password: "{{ grafana_password }}"
org_id: '1'
ds_type: elasticsearch
ds_url: https://elastic.example.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
enforce_secure_data: true
additional_json_data:
nonSecureTest: "nonsecure"
additional_secure_json_data:
secureTest: "secure"

- debug:
var: result
- debug:
var: result

- assert:
that:
- result.changed
- result.datasource.basicAuth
- result.datasource.basicAuthUser == 'grafana'
- result.datasource.access == 'proxy'
- result.datasource.database == '[logstash_]YYYY.MM.DD'
- not result.datasource.isDefault
- result.datasource.jsonData.esVersion == 56
- result.datasource.jsonData.interval == 'Daily'
- result.datasource.jsonData.maxConcurrentShardRequests == 42
- result.datasource.jsonData.timeField == '@timestamp'
- not result.datasource.jsonData.tlsAuth
- not result.datasource.jsonData.tlsAuthWithCACert
- result.datasource.name == 'datasource-elastic'
- result.datasource.orgId == 1
- result.datasource.password == ''
- result.datasource.type == 'elasticsearch'
- result.datasource.url == 'https://elastic.example.com:9200'
- result.datasource.user == ''
- not result.datasource.withCredentials
- result.datasource.jsonData.nonSecureTest == 'nonsecure'
- result.datasource.secureJsonFields.secureTest == true
- result.diff.after.secureJsonData is defined
- assert:
that:
- result.changed
- result.datasource.basicAuth
- result.datasource.basicAuthUser == 'grafana'
- result.datasource.access == 'proxy'
- result.datasource.database == '[logstash_]YYYY.MM.DD'
- not result.datasource.isDefault
- result.datasource.jsonData.esVersion == 56
- result.datasource.jsonData.interval == 'Daily'
- result.datasource.jsonData.maxConcurrentShardRequests == 42
- result.datasource.jsonData.timeField == '@timestamp'
- not result.datasource.jsonData.tlsAuth
- not result.datasource.jsonData.tlsAuthWithCACert
- result.datasource.name == 'datasource-elastic'
- result.datasource.orgId == 1
- result.datasource.password == ''
- result.datasource.type == 'elasticsearch'
- result.datasource.url == 'https://elastic.example.com:9200'
- result.datasource.user == ''
- not result.datasource.withCredentials
- result.datasource.jsonData.nonSecureTest == 'nonsecure'
- result.datasource.secureJsonFields.secureTest == true
- result.diff.after.secureJsonData is defined

- name: Delete elasticsearch datasource
register: result
Expand Down

0 comments on commit 8644da8

Please sign in to comment.