Skip to content

Commit

Permalink
fixup: simplify upgrade test
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Sep 24, 2023
1 parent c60bb86 commit 69c93f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 54 deletions.
34 changes: 0 additions & 34 deletions test/test-manager/api-addrs.txt

This file was deleted.

9 changes: 0 additions & 9 deletions test/test-manager/generate-api-endpoints.sh

This file was deleted.

16 changes: 5 additions & 11 deletions test/test-manager/src/tests/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,23 +43,15 @@ pub async fn test_install_previous_app(_: TestContext, rpc: ServiceClient) -> Re

/// Upgrade to the "version under test". This test fails if:
///
/// * Outgoing traffic whose destination is not one of the bridge
/// relays or the API is detected during the upgrade.
/// * Leaks (TCP/UDP/ICMP) to a single public IP address are
/// successfully produced during the upgrade.
/// * Leaks (TCP/UDP/ICMP) to a single public IP address are successfully produced during the
/// upgrade.
/// * The installer does not successfully complete.
/// * The VPN service is not running after the upgrade.
#[test_function(priority = -190)]
pub async fn test_upgrade_app(
ctx: TestContext,
rpc: ServiceClient,
) -> Result<(), Error> {
// Parse api-addrs.txt
const API_ADDRS: Lazy<Vec<IpAddr>> = Lazy::new(|| {
const API_ADDRS: &str = std::include_str!("../../api-addrs.txt");
API_ADDRS.split('\n').map(|addr| addr.parse().unwrap()).collect()
});

let inet_destination: SocketAddr = "1.1.1.1:1337".parse().unwrap();
let bind_addr: SocketAddr = "0.0.0.0:0".parse().unwrap();

Expand Down Expand Up @@ -115,7 +107,9 @@ pub async fn test_upgrade_app(

let monitor = start_packet_monitor(
move |packet| {
packet.source.ip() == guest_ip && !API_ADDRS.contains(&packet.destination.ip())
// NOTE: Many packets will likely be observed for API traffic. Rather than filtering all
// of those specifically, simply fail if our probes are observed.
packet.source.ip() == guest_ip && packet.destination.ip() == inet_destination.ip()
},
MonitorOptions::default(),
)
Expand Down

0 comments on commit 69c93f9

Please sign in to comment.