Skip to content

Commit accb3b0

Browse files
committed
style: gate logic on its used platforms
1 parent fe2d85f commit accb3b0

File tree

7 files changed

+21
-11
lines changed

7 files changed

+21
-11
lines changed

test/e2e-runner/src/common.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
use std::path::PathBuf;
22

3+
#[cfg(any(target_os = "linux", target_os = "windows"))]
34
pub mod config;
5+
#[cfg(target_os = "windows")]
46
pub mod exec;
7+
#[cfg(any(target_os = "linux", target_os = "windows"))]
58
pub mod file;
69
pub mod fleet_control_api;
10+
#[cfg(any(target_os = "linux", target_os = "windows"))]
711
pub mod logs;
12+
#[cfg(any(target_os = "linux", target_os = "windows"))]
813
pub mod nrql;
14+
#[cfg(any(target_os = "linux", target_os = "windows"))]
915
pub mod on_drop;
1016
pub mod test;
1117

@@ -93,6 +99,7 @@ pub struct FleetControlApiArgs {
9399
}
94100

95101
/// Data to set up installation
102+
#[cfg(any(target_os = "linux", target_os = "windows"))]
96103
pub struct RecipeData {
97104
pub args: InstallationArgs,
98105
pub fleet_id: String,
@@ -102,6 +109,7 @@ pub struct RecipeData {
102109
pub monitoring_source: String,
103110
}
104111

112+
#[cfg(any(target_os = "linux", target_os = "windows"))]
105113
impl Default for RecipeData {
106114
fn default() -> Self {
107115
Self {

test/e2e-runner/src/common/config.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
use crate::common::file::write;
2-
use serde_yaml::Value;
31
use std::{fs, io::Write, path::PathBuf};
2+
3+
use serde_yaml::Value;
44
use tracing::info;
55

6+
use crate::common::file::write;
7+
68
/// Updates the agent control config in `config_path` to include the content specified in `new_content`
79
pub fn update_config(config_path: impl AsRef<str>, new_content: impl AsRef<str>) {
810
let config_path = config_path.as_ref();
@@ -35,6 +37,7 @@ pub fn update_config(config_path: impl AsRef<str>, new_content: impl AsRef<str>)
3537
write(config_path, updated_content);
3638
}
3739

40+
#[cfg(target_os = "windows")]
3841
/// Updates the agent control agents config in `config_path` to the specified in `new_content`
3942
pub fn modify_agents_config(
4043
config_path: impl AsRef<str>,

test/e2e-runner/src/common/exec.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ impl LongRunningProcess {
7676
.clone()
7777
}
7878
}
79+
7980
impl Drop for LongRunningProcess {
8081
fn drop(&mut self) {
8182
#[cfg(target_family = "windows")]

test/e2e-runner/src/common/on_drop.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,15 @@
22
pub struct CleanUp<F: FnOnce()> {
33
action: Option<F>,
44
}
5+
56
impl<F: FnOnce()> CleanUp<F> {
67
pub fn new(action: F) -> Self {
78
Self {
89
action: Some(action),
910
}
1011
}
1112
}
13+
1214
impl<F: FnOnce()> Drop for CleanUp<F> {
1315
fn drop(&mut self) {
1416
if let Some(action) = self.action.take() {

test/e2e-runner/src/linux.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::common::fleet_control_api;
12
use crate::{LinuxCli, LinuxScenarios, init_logging};
23
use clap::Parser;
34

@@ -44,7 +45,7 @@ pub fn run_linux_e2e() {
4445
scenarios::fleet_control::test_fleet_control(args);
4546
}
4647
LinuxScenarios::FleetControlApi(args) => {
47-
scenarios::fleet_control::run_fleet_control_api(args);
48+
fleet_control_api::run_fleet_control_api(args);
4849
}
4950
};
5051
}

test/e2e-runner/src/linux/scenarios/fleet_control.rs

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,6 @@ use crate::linux::install::{install_agent_control_from_recipe, tear_down_test};
77
use std::time::Duration;
88
use tracing::info;
99

10-
/// Runs Fleet Control API interaction (trigger tests and poll for completion).
11-
///
12-
/// This function only handles the Fleet Control API communication and does not
13-
/// install or configure Agent Control. Useful when AC is already deployed externally.
14-
pub fn run_fleet_control_api(args: FleetControlApiArgs) {
15-
fleet_control_api::run_fleet_control_api(args);
16-
}
17-
1810
pub fn test_fleet_control(args: InstallationArgs) {
1911
let fleet_id = args
2012
.fleet_id

test/e2e-runner/src/main.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
mod common;
2+
#[cfg(target_os = "linux")]
23
mod linux;
4+
#[cfg(target_os = "macos")]
35
mod macos;
6+
#[cfg(target_os = "windows")]
47
mod windows;
58

69
use crate::common::{FleetControlApiArgs, InstallationArgs};

0 commit comments

Comments
 (0)