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 9b1a5c2
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 4 deletions.
8 changes: 7 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,14 @@ 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
run: cargo test
publish:
needs: [ build ]
if: "startsWith(github.ref, 'refs/tags/v')"
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.
2 changes: 1 addition & 1 deletion tests/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ 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 9b1a5c2

Please sign in to comment.