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

Commit

Permalink
integration tests in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
senia-psm committed Feb 5, 2024
1 parent 3b679db commit 5b7e0c4
Show file tree
Hide file tree
Showing 11 changed files with 31 additions and 5 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,15 @@ jobs:
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy -- -Dwarnings
- name: Build
run: cargo build
- name: Tests
run: cargo test --all-features
env:
GOLEM_DOCKER_SERVICES: true
GOLEM_TEST_TEMPLATES: ./test-templates
RUST_LOG: info
CI: true
run: cargo test
publish:
needs: [ build ]
if: "startsWith(github.ref, 'refs/tags/v')"
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ tracing-subscriber = "0.3.18"

[dev-dependencies]
env_logger = "0.11.1"
libtest-mimic = {path = "../libtest-mimic"}
libtest-mimic = { git = "https://github.com/senia-psm/libtest-mimic.git", branch = "async_and_context_tests" }
log = "0.4.20"
postgres = "0.19.7"
redis = "0.24.0"
Expand Down
8 changes: 8 additions & 0 deletions scripts/build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -uo pipefail

script_full_path=$(dirname "$0")

cd "${script_full_path}"/.. || exit

cargo build
9 changes: 9 additions & 0 deletions scripts/it.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash
set -uo pipefail

script_full_path=$(dirname "$0")

cd "${script_full_path}"/.. || exit

./scripts/build-all.sh
GOLEM_DOCKER_SERVICES=true GOLEM_TEST_TEMPLATES="./test-templates" RUST_LOG=info cargo test
Binary file added test-templates/environment-service.wasm
Binary file not shown.
Binary file added test-templates/interruption.wasm
Binary file not shown.
Binary file added test-templates/write-stdout.wasm
Binary file not shown.
4 changes: 3 additions & 1 deletion tests/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ impl EnvConfig {
on_ci: std::env::var("CI").is_ok(),
quiet: std::env::var("QUIET").is_ok(),
redis_key_prefix: std::env::var("REDIS_KEY_PREFIX").unwrap_or("".to_string()),
wasi_root: PathBuf::from("../test-templates"),
wasi_root: PathBuf::from(
std::env::var("GOLEM_TEST_TEMPLATES").unwrap_or("../test-templates".to_string()),
),
local_golem: std::env::var("GOLEM_DOCKER_SERVICES").is_err(),
}
}
Expand Down
1 change: 0 additions & 1 deletion tests/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ mod template;
mod worker;

fn run(context: &Context<'_>) -> Conclusion {
println!("Hello, world!");
let args = Arguments::from_args();

let context = Arc::new(context.info());
Expand Down
2 changes: 1 addition & 1 deletion tests/worker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use std::sync::Arc;
use std::time::Duration;

fn make(suffix: &str, name: &str, cli: CliLive, context: Arc<ContextInfo>) -> Vec<Trial> {
let ctx = (context.clone(), name.to_string(), cli);
let ctx = (context, name.to_string(), cli);
vec![
Trial::test_in_context(
format!("worker_new_instance{suffix}"),
Expand Down

0 comments on commit 5b7e0c4

Please sign in to comment.