Skip to content

Commit

Permalink
Debugging input_from_url test
Browse files Browse the repository at this point in the history
  • Loading branch information
andyleiserson committed Dec 20, 2024
1 parent fc61e53 commit 6fcaa4c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 204 deletions.
200 changes: 1 addition & 199 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,203 +48,5 @@ jobs:
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Check formatting
run: cargo fmt --all -- --check --config "imports_granularity=Crate,group_imports=StdExternalCrate"

- name: Clippy
if: ${{ success() || failure() }}
run: cargo clippy --features "cli test-fixture" --tests

- name: Clippy concurrency tests
if: ${{ success() || failure() }}
run: cargo clippy --tests --features shuttle

- name: Clippy web
if: ${{ success() || failure() }}
run: cargo clippy --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate"

- name: Build
if: ${{ success() || failure() }}
run: cargo build --tests

- name: Run tests
run: cargo test --features "cli test-fixture relaxed-dp"

- name: Run tests with multithreading feature enabled
run: cargo test --features "multi-threading"

- name: Run Web Tests
run: cargo test -p ipa-core --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate"

release:
name: Release builds and tests
runs-on: ubuntu-latest
env:
RUSTFLAGS: -C target-cpu=native
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rm

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Release Build
run: cargo build --release

- name: Build concurrency tests
run: cargo build --release --features "shuttle multi-threading"

- name: Run concurrency tests
run: cargo test --release --features "shuttle multi-threading"

extra:
name: Additional Builds and Concurrency Tests
env:
RUSTFLAGS: -D warnings -C target-cpu=native

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rm

- uses: dtolnay/rust-toolchain@stable
with:
components: clippy,rustfmt

- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Build benchmarks
run: cargo build --benches --no-default-features --features "enable-benches compact-gate"

- name: Build concurrency tests (debug mode)
run: cargo build --features shuttle

- name: Run IPA bench
run: cargo bench --bench oneshot_ipa --no-default-features --features "enable-benches compact-gate"

- name: Run arithmetic bench
run: cargo bench --bench oneshot_arithmetic --no-default-features --features "enable-benches compact-gate"

- name: Run compact gate tests for HTTP stack
run: cargo test --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate"

- name: Run in-memory compact gate tests
run: cargo test --features "compact-gate"
slow:
name: Slow tests
env:
EXEC_SLOW_TESTS: 1
RUSTFLAGS: -C target-cpu=native

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rm
- uses: dtolnay/rust-toolchain@stable
- uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml') }}

- name: Slow Unit Tests
run: cargo test -p ipa-core --lib -- mpc_proptest semi_honest_with_dp_slow gen_binomial_noise_16_breakdowns

- name: Integration Tests - Compact Gate
run: cargo test --release --test "compact_gate" --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate"

- name: Integration Tests - Helper Networks
run: cargo test --release --test "helper_networks" --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate"

- name: Integration Tests - Hybrid
run: cargo test --release --test "hybrid" --no-default-features --features "cli compact-gate web-app real-world-infra test-fixture relaxed-dp"

- name: Integration Tests - IPA with Relaxed DP
run: cargo test --release --test "ipa_with_relaxed_dp" --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate relaxed-dp"

# sanitizers currently require nightly https://github.com/rust-lang/rust/issues/39699
sanitize:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sanitizer: [address, leak]
features: ['', 'multi-threading']
env:
TARGET: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rm
- uses: dtolnay/rust-toolchain@nightly
- name: Add Rust sources
run: rustup component add rust-src
- name: Run tests with sanitizer
run: RUSTFLAGS="-Z sanitizer=${{ matrix.sanitizer }} -Z sanitizer-memory-track-origins" cargo test -Z build-std -p ipa-core --all-targets --target $TARGET --no-default-features --features "cli web-app real-world-infra test-fixture compact-gate ${{ matrix.features }}"

miri:
runs-on: ubuntu-latest
env:
TARGET: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/rm
- uses: dtolnay/rust-toolchain@nightly
- name: Add Miri
run: rustup component add miri
- name: Setup Miri
run: cargo miri setup
- name: Run seq_join tests
run: cargo miri test --target $TARGET --lib seq_join --features "multi-threading"

coverage:
name: Measure coverage
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false
- uses: ./.github/actions/rm

- name: Install rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools

- name: Install cargo-llvm-cov
run: cargo install cargo-llvm-cov

- name: Measure coverage
run: ./scripts/coverage-ci --lcov --output-path ipa.cov

- name: Report to codecov.io
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ipa.cov
fail_ci_if_error: false
run: cargo test -p ipa-core --features "cli test-fixture relaxed-dp" -- input_from_url --nocapture
2 changes: 1 addition & 1 deletion ipa-core/src/net/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub enum Error {
status: hyper::StatusCode,
reason: String,
},
#[error("Failed to connect to {dest}: {inner}")]
#[error("Failed to connect to {dest}: {inner:?}")]
ConnectError {
dest: String,
#[source]
Expand Down
13 changes: 9 additions & 4 deletions ipa-core/src/net/server/handlers/query/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,13 @@ mod tests {
#[tokio::test(flavor = "multi_thread")]
async fn input_from_url() {
const QUERY_ID: QueryId = QueryId;
const DATA: &str = "input records";
const DATA: &str = "<input records>";

let server = tiny_http::Server::http("localhost:0").unwrap();
let addr = server.server_addr();
thread::spawn(move || {
let request = server.recv().unwrap();
println!("request url: {}, secure = {}", request.url(), request.secure());
let response = tiny_http::Response::from_string(DATA);
request.respond(response).unwrap();
});
Expand All @@ -113,8 +114,12 @@ mod tests {
panic!("unexpected call");
};

let body_bytes = body.try_collect::<BytesMut>().await.unwrap();

assert_eq!(addr.query_id, Some(QUERY_ID));
assert_eq!(body.try_collect::<BytesMut>().await.unwrap(), DATA);
assert_eq!(body_bytes, DATA);

println!("query input: {}", std::str::from_utf8(&body_bytes).unwrap());

Ok(HelperResponse::ok())
});
Expand All @@ -124,9 +129,8 @@ mod tests {
.await;

let url = format!(
"http://localhost:{}{}/{QUERY_ID}/input",
"http://localhost:{}/input-data",
addr.to_ip().unwrap().port(),
http_serde::query::BASE_AXUM_PATH,
);
let req = http_serde::query::input::Request::new(QueryInput::FromUrl {
query_id: QUERY_ID,
Expand All @@ -137,6 +141,7 @@ mod tests {
.unwrap();

let resp = test_server.server.handle_req(hyper_req).await;
println!("{resp:?}");
if !resp.status().is_success() {
let (head, body) = resp.into_parts();
let body_bytes = body.collect().await.unwrap().to_bytes();
Expand Down

0 comments on commit 6fcaa4c

Please sign in to comment.