Skip to content

Commit 1d2dc4f

Browse files
test: add infra-agent onhost e2e (#1829)
1 parent 29a08a7 commit 1d2dc4f

File tree

3 files changed

+79
-2
lines changed

3 files changed

+79
-2
lines changed

.github/workflows/component_onhost_e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ on:
1919
description: 'JSON array of test scenarios to run'
2020
required: false
2121
type: string
22-
default: '["migration.yaml", "remote_config.yaml", "ebpf_agent.yaml"]'
22+
default: '["migration.yaml", "remote_config.yaml", "ebpf_agent.yaml", "infra_agent.yaml"]'
2323

2424
permissions:
2525
contents: read

test/ac-ansible-roles/install_ac_recipe/tasks/debian.yaml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,14 @@
6565
delay: 30
6666
until: "'TLS handshake timeout' not in install_logs.stderr"
6767

68-
- name: Install logs
68+
- name: Install stdout
6969
debug:
7070
var: install_logs.stdout_lines
7171

72+
- name: Install stderr
73+
debug:
74+
var: install_logs.stderr_lines
75+
7276
- name: Check expected installed version
7377
shell: /usr/bin/newrelic-agent-control --version | grep -q "{{ agent_control_version }}"
7478
...
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
---
2+
- name: Test Infra Agent
3+
hosts: 127.0.0.1
4+
connection: local
5+
become: true
6+
gather_facts: yes
7+
8+
tasks:
9+
- name: Test Infra Agent
10+
block:
11+
- name: Cleanup
12+
include_tasks: ./tasks/clean_all.yaml
13+
14+
- name: Install Agent Control
15+
include_role:
16+
name: install_ac_recipe
17+
vars:
18+
recipe_list: "agent-control"
19+
monitoring_source: "infra-agent"
20+
fleet_enabled: "false"
21+
22+
- name: Setup AC config
23+
include_role:
24+
name: edit_yaml_config
25+
vars:
26+
config_path: "/etc/newrelic-agent-control/config.yaml"
27+
update_config:
28+
log:
29+
format:
30+
formatter: pretty
31+
target: true
32+
level: debug
33+
34+
- name: Set test identifier
35+
set_fact:
36+
test_id: "onhost-e2e-infra-agent_{{ lookup('pipe', 'date +%Y-%m-%d_%H-%M-%S') }}"
37+
38+
- name: Add infra agent test_id attribute
39+
shell: echo 'NRIA_CUSTOM_ATTRIBUTES='\''{"label.test_id":"{{ test_id }}"}'\''' >> {{ agent_control_service_conf }}
40+
41+
- name: Restart Agent Control
42+
include_role:
43+
name: caos.ansible_roles.service_status
44+
vars:
45+
service_name: "newrelic-agent-control"
46+
action: "restart"
47+
48+
- name: Assert that infra agent is reporting
49+
include_role:
50+
name: nrql_api_request
51+
apply:
52+
become: false
53+
vars:
54+
nrql_query: >-
55+
SELECT *
56+
FROM SystemSample
57+
WHERE `label.test_id` = '{{ test_id }}'
58+
LIMIT 1
59+
# This was taking about 5m when the test was created
60+
retries: 120
61+
delay: 10
62+
63+
always:
64+
- name: AC logs
65+
shell: journalctl -u newrelic-agent-control --no-pager
66+
register: ac_logs
67+
68+
- name: Debug AC logs
69+
debug:
70+
var: ac_logs.stdout_lines
71+
72+
- name: Cleanup
73+
include_tasks: ./tasks/clean_all.yaml

0 commit comments

Comments
 (0)