Skip to content

Commit 58b2388

Browse files
committed
Improve our travis tests:
- Testing dry-run - Testing installing agent 5 and 6 - Testing downgrading to agent 5 - Test the role with ansible 2.2 and 2.4
1 parent 6aa56b6 commit 58b2388

File tree

5 files changed

+101
-0
lines changed

5 files changed

+101
-0
lines changed

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,37 @@
22
language: python
33
python: "2.7"
44

5+
env:
6+
matrix:
7+
- AGENT_VERSION=5 ANSIBLE_VERSION=2.2
8+
- AGENT_VERSION=5 ANSIBLE_VERSION=2.4
9+
- AGENT_VERSION=6 ANSIBLE_VERSION=2.2
10+
- AGENT_VERSION=6 ANSIBLE_VERSION=2.4
11+
12+
before_install:
13+
- sudo apt-get install -y software-properties-common
14+
- sudo apt-add-repository -y "ppa:ansible/ansible-${ANSIBLE_VERSION}"
15+
- sudo apt-get update -y
16+
- sudo apt-get install -y ansible
17+
- ansible --version
18+
519
install:
620
- pip install ansible-lint
721

822
script:
923
- ansible-lint -v $(find tests -name *yml) -x ANSIBLE0006,ANSIBLE0010
24+
25+
# testing dry run
26+
- sudo ansible-playbook -i travis_test/inventory/travis.ini "travis_test/install_agent_${AGENT_VERSION}.yaml" --check
27+
- sudo ansible-playbook -i travis_test/inventory/travis.ini "travis_test/downgrade_to_5_debian.yaml" --check
28+
29+
# installing latest version of ${AGENT_VERSION}
30+
- sudo ansible-playbook -i travis_test/inventory/travis.ini "travis_test/install_agent_${AGENT_VERSION}.yaml"
31+
- ps aux | grep -v grep | grep agent
32+
- sleep 3 # let the agent open the API port
33+
- if [ "${AGENT_VERSION}" = "6" ]; then sudo datadog-agent status; else sudo dd-agent info; fi
34+
35+
# downgrading to 5.23.0
36+
- sudo ansible-playbook -i travis_test/inventory/travis.ini "travis_test/downgrade_to_5_debian.yaml"
37+
- ps aux | grep -v grep | grep agent
38+
- sudo dd-agent info
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
---
2+
3+
- hosts: all
4+
roles:
5+
- { role: '/home/travis/build/DataDog/ansible-datadog/'}
6+
vars:
7+
datadog_api_key: "11111111111111111111111111111111"
8+
datadog_agent5: true
9+
datadog_agent_version: 1:5.23.0-1
10+
datadog_agent_allow_downgrade: yes
11+
datadog_config:
12+
tags: "mytag0, mytag1"
13+
log_level: INFO
14+
apm_enabled: "true" # has to be set as a string
15+
datadog_config_ex:
16+
trace.config:
17+
env: dev
18+
trace.concentrator:
19+
extra_aggregators: version
20+
datadog_checks:
21+
process:
22+
init_config:
23+
instances:
24+
- name: agent
25+
search_string: ['agent' ]

travis_test/install_agent_5.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
---
2+
3+
- hosts: all
4+
roles:
5+
- { role: '/home/travis/build/DataDog/ansible-datadog/'}
6+
vars:
7+
datadog_api_key: "11111111111111111111111111111111"
8+
datadog_agent5: true
9+
datadog_config:
10+
tags: "mytag0, mytag1"
11+
log_level: INFO
12+
apm_enabled: "true" # has to be set as a string
13+
datadog_config_ex:
14+
trace.config:
15+
env: dev
16+
trace.concentrator:
17+
extra_aggregators: version
18+
datadog_checks:
19+
process:
20+
init_config:
21+
instances:
22+
- name: agent
23+
search_string: ['agent' ]

travis_test/install_agent_6.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
3+
- hosts: all
4+
roles:
5+
- { role: '/home/travis/build/DataDog/ansible-datadog/'}
6+
vars:
7+
datadog_api_key: "11111111111111111111111111111111"
8+
datadog_config:
9+
tags: "mytag0, mytag1"
10+
log_level: INFO
11+
apm_enabled: "true" # has to be set as a string
12+
datadog_config_ex:
13+
trace.config:
14+
env: dev
15+
trace.concentrator:
16+
extra_aggregators: version
17+
datadog_checks:
18+
process:
19+
init_config:
20+
instances:
21+
- name: agent
22+
search_string: ['agent', 'sshd' ]

travis_test/inventory/travis.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[test]
2+
127.0.0.1 ansible_connection=local

0 commit comments

Comments
 (0)