Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from wacker-dev/test
Browse files Browse the repository at this point in the history
Add integration tests
  • Loading branch information
iawia002 authored May 14, 2024
2 parents 06cb2ae + 18eb91d commit f0991c4
Show file tree
Hide file tree
Showing 35 changed files with 11,910 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,12 @@ jobs:
run: cargo fmt --all -- --check
- name: cargo clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Install wasmtime
uses: bytecodealliance/actions/wasmtime/setup@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
version: "v20.0.0"
- name: cargo test
run: cargo test
run: |
cargo install cargo-component@0.11.0
cargo test
22 changes: 22 additions & 0 deletions tests/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
use anyhow::Result;
use std::process::Command;

#[test]
fn main() -> Result<()> {
let status = Command::new("cargo")
.current_dir("tests/program")
.arg("component")
.arg("build")
.arg("--quiet")
.status()?;
assert!(status.success());

let status = Command::new("wasmtime")
.arg("-S")
.arg("http")
.arg("tests/program/target/wasm32-wasi/debug/wasi_http_client_test_program.wasm")
.status()?;
assert!(status.success());

Ok(())
}
26 changes: 26 additions & 0 deletions tests/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[package]
name = "wasi-http-client-test-program"
version = "0.0.0"
edition = "2021"
publish = false

[lib]
crate-type = ["cdylib"]

[package.metadata.component]
package = "component:wasi-http-client-test-program"

[package.metadata.component.dependencies]

[package.metadata.component.target.dependencies]
"wasi:cli" = { path = "wit/deps/cli" }
"wasi:io" = { path = "wit/deps/io" }
"wasi:clocks" = { path = "wit/deps/clocks" }
"wasi:filesystem" = { path = "wit/deps/filesystem" }
"wasi:sockets" = { path = "wit/deps/sockets" }
"wasi:random" = { path = "wit/deps/random" }

[dependencies]
wasi-http-client = { path = "../../../wasi-http-client" }

wit-bindgen-rt = { version = "0.24.0", features = ["bitflags"] }
Loading

0 comments on commit f0991c4

Please sign in to comment.