Skip to content

Commit 6e6c511

Browse files
committed
fix: remove obsolete wait-cloud-init argument from E2E test commands
- Update GitHub Actions workflow to use correct E2E test command format - Fix documentation in README.md, copilot-instructions.md, and main.rs - E2E tests now run all playbooks without requiring specific arguments - Resolve clippy linting errors in test files for code quality The E2E tests have evolved to run a complete deployment workflow instead of individual playbooks, making the wait-cloud-init argument obsolete and causing command failures.
1 parent db1fb29 commit 6e6c511

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,6 @@ This is a deployment infrastructure proof-of-concept for the Torrust ecosystem.
3535
- **Build**: `cargo build`
3636
- **Test**: `cargo test`
3737
- **Lint**: `cargo run --bin linter all` (mandatory before commits)
38-
- **E2E**: `cargo run --bin e2e-tests wait-cloud-init`
38+
- **E2E**: `cargo run --bin e2e-tests`
3939

4040
Follow the project conventions and ensure all checks pass.

.github/workflows/test-e2e.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ jobs:
4848
run: |
4949
cargo build --bin e2e-tests --release
5050
51-
- name: Run wait-cloud-init E2E test
51+
- name: Run E2E test
5252
run: |
5353
# Run the E2E test with verbose output for better debugging
5454
# Use sudo -E and preserve PATH to ensure cargo is accessible
55-
sudo -E env "PATH=$PATH" cargo run --bin e2e-tests -- wait-cloud-init --verbose
55+
sudo -E env "PATH=$PATH" cargo run --bin e2e-tests -- --verbose
5656
env:
5757
# Preserve environment variables for the E2E test
5858
RUST_LOG: debug

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,14 +115,14 @@ cargo run --bin linter shellcheck # Shell script linting
115115
Use the E2E tests binary to run automated infrastructure tests:
116116

117117
```bash
118-
# Run the wait-cloud-init test
119-
cargo run --bin e2e-tests -- wait-cloud-init
118+
# Run the E2E tests
119+
cargo run --bin e2e-tests
120120

121121
# Keep the test environment after completion
122-
cargo run --bin e2e-tests -- wait-cloud-init --keep
122+
cargo run --bin e2e-tests -- --keep
123123

124124
# Run with verbose output
125-
cargo run --bin e2e-tests -- wait-cloud-init --verbose
125+
cargo run --bin e2e-tests -- --verbose
126126

127127
# See all available options
128128
cargo run --bin e2e-tests -- --help

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ fn main() {
1414
println!();
1515
println!("🧪 Running E2E Tests:");
1616
println!(" Use the e2e-tests binary to run end-to-end tests:");
17-
println!(" cargo run --bin e2e-tests -- wait-cloud-init");
17+
println!(" cargo run --bin e2e-tests");
1818
println!();
1919
println!("📖 For detailed instructions, see: README.md");
2020
}

tests/template_integration.rs

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -46,41 +46,41 @@ mod integration_tests {
4646
// Verify the output file exists and has the right content
4747
assert!(output_path.exists());
4848

49-
let content = std::fs::read_to_string(&output_path)?;
49+
let file_content = std::fs::read_to_string(&output_path)?;
5050

5151
// Verify variables were substituted
52-
assert!(content.contains("ansible_host: 192.168.1.100"));
53-
assert!(content.contains("ansible_ssh_private_key_file: /home/user/.ssh/testing_rsa"));
52+
assert!(file_content.contains("ansible_host: 192.168.1.100"));
53+
assert!(file_content.contains("ansible_ssh_private_key_file: /home/user/.ssh/testing_rsa"));
5454

5555
// Verify no template variables remain
56-
assert!(!content.contains("{{ansible_host}}"));
57-
assert!(!content.contains("{{ansible_ssh_private_key_file}}"));
56+
assert!(!file_content.contains("{{ansible_host}}"));
57+
assert!(!file_content.contains("{{ansible_ssh_private_key_file}}"));
5858

5959
// Verify it's valid YAML structure
60-
assert!(content.contains("all:"));
61-
assert!(content.contains("torrust-vm:"));
62-
assert!(content.contains("ansible_user: torrust"));
60+
assert!(file_content.contains("all:"));
61+
assert!(file_content.contains("torrust-vm:"));
62+
assert!(file_content.contains("ansible_user: torrust"));
6363

6464
println!("✅ Real inventory template rendered successfully");
6565
Ok(())
6666
}
6767

6868
/// Test variable validation with real template
6969
#[test]
70-
fn test_real_template_variable_validation() -> Result<()> {
70+
fn test_real_template_variable_validation() {
7171
let template_path = PathBuf::from("templates/ansible/inventory.yml.tera");
7272

7373
// Skip test if template file doesn't exist
7474
if !template_path.exists() {
7575
println!("Skipping test: inventory template not found");
76-
return Ok(());
76+
return;
7777
}
7878

7979
// Test that missing variables are caught during construction
8080
let result = InventoryTemplate::new(
8181
template_path.clone(),
82-
"".to_string(), // Empty IP should still work for construction
83-
"".to_string(), // Empty SSH key should still work for construction
82+
String::new(), // Empty IP should still work for construction
83+
String::new(), // Empty SSH key should still work for construction
8484
);
8585

8686
// Construction should succeed even with empty values
@@ -96,8 +96,6 @@ mod integration_tests {
9696

9797
assert!(result.is_err());
9898
println!("✅ Invalid template path correctly rejected");
99-
100-
Ok(())
10199
}
102100

103101
/// Test that template rendering doesn't modify any files in the templates directory
@@ -175,8 +173,8 @@ mod integration_tests {
175173

176174
// Verify output in build directory
177175
assert!(output_path.exists());
178-
let content = std::fs::read_to_string(&output_path)?;
179-
assert!(content.contains("10.0.0.100"));
176+
let file_content = std::fs::read_to_string(&output_path)?;
177+
assert!(file_content.contains("10.0.0.100"));
180178
}
181179

182180
println!("✅ Build directory workflow completed successfully");

0 commit comments

Comments
 (0)