Skip to content

Commit 14b3007

Browse files
committed
refactor: remove LXD-specific IP retrieval from e2e tests
Remove get_instance_ip method and related code that used LXD client to retrieve instance IP addresses. The e2e tests now rely solely on OpenTofu outputs for IP retrieval, making them provider-agnostic and compatible with future infrastructure providers beyond LXD.
1 parent 8094641 commit 14b3007

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed

src/bin/e2e_tests.rs

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,10 @@ impl TestEnvironment {
157157
.map_err(anyhow::Error::from)
158158
.context("Failed to provision infrastructure")?;
159159

160-
// Get the instance IP from LXD client (keeping for comparison/validation)
161-
let lxd_instance_ip = self
162-
.get_instance_ip()
163-
.context("Failed to get instance IP from LXD client")?;
164-
165160
info!(
166161
stage = "infrastructure_provisioning",
167162
status = "complete",
168163
opentofu_ip = %opentofu_instance_ip,
169-
lxd_ip = %lxd_instance_ip,
170164
"Infrastructure provisioned successfully"
171165
);
172166

@@ -196,25 +190,6 @@ impl TestEnvironment {
196190

197191
Ok(())
198192
}
199-
fn get_instance_ip(&self) -> Result<IpAddr> {
200-
// For E2E tests, we should rely on OpenTofu outputs since they already wait for network
201-
// This is a secondary validation that the instance is accessible via LXD
202-
203-
// First, check if the instance exists
204-
let instance = self
205-
.services
206-
.lxd_client
207-
.get_instance_by_name("torrust-vm")
208-
.context("Failed to query LXD for instance information")?
209-
.ok_or_else(|| anyhow::anyhow!("Instance 'torrust-vm' was not found in LXD"))?;
210-
211-
// Then, check if the instance has an IP address
212-
let ip = instance.ip_address.ok_or_else(|| {
213-
anyhow::anyhow!("Instance 'torrust-vm' exists but has no IPv4 address assigned")
214-
})?;
215-
216-
Ok(ip)
217-
}
218193

219194
fn cleanup(&self) {
220195
if self.config.keep_env {

0 commit comments

Comments
 (0)