Skip to content

Commit 69fe052

Browse files
feat(ci/cd): adding a e2e with infra agent
1 parent 8325eef commit 69fe052

File tree

7 files changed

+59
-53
lines changed

7 files changed

+59
-53
lines changed

.github/workflows/component_onhost_e2e.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
run: |
5555
echo "${{ secrets.NR_SYSTEM_IDENTITY_PRIVATE_KEY }}" > /tmp/newrelic-agent-control-priv.key
5656
sudo ${{ github.workspace }}/target/debug/e2e-runner --log-level=debug ${{ matrix.group }} \
57-
--deb-package-dir ./dist \
57+
--artifacts-package-dir ./dist \
5858
--nr-api-key "${{ secrets.E2E_API_KEY }}" \
5959
--nr-license-key "${{ secrets.E2E_LICENSE_KEY }}" \
6060
--nr-account-id "${{ secrets.E2E_ACCOUNT_ID }}" \

test/e2e-runner/Readme.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,10 @@ end
106106
root@vagrant:~# /newrelic-agent-control/target/debug/e2e-runner infra-agent --help
107107
Arguments to be set for every test that needs Agent Control installation
108108

109-
Usage: e2e-runner infra-agent [OPTIONS] --deb-package-dir <DEB_PACKAGE_DIR> --nr-api-key <NR_API_KEY> --nr-license-key <NR_LICENSE_KEY> --nr-account-id <NR_ACCOUNT_ID> --system-identity-client-id <SYSTEM_IDENTITY_CLIENT_ID> --agent-control-private-key <AGENT_CONTROL_PRIVATE_KEY> --agent-control-version <AGENT_CONTROL_VERSION>
109+
Usage: e2e-runner infra-agent [OPTIONS] --artifacts-package-dir <DEB_PACKAGE_DIR> --nr-api-key <NR_API_KEY> --nr-license-key <NR_LICENSE_KEY> --nr-account-id <NR_ACCOUNT_ID> --system-identity-client-id <SYSTEM_IDENTITY_CLIENT_ID> --agent-control-private-key <AGENT_CONTROL_PRIVATE_KEY> --agent-control-version <AGENT_CONTROL_VERSION>
110110

111111
Options:
112-
--deb-package-dir <DEB_PACKAGE_DIR>
112+
--artifacts-package-dir <DEB_PACKAGE_DIR>
113113
Folder where '.deb' packages are stored
114114
--recipes-repo <RECIPES_REPO>
115115
Recipes repository [default: https://github.com/newrelic/open-install-library.git]

test/e2e-runner/src/common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ pub struct Args {
5454
#[arg(long, default_value = "US")]
5555
pub nr_region: String,
5656

57-
#[cfg(target_family = "unix")]
58-
/// Flag to migrate existing infrastructure agent configuration
57+
/// Flag to migrate existing infrastructure agent configuration. Currently used only in Linux.
5958
#[arg(long, default_value = "true")]
6059
pub migrate_config_infra: String,
6160
}
@@ -67,7 +66,6 @@ pub struct RecipeData {
6766
pub fleet_enabled: String,
6867
pub recipe_list: String,
6968
pub proxy_url: String,
70-
#[cfg(target_family = "unix")]
7169
pub monitoring_source: String,
7270
}
7371

@@ -81,6 +79,8 @@ impl Default for RecipeData {
8179
recipe_list: "agent-control".to_string(),
8280
#[cfg(target_family = "unix")]
8381
monitoring_source: "infra-agent".to_string(),
82+
#[cfg(target_family = "windows")]
83+
monitoring_source: "".to_string(),
8484
}
8585
}
8686
}

test/e2e-runner/src/linux.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use crate::{LinuxCli, LinuxScenarios, init_logging, linux};
2+
use clap::Parser;
3+
14
pub mod install;
25
pub mod scenarios;
36

@@ -10,3 +13,31 @@ const DEFAULT_CONFIG_PATH: &str =
1013
const DEFAULT_LOG_PATH: &str = "/var/log/newrelic-agent-control/newrelic-agent-control.log";
1114

1215
const SERVICE_NAME: &str = "newrelic-agent-control";
16+
17+
/// Run Linux e2e corresponding scenario which will panic on failure
18+
pub fn run_linux_e2e() {
19+
let cli = LinuxCli::parse();
20+
init_logging(&cli.log_level);
21+
22+
// Run the requested test
23+
match cli.scenario {
24+
LinuxScenarios::InfraAgent(args) => {
25+
scenarios::infra_agent::test_installation_with_infra_agent(args);
26+
}
27+
LinuxScenarios::EBPFAgent(args) => {
28+
scenarios::ebpf_agent::test_ebpf_agent(args);
29+
}
30+
LinuxScenarios::Migration(args) => {
31+
scenarios::migration::test_migration(args);
32+
}
33+
LinuxScenarios::NrdotAgent(args) => {
34+
scenarios::nrdot_agent::test_nrdot_agent(args);
35+
}
36+
LinuxScenarios::RemoteConfig(args) => {
37+
scenarios::remote_config::test_remote_config_is_applied(args);
38+
}
39+
LinuxScenarios::Proxy(args) => {
40+
scenarios::proxy::test_agent_control_proxy(args);
41+
}
42+
};
43+
}

test/e2e-runner/src/main.rs

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ use tracing_subscriber::EnvFilter;
1010
fn main() {
1111
// Using `cfg!` instead of `#[cfg]` to make development easier
1212
if cfg!(target_os = "windows") {
13-
run_windows_e2e()
13+
windows::run_windows_e2e()
1414
} else if cfg!(target_os = "linux") {
15-
run_linux_e2e()
15+
linux::run_linux_e2e()
1616
} else {
1717
panic!("Unsupported OS -- only Linux and Windows are supported");
1818
}
@@ -81,50 +81,6 @@ struct WindowsCli {
8181
scenario: WindowsScenarios,
8282
}
8383

84-
/// Run Linux e2e corresponding scenario which will panic on failure
85-
fn run_linux_e2e() {
86-
let cli = LinuxCli::parse();
87-
init_logging(&cli.log_level);
88-
89-
// Run the requested test
90-
match cli.scenario {
91-
LinuxScenarios::InfraAgent(args) => {
92-
linux::scenarios::infra_agent::test_installation_with_infra_agent(args);
93-
}
94-
LinuxScenarios::EBPFAgent(args) => {
95-
linux::scenarios::ebpf_agent::test_ebpf_agent(args);
96-
}
97-
LinuxScenarios::Migration(args) => {
98-
linux::scenarios::migration::test_migration(args);
99-
}
100-
LinuxScenarios::NrdotAgent(args) => {
101-
linux::scenarios::nrdot_agent::test_nrdot_agent(args);
102-
}
103-
LinuxScenarios::RemoteConfig(args) => {
104-
linux::scenarios::remote_config::test_remote_config_is_applied(args);
105-
}
106-
LinuxScenarios::Proxy(args) => {
107-
linux::scenarios::proxy::test_agent_control_proxy(args);
108-
}
109-
};
110-
}
111-
112-
/// Run Windows e2e corresponding scenario which will panic on failure
113-
fn run_windows_e2e() {
114-
let cli = WindowsCli::parse();
115-
init_logging(&cli.log_level);
116-
117-
// Run the requested test
118-
match cli.scenario {
119-
WindowsScenarios::Install(args) => {
120-
windows::scenarios::installation::test_installation(args);
121-
}
122-
WindowsScenarios::InfraAgent(args) => {
123-
windows::scenarios::installation_infra_agent::test_infra_agent(args);
124-
}
125-
}
126-
}
127-
12884
fn init_logging(level: &str) {
12985
tracing_subscriber::fmt()
13086
.with_target(false)

test/e2e-runner/src/windows.rs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
use crate::{WindowsCli, WindowsScenarios, init_logging};
2+
use clap::Parser;
3+
14
pub mod install;
25
pub mod scenarios;
36

@@ -14,3 +17,19 @@ const DEFAULT_NR_INFRA_PATH: &str =
1417

1518
const DEFAULT_LOG_PATH: &str =
1619
r"C:\ProgramData\New Relic\newrelic-agent-control\logs\newrelic-agent-control.log";
20+
21+
/// Run Windows e2e corresponding scenario which will panic on failure
22+
pub fn run_windows_e2e() {
23+
let cli = WindowsCli::parse();
24+
init_logging(&cli.log_level);
25+
26+
// Run the requested test
27+
match cli.scenario {
28+
WindowsScenarios::Install(args) => {
29+
scenarios::installation::test_installation(args);
30+
}
31+
WindowsScenarios::InfraAgent(args) => {
32+
scenarios::installation_infra_agent::test_infra_agent(args);
33+
}
34+
}
35+
}

test/e2e-runner/src/windows/scenarios/installation_infra_agent.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::common::config::{add_configs_for_infra_agent_and_logs, update_config};
1+
use crate::common::config::add_configs_for_infra_agent_and_logs;
22
use crate::common::logs::ShowLogsOnDrop;
33
use crate::common::test::retry;
44
use crate::common::{Args, RecipeData, nrql};

0 commit comments

Comments
 (0)