-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmain.rs
More file actions
143 lines (131 loc) · 5.66 KB
/
Copy pathmain.rs
File metadata and controls
143 lines (131 loc) · 5.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
mod common;
mod linux;
mod macos;
mod windows;
use crate::common::{FleetControlApiArgs, FleetControlInstallationArgs, InstallationArgs};
use clap::Parser;
use std::process;
use tracing_subscriber::EnvFilter;
fn main() {
if cfg!(target_os = "windows") {
windows::run_windows_e2e()
} else if cfg!(target_os = "linux") {
linux::run_linux_e2e()
} else if cfg!(target_os = "macos") {
macos::run_macos_e2e()
} else {
panic!("Unsupported OS -- only Linux, Windows, and macOS are supported")
}
process::exit(0);
}
#[derive(Debug, clap::Subcommand)]
enum LinuxScenarios {
/// Local installation of Agent Control with Infrastructure Agent. It checks that the infra-agent eventually reports data.
InfraAgent(InstallationArgs),
/// Local installation of Agent Control with eBPF agent. Uses the infra agent to generate traffic and checks that
/// the eBPF agent reports data.
EBPFAgent(InstallationArgs),
/// Local installation of Agent Control with NRDot. It checks that nr-dot eventually reports data.
NrdotAgent(InstallationArgs),
/// Local installation of Agent Control with a custom preload agent type. Verifies that the
/// OCI artifact is downloaded and present in the environment.
PreloadAgent(InstallationArgs),
/// Checks that remote configuration for a sub-agent has been applied.
RemoteConfig(InstallationArgs),
/// Checks that the Agent Control proxy support works as expected. It uses mitproxy as a docker service.
Proxy(InstallationArgs),
/// Tests Fleet Control integration by installing Agent Control with fleet configuration and triggering Fleet Control tests.
///
/// This relies on polling certain fixed Fleet Control endpoints, failing if the response is not expected or a timeout is reached.
FleetControl(FleetControlInstallationArgs),
/// Triggers Fleet Control tests via API and polls for completion (without installing Agent Control).
///
/// This is useful when Agent Control is already deployed and you only need to trigger and monitor Fleet Control tests.
/// Requires --fleet-id and --fleet-control-token arguments.
FleetControlApi(FleetControlApiArgs),
}
#[derive(Debug, clap::Subcommand)]
enum WindowsScenarios {
/// Simple installation of Agent Control on Windows with an Infrastructure Agent.
InfraAgent(InstallationArgs),
/// Simple installation of Agent Control on Windows with NRDOT Agent.
Nrdot(InstallationArgs),
Proxy(InstallationArgs),
/// Checks that remote configuration for a sub-agent has been applied on Windows.
RemoteConfig(InstallationArgs),
/// Tests that remote configuration for infra-agent has been applied via fleet management. Includes new version download.
/// Starts with a local-only installation of AC, then updates the installation to include fleet configuration that should
/// trigger a sub-agent update.
SwitchInfraAgentVersion(InstallationArgs),
/// Simple installation of Agent Control on Windows with update to wrong and correct config
/// to test service stop and start.
WrongConfig(InstallationArgs),
/// Tests Fleet Control integration by installing Agent Control with fleet configuration and triggering Fleet Control tests.
///
/// This relies on polling certain fixed Fleet Control endpoints, failing if the response is not expected or a timeout is reached.
FleetControl(FleetControlInstallationArgs),
/// Triggers Fleet Control tests via API and polls for completion (without installing Agent Control).
///
/// This is useful when Agent Control is already deployed and you only need to trigger and monitor Fleet Control tests.
/// Requires --fleet-id and --fleet-control-token arguments.
FleetControlApi(FleetControlApiArgs),
}
#[derive(Parser)]
#[command(
name = "e2e-runner",
about = "E2E Test Runner for newrelic-agent-control on Linux",
long_about = "This tool runs end-to-end tests for newrelic-agent-control on Linux.\n
PREREQUISITES:
- Debian package manager
- Systemctl
- Run as root"
)]
struct LinuxCli {
/// Log level (trace, debug, info, warn, error)
#[arg(short, long, default_value = "info")]
log_level: String,
#[command(subcommand)]
scenario: LinuxScenarios,
}
#[derive(Parser)]
#[command(
name = "e2e-runner",
about = "E2E Test Runner for newrelic-agent-control on Windows",
long_about = "This tool runs end-to-end tests for newrelic-agent-control on Windows.\n
PREREQUISITES:
- Run as Administrator"
)]
struct WindowsCli {
/// Log level (trace, debug, info, warn, error)
#[arg(short, long, default_value = "info")]
log_level: String,
#[command(subcommand)]
scenario: WindowsScenarios,
}
#[derive(Debug, clap::Subcommand)]
enum MacOSScenarios {
/// Triggers Fleet Control tests via API and polls for completion (without installing Agent Control).
///
/// This is useful when Agent Control is already deployed (e.g., in a minikube cluster) and you only need to trigger and monitor Fleet Control tests from macOS.
/// Requires --fleet-id and --fleet-control-token arguments.
FleetControlApi(FleetControlApiArgs),
}
#[derive(Parser)]
#[command(
name = "e2e-runner",
about = "E2E Test Runner for newrelic-agent-control on macOS",
long_about = "This tool runs end-to-end tests for newrelic-agent-control on macOS."
)]
struct MacOSCli {
/// Log level (trace, debug, info, warn, error)
#[arg(short, long, default_value = "info")]
log_level: String,
#[command(subcommand)]
scenario: MacOSScenarios,
}
fn init_logging(level: &str) {
tracing_subscriber::fmt()
.with_target(false)
.with_env_filter(EnvFilter::new(level))
.init();
}