Skip to content

Commit e462dcd

Browse files
authored
Merge pull request #1252 from Goodnessukaigwe/fix/1218-delete-obsolete-test-fixtures-for-deprecated-reconciliation-paths
[1218] Delete obsolete test fixtures for deprecated reconciliation paths
2 parents 005f431 + a43b4f3 commit e462dcd

6 files changed

Lines changed: 12 additions & 193 deletions

File tree

src/controller/captive_core.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,10 @@ mod tests {
220220
},
221221
soroban_config: Some(SorobanConfig {
222222
stellar_core_url: "http://core:11626".to_string(),
223-
#[allow(deprecated)]
224-
captive_core_config: None,
225223
captive_core_structured_config: Some(captive_config),
226224
enable_preflight: true,
227225
max_events_per_request: 10000,
228-
cache_config: None,
226+
..Default::default()
229227
}),
230228
replicas: 2,
231229
min_available: None,

src/controller/reconciler_test.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,6 @@ VALIDATORS=["VALIDATOR1", "VALIDATOR2"]"#
277277
horizon_config: None,
278278
soroban_config: Some(SorobanConfig {
279279
stellar_core_url: "http://stellar-core:11626".to_string(),
280-
#[allow(deprecated)]
281-
captive_core_config: None,
282280
captive_core_structured_config: Some(CaptiveCoreConfig {
283281
network_passphrase: None,
284282
history_archive_urls: vec![
@@ -292,7 +290,7 @@ VALIDATORS=["VALIDATOR1", "VALIDATOR2"]"#
292290
}),
293291
enable_preflight: true,
294292
max_events_per_request: 10000,
295-
cache_config: None,
293+
..Default::default()
296294
}),
297295
replicas: 3,
298296
min_available: None,
@@ -692,15 +690,15 @@ VALIDATORS=["VALIDATOR1", "VALIDATOR2"]"#
692690
}
693691
}
694692

695-
/// Test that soroban nodes require captive core config
693+
/// Test that soroban nodes require structured captive core config
696694
#[test]
697-
fn test_soroban_captive_core_config_required() {
695+
fn test_soroban_captive_core_structured_config_required() {
698696
let node = create_test_soroban_node("test", "default");
699697

700698
if let Some(soroban_config) = &node.spec.soroban_config {
701699
assert!(
702700
soroban_config.captive_core_structured_config.is_some(),
703-
"Soroban should have captive core config"
701+
"Soroban should have structured captive core config"
704702
);
705703
} else {
706704
panic!("Soroban node should have soroban_config");

src/crd/tests.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,8 +1355,6 @@ mod stellar_node_spec_validation {
13551355

13561356
let config = SorobanConfig {
13571357
stellar_core_url: "http://core:11626".to_string(),
1358-
#[allow(deprecated)]
1359-
captive_core_config: None,
13601358
captive_core_structured_config: Some(CaptiveCoreConfig {
13611359
network_passphrase: Some("Test SDF Network ; September 2015".to_string()),
13621360
history_archive_urls: vec![
@@ -1370,7 +1368,7 @@ mod stellar_node_spec_validation {
13701368
}),
13711369
enable_preflight: true,
13721370
max_events_per_request: 10000,
1373-
cache_config: None,
1371+
..Default::default()
13741372
};
13751373

13761374
// Test JSON serialization

tests/common/fixtures.rs

Lines changed: 4 additions & 177 deletions
Original file line numberDiff line numberDiff line change
@@ -10,146 +10,14 @@
1010
/// test guards in `common/mod.rs`.
1111
///
1212
/// Fixture categories:
13-
/// - `stellarnode_*` — `StellarNodeSpec` and related CRD types
1413
/// - `backup_*` — `BackupVerificationConfig` and `BackupSource`
1514
/// - `rotation_*` — `SecretRotationConfig`
16-
/// - `manifest_*` — raw YAML strings for `kubectl apply` tests
1715
/// - `k8s_*` — Kubernetes API objects (Pods, Containers, VolumeMounts)
18-
/// - `deterministic` — SeededRng, fixed timestamps, deterministic name helpers
19-
use k8s_openapi::api::core::v1::{Container, VolumeMount};
20-
use rand::SeedableRng;
21-
22-
// ---------------------------------------------------------------------------
23-
// Deterministic test utilities (consolidated from tests/fixtures/mod.rs)
24-
// ---------------------------------------------------------------------------
25-
26-
/// Deterministic RNG for tests. Use `SeededRng::seeded(seed)` for reproducible
27-
/// results.
28-
pub struct SeededRng(rand::rngs::SmallRng);
29-
30-
impl SeededRng {
31-
pub fn seeded(seed: u64) -> Self {
32-
Self(rand::rngs::SmallRng::seed_from_u64(seed))
33-
}
34-
35-
pub fn inner(&mut self) -> &mut rand::rngs::SmallRng {
36-
&mut self.0
37-
}
38-
}
39-
40-
/// Fixed "now" timestamp for deterministic time-sensitive tests.
41-
///
42-
/// Returns 2026-01-15T12:00:00Z. Use this instead of `Utc::now()` in tests
43-
/// to avoid flaky time-dependent assertions.
44-
pub fn fixed_now() -> chrono::DateTime<chrono::Utc> {
45-
chrono::DateTime::parse_from_rfc3339("2026-01-15T12:00:00Z")
46-
.unwrap()
47-
.with_timezone(&chrono::Utc)
48-
}
49-
50-
/// Generate a deterministic test namespace name from a seed.
51-
pub fn test_namespace(seed: &str) -> String {
52-
format!("test-{}", seed)
53-
}
54-
55-
/// Generate a deterministic test StellarNode name from a seed.
56-
pub fn test_node_name(seed: &str) -> String {
57-
format!("node-{}", seed)
58-
}
59-
60-
// ---------------------------------------------------------------------------
61-
// StellarNode fixtures
62-
// ---------------------------------------------------------------------------
63-
64-
/// Unique namespace name for an integration test.
65-
///
66-
/// Includes a short random suffix so parallel tests do not collide even when
67-
/// the same test binary runs more than once against the same cluster.
6816
///
69-
/// # Example
70-
/// ```
71-
/// use tests::common::fixtures::unique_namespace;
72-
/// let ns = unique_namespace("backup-test");
73-
/// // "stellar-it-backup-test-a1b2c3d4"
74-
/// ```
75-
pub fn unique_namespace(label: &str) -> String {
76-
// Use thread ID + timestamp for a lightweight unique suffix that works
77-
// without pulling in uuid or rand at the test level.
78-
let ts = std::time::SystemTime::now()
79-
.duration_since(std::time::UNIX_EPOCH)
80-
.map(|d| d.subsec_nanos())
81-
.unwrap_or(0);
82-
format!("stellar-it-{label}-{ts:08x}")
83-
}
84-
85-
/// Minimal valid `StellarNode` YAML for a Testnet Validator.
86-
///
87-
/// Uses `retentionPolicy: Delete` so PVCs are cleaned up automatically and
88-
/// tests do not leave orphaned storage in the cluster.
89-
pub fn testnet_validator_manifest(name: &str, namespace: &str) -> String {
90-
format!(
91-
r#"apiVersion: stellar.org/v1alpha1
92-
kind: StellarNode
93-
metadata:
94-
name: {name}
95-
namespace: {namespace}
96-
labels:
97-
app.kubernetes.io/managed-by: stellar-k8s-integration-test
98-
spec:
99-
nodeType: Validator
100-
network: Testnet
101-
version: "v21.0.0"
102-
storage:
103-
storageClass: standard
104-
size: 10Gi
105-
retentionPolicy: Delete
106-
"#
107-
)
108-
}
109-
110-
/// Minimal valid `StellarNode` YAML for a Testnet Horizon node.
111-
pub fn testnet_horizon_manifest(name: &str, namespace: &str) -> String {
112-
format!(
113-
r#"apiVersion: stellar.org/v1alpha1
114-
kind: StellarNode
115-
metadata:
116-
name: {name}
117-
namespace: {namespace}
118-
labels:
119-
app.kubernetes.io/managed-by: stellar-k8s-integration-test
120-
spec:
121-
nodeType: Horizon
122-
network: Testnet
123-
version: "v2.28.0"
124-
storage:
125-
storageClass: standard
126-
size: 50Gi
127-
retentionPolicy: Delete
128-
"#
129-
)
130-
}
131-
132-
/// Minimal valid `StellarNode` YAML for a Testnet Soroban RPC node.
133-
pub fn testnet_soroban_manifest(name: &str, namespace: &str) -> String {
134-
format!(
135-
r#"apiVersion: stellar.org/v1alpha1
136-
kind: StellarNode
137-
metadata:
138-
name: {name}
139-
namespace: {namespace}
140-
labels:
141-
app.kubernetes.io/managed-by: stellar-k8s-integration-test
142-
spec:
143-
nodeType: SorobanRpc
144-
network: Testnet
145-
version: "v0.0.5"
146-
storage:
147-
storageClass: standard
148-
size: 20Gi
149-
retentionPolicy: Delete
150-
"#
151-
)
152-
}
17+
/// Obsolete StellarNode YAML / deterministic helpers for deprecated
18+
/// reconciliation integration paths were removed in issue #1218 (unused after
19+
/// reconciler tests moved to typed `create_test_*` constructors).
20+
use k8s_openapi::api::core::v1::{Container, VolumeMount};
15321

15422
// ---------------------------------------------------------------------------
15523
// Kubernetes API object fixtures
@@ -270,44 +138,3 @@ pub fn secret_rotation_full() -> stellar_k8s::backup::SecretRotationConfig {
270138
notification_webhook: Some("https://webhook.example.com".to_string()),
271139
}
272140
}
273-
274-
#[cfg(test)]
275-
mod tests {
276-
use super::*;
277-
278-
#[test]
279-
fn seeded_rng_deterministic() {
280-
let mut a = SeededRng::seeded(42);
281-
let mut b = SeededRng::seeded(42);
282-
let va: u64 = rand::Rng::gen(a.inner());
283-
let vb: u64 = rand::Rng::gen(b.inner());
284-
assert_eq!(va, vb);
285-
}
286-
287-
#[test]
288-
fn seeded_rng_different_seeds() {
289-
let mut a = SeededRng::seeded(1);
290-
let mut b = SeededRng::seeded(2);
291-
let va: u64 = rand::Rng::gen(a.inner());
292-
let vb: u64 = rand::Rng::gen(b.inner());
293-
assert_ne!(va, vb);
294-
}
295-
296-
#[test]
297-
fn fixed_now_is_deterministic() {
298-
let t1 = fixed_now();
299-
let t2 = fixed_now();
300-
assert_eq!(t1, t2);
301-
assert_eq!(t1.to_rfc3339(), "2026-01-15T12:00:00+00:00");
302-
}
303-
304-
#[test]
305-
fn test_namespace_format() {
306-
assert_eq!(test_namespace("mytest"), "test-mytest");
307-
}
308-
309-
#[test]
310-
fn test_node_name_format() {
311-
assert_eq!(test_node_name("alpha"), "node-alpha");
312-
}
313-
}

tests/common/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
use std::process::{Command, Stdio};
1717

1818
/// Re-export the fixtures module so integration tests can write
19-
/// `use common::fixtures::testnet_validator_manifest;`
19+
/// `use common::fixtures::init_container;` (and other live helpers).
2020
pub mod fixtures;
2121

2222
// ---------------------------------------------------------------------------

tests/reconciler_fuzz.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,12 +214,10 @@ fn base_soroban_spec() -> StellarNodeSpec {
214214
horizon_config: None,
215215
soroban_config: Some(SorobanConfig {
216216
stellar_core_url: "http://stellar-core:11626".to_string(),
217-
#[allow(deprecated)]
218-
captive_core_config: None,
219217
captive_core_structured_config: None,
220-
cache_config: None,
221218
enable_preflight: true,
222219
max_events_per_request: 10000,
220+
..Default::default()
223221
}),
224222
replicas: 2,
225223
min_available: None,

0 commit comments

Comments
 (0)