Skip to content

Commit 4f47c9b

Browse files
committed
build: remove conditional compilation flags
1 parent bdb85ab commit 4f47c9b

7 files changed

Lines changed: 12 additions & 26 deletions

File tree

test/e2e-runner/src/common.rs

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

3-
#[cfg(any(target_os = "linux", target_os = "windows"))]
43
pub mod config;
5-
#[cfg(target_os = "windows")]
64
pub mod exec;
7-
#[cfg(any(target_os = "linux", target_os = "windows"))]
85
pub mod file;
96
pub mod fleet_control_api;
10-
#[cfg(any(target_os = "linux", target_os = "windows"))]
117
pub mod logs;
12-
#[cfg(any(target_os = "linux", target_os = "windows"))]
138
pub mod nrql;
14-
#[cfg(any(target_os = "linux", target_os = "windows"))]
159
pub mod on_drop;
1610
pub mod test;
1711

@@ -103,18 +97,15 @@ pub struct FleetControlApiArgs {
10397
}
10498

10599
/// Data to set up installation
106-
#[cfg(any(target_os = "linux", target_os = "windows"))]
107100
pub struct RecipeData {
108101
pub args: InstallationArgs,
109102
pub fleet_id: String,
110103
pub fleet_enabled: bool,
111104
pub recipe_list: String,
112105
pub proxy_url: String,
113-
#[cfg(target_os = "linux")]
114106
pub monitoring_source: String,
115107
}
116108

117-
#[cfg(any(target_os = "linux", target_os = "windows"))]
118109
impl Default for RecipeData {
119110
fn default() -> Self {
120111
Self {
@@ -123,7 +114,6 @@ impl Default for RecipeData {
123114
proxy_url: Default::default(),
124115
fleet_enabled: false,
125116
recipe_list: "agent-control".to_string(),
126-
#[cfg(target_os = "linux")]
127117
monitoring_source: "infra-agent".to_string(),
128118
}
129119
}

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ pub fn update_config(config_path: impl AsRef<str>, new_content: impl AsRef<str>)
3737
write(config_path, updated_content);
3838
}
3939

40-
#[cfg(target_os = "windows")]
4140
/// Updates the agent control agents config in `config_path` to the specified in `new_content`
4241
pub fn modify_agents_config(
4342
config_path: impl AsRef<str>,
@@ -79,7 +78,6 @@ log:
7978
formatter: pretty
8079
"#;
8180

82-
#[cfg(target_os = "linux")]
8381
/// Modifies the agent-control configuration file to enable debug logging and write logs to a file.
8482
pub fn update_config_for_debug_logging(config_path: &str) {
8583
update_config(config_path, DEBUG_LOGGING_CONFIG)

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ use std::fs::OpenOptions;
22
use std::io::Write;
33
use std::path::Path;
44

5-
#[cfg(target_os = "windows")]
65
use crate::common::test::TestResult;
76

87
/// Writes contents to a file and ensures data is flushed to disk before returning.
@@ -34,7 +33,6 @@ pub fn write<P: AsRef<Path>, C: AsRef<[u8]>>(path: P, contents: C) {
3433
});
3534
}
3635

37-
#[cfg(target_os = "windows")]
3836
/// Removes the directories receives as list
3937
pub fn remove_dirs(dirs: &[&str]) -> TestResult<()> {
4038
dirs.iter()

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ pub struct FinishedTestResponse {
3737
triggered_test_count: usize,
3838
debug_run: bool,
3939
passed_count: usize,
40-
failed_count: usize,
41-
inconclusive_count: usize,
40+
pub(crate) failed_count: usize,
41+
pub(crate) inconclusive_count: usize,
4242
ignored_count: usize,
4343
passed_tests: TestSuitesReport,
4444
failed_tests: TestSuitesReport,

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::common::config::{DEBUG_LOGGING_CONFIG, update_config};
2-
use crate::common::fleet_control_api;
32
use crate::common::on_drop::CleanUp;
3+
use crate::common::{FleetControlArgs, fleet_control_api};
44
use crate::common::{InstallationArgs, RecipeData};
55
use crate::linux;
66
use crate::linux::install::{install_agent_control_from_recipe, tear_down_test};

test/e2e-runner/src/main.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
mod common;
2-
#[cfg(target_os = "linux")]
32
mod linux;
4-
#[cfg(target_os = "macos")]
53
mod macos;
6-
#[cfg(target_os = "windows")]
74
mod windows;
85

96
use crate::common::{FleetControlApiArgs, InstallationArgs};
@@ -12,11 +9,14 @@ use std::process;
129
use tracing_subscriber::EnvFilter;
1310

1411
fn main() {
15-
cfg_select! {
16-
target_os = "windows" => windows::run_windows_e2e(),
17-
target_os = "linux" => linux::run_linux_e2e(),
18-
target_os = "macos" => macos::run_macos_e2e(),
19-
_ => panic!("Unsupported OS -- only Linux, Windows, and macOS are supported")
12+
if cfg!(target_os = "windows") {
13+
windows::run_windows_e2e()
14+
} else if cfg!(target_os = "linux") {
15+
linux::run_linux_e2e()
16+
} else if cfg!(target_os = "macos") {
17+
macos::run_macos_e2e()
18+
} else {
19+
panic!("Unsupported OS -- only Linux, Windows, and macOS are supported")
2020
}
2121
process::exit(0);
2222
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::common::config::{DEBUG_LOGGING_CONFIG, update_config};
2-
use crate::common::fleet_control_api;
32
use crate::common::on_drop::CleanUp;
3+
use crate::common::{FleetControlArgs, fleet_control_api};
44
use crate::common::{InstallationArgs, RecipeData};
55
use crate::windows;
66
use crate::windows::install::{install_agent_control_from_recipe, tear_down_test};

0 commit comments

Comments
 (0)