Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker Service for runtime tests #2193

Merged
merged 7 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
184 changes: 46 additions & 138 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ test-crate:

.PHONY: test-integration
test-integration:
cargo test -F e2e-tests -- runtime_tests --nocapture; \
$(LOG_LEVEL_VAR) cargo test --test integration --no-fail-fast -- --skip spinup_tests --skip cloud_tests --nocapture

.PHONY: test-spin-up
Expand Down
4 changes: 2 additions & 2 deletions crates/outbound-mysql/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ doctest = false
anyhow = "1.0"
flate2 = "1.0.17"
# Removing default features for mysql_async to remove flate2/zlib feature
mysql_async = { version = "0.32.2", default-features = false, features = [
mysql_async = { version = "0.33.0", default-features = false, features = [
"native-tls-tls",
] }
# Removing default features for mysql_common to remove flate2/zlib feature
mysql_common = { version = "0.30.6", default-features = false }
mysql_common = { version = "0.31.0", default-features = false }
spin-app = { path = "../app" }
spin-core = { path = "../core" }
spin-outbound-networking = { path = "../outbound-networking" }
Expand Down
18 changes: 12 additions & 6 deletions crates/outbound-pg/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,20 @@ impl OutboundPg {
let Ok(config) = address.parse::<tokio_postgres::Config>() else {
return false;
};
for host in config.get_hosts() {
for (i, host) in config.get_hosts().iter().enumerate() {
match host {
tokio_postgres::config::Host::Tcp(address) => {
if !spin_outbound_networking::check_url(
address,
"postgres",
&self.allowed_hosts,
) {
let ports = config.get_ports();
// The port we use is either:
// * The port at the same index as the host
// * The first port if there is only one port
let port =
ports
.get(i)
.or_else(|| if ports.len() == 1 { ports.get(1) } else { None });
let port_str = port.map(|p| format!(":{}", p)).unwrap_or_default();
let url = format!("{address}{port_str}");
if !spin_outbound_networking::check_url(&url, "postgres", &self.allowed_hosts) {
return false;
}
}
Expand Down
2 changes: 0 additions & 2 deletions e2e-tests.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ RUN printf '#!/bin/bash
cargo build --release \n \
fi \n\n \
cargo test spinup_tests --features e2e-tests --no-fail-fast -- --nocapture \n \
# Run the runtime tests which will supersede many e2e tests in the future \n \
cargo test -F e2e-tests -- runtime_tests --nocapture \n \
' > /usr/local/bin/entrypoint.sh

RUN chmod +x /usr/local/bin/entrypoint.sh
Expand Down
Loading