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

Remove always false condition in test CI #5095

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
13 changes: 12 additions & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -733,6 +733,11 @@ jobs:
- uses: goto-bus-stop/setup-zig@v2
with:
version: 0.10.0
- name: Install Tools
if: matrix.build == 'linux-musl' || matrix.build == 'linux-x64'
run: |
sudo apt-get update
sudo apt-get install -y git llvm clang make lld curl
- name: Set up base deps on musl
if: matrix.build == 'linux-musl'
run: ./scripts/alpine-linux-install-deps.sh
Expand Down Expand Up @@ -846,10 +851,16 @@ jobs:
shell: bash
run: |
make untar-wasmer
- name: "Install cargo-wasix"
run: |
cargo install cargo-wasix
- name: "Download Toolchain"
run: |
cargo wasix download-toolchain
- name: Test integration CLI
if: false # matrix.build != 'macos-arm'
shell: bash
run: |
rustup toolchain list -v
export WASMER_PATH=`pwd`/target/${{ matrix.target }}/release/wasmer${{ matrix.exe }}
export WASMER_DIR=`pwd`/package && make test-integration-cli-ci
env:
Expand Down
27 changes: 26 additions & 1 deletion tests/integration/cli/tests/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ fn wasmer_deploy_js() -> anyhow::Result<()> {

#[test]
fn wasmer_deploy_fails_no_app_name() -> anyhow::Result<()> {
let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").ok();

let username = "ciuser";

let php_app_dir = project_root()
Expand Down Expand Up @@ -230,6 +232,14 @@ fn wasmer_deploy_fails_no_app_name() -> anyhow::Result<()> {
.arg(format!("--dir={}", app_dir.display()))
.arg("--registry=wasmer.wtf");

if let Some(token) = wapm_dev_token {
// Special case: GitHub secrets aren't visible to outside collaborators
if token.is_empty() {
return Ok(());
}
cmd.arg("--token").arg(token);
}

cmd.assert().failure().stderr(predicates::str::contains(
"The app.yaml does not specify any app name.",
));
Expand All @@ -239,6 +249,8 @@ fn wasmer_deploy_fails_no_app_name() -> anyhow::Result<()> {

#[test]
fn wasmer_deploy_fails_no_owner() -> anyhow::Result<()> {
let wapm_dev_token = std::env::var("WAPM_DEV_TOKEN").ok();

let app_name = format!("ci-{}", rand::random::<u32>());

let php_app_dir = project_root()
Expand Down Expand Up @@ -268,6 +280,14 @@ fn wasmer_deploy_fails_no_owner() -> anyhow::Result<()> {
.arg(format!("--dir={}", app_dir.display()))
.arg("--registry=wasmer.wtf");

if let Some(token) = wapm_dev_token {
// Special case: GitHub secrets aren't visible to outside collaborators
if token.is_empty() {
return Ok(());
}
cmd.arg("--token").arg(token);
}

cmd.assert()
.failure()
.stderr(predicates::str::contains("No owner specified"));
Expand Down Expand Up @@ -305,7 +325,12 @@ fn wasmer_deploy_axum() -> anyhow::Result<()> {
std::env::set_current_dir(&app_dir)?;

let mut cmd = std::process::Command::new("cargo");
cmd.arg("wasix").arg("build").output()?;
let output = cmd.arg("wasix").arg("build").output()?;
println!(
"cargo wasix:\nstdout: {:?}\nstderr: {:?}",
String::from_utf8(output.stdout).unwrap(),
String::from_utf8(output.stderr).unwrap()
);

let mut cmd = std::process::Command::new(get_wasmer_path());
cmd.arg("deploy")
Expand Down
4 changes: 1 addition & 3 deletions tests/integration/cli/tests/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,5 @@ fn run_whoami_works() {
.assert()
.success();

assert.stdout(
"logged into registry \"https://registry.wasmer.wtf/graphql\" as user \"ciuser\"\n",
);
assert.stdout("Logged into registry wasmer.wtf as user ciuser\n");
}
19 changes: 13 additions & 6 deletions tests/integration/cli/tests/packages/axum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[workspace]

[package]
name = "wasix-axum"
version = "0.1.0"
Expand All @@ -10,11 +12,16 @@ tracing = "0.1.37"
tracing-subscriber = { version = "0.3.16", features = ["fmt"] }

# NOTE: We need to pin and replace some dependencies to achieve wasix compatibility.
tokio = { version = "=1.24.2", default-features = false, features = ["full"] }
parking_lot = { version = "=0.12.1", features = ["nightly"] }
tokio = { version = "=1.35.1", default-features = false, features = ["full"] }
parking_lot = { version = "=0.12.3", features = ["nightly"] }
parking_lot_core = { version = "=0.9.10", features = ["nightly"] }
libc = { version = "=0.2.152" }

[patch.crates-io]
tokio = { git = "https://github.com/wasix-org/tokio.git", branch = "wasix-1.24.2" }
socket2 = { git = "https://github.com/wasix-org/socket2.git", branch = "v0.4.9" }
libc = { git = "https://github.com/wasix-org/libc.git", branch = "master" }
parking_lot = { git = "https://github.com/wasix-org/parking_lot", branch = "master" }
tokio = { git = "https://github.com/wasix-org/tokio.git", branch = "wasix-1.35.1" }
socket2 = { git = "https://github.com/wasix-org/socket2.git", branch = "v0.5.5" }
libc = { git = "https://github.com/wasix-org/libc.git", branch = "v0.2.152" }

[patch."https://github.com/wasix-org/parking_lot.git"]
parking_lot = { git = "https://github.com/Amanieu/parking_lot", branch = "master" }
parking_lot_core = { git = "https://github.com/Amanieu/parking_lot", branch = "master" }
4 changes: 3 additions & 1 deletion tests/integration/cli/tests/publish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,9 @@ fn wasmer_publish_and_run() {

let assert = std::process::Command::new(get_wasmer_path())
.arg("run")
.arg(format!("https://wasmer.wtf/{package_name}"))
.arg(format!("{package_name}"))
.arg("--registry")
.arg("https://registry.wasmer.wtf/graphql")
.arg("--")
.arg("--eval")
.arg("console.log('Hello, World!')")
Expand Down
25 changes: 15 additions & 10 deletions tests/integration/cli/tests/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use predicates::str::contains;
use rand::Rng;
use reqwest::{blocking::Client, IntoUrl};
use tempfile::TempDir;
use tokio::io::{AsyncBufReadExt, BufReader};
use wasmer_integration_tests_cli::{
asset_path,
fixtures::{self, packages, php, resources},
Expand Down Expand Up @@ -70,11 +71,18 @@ async fn aio_http() {
.arg("run")
.arg("aio-http-hello-world.webc")
.arg("--net")
.stdout(Stdio::null())
.stdout(Stdio::piped())
.spawn()
.unwrap();

tokio::time::sleep(std::time::Duration::from_secs(5)).await;
let mut stdout = BufReader::new(wasmer.stdout.as_mut().unwrap());
let mut line = String::new();
loop {
stdout.read_line(&mut line).await.unwrap();
if line.contains("Running on http://localhost:34343") {
break;
}
}

let rsp = reqwest::Client::new()
.get("http://localhost:34343")
Expand Down Expand Up @@ -430,8 +438,7 @@ fn run_test_caching_works_for_packages() {

assert
.success()
.stderr(contains("wapm_source: Querying the GraphQL API"))
.stderr(contains("builtin_loader: Downloading a webc file"))
.stderr(contains("builtin_loader: webc_package_download_start"))
.stderr(contains("module_cache::filesystem: Saved to disk"));

let assert = Command::new(get_wasmer_path())
Expand All @@ -445,7 +452,6 @@ fn run_test_caching_works_for_packages() {
.success();

assert
.stderr(contains("wapm_source: Cache hit!"))
.stderr(contains("builtin_loader: Cache hit!"))
.stderr(contains("module_cache::filesystem: Cache hit!"));
}
Expand All @@ -466,8 +472,7 @@ fn run_test_caching_works_for_packages_with_versions() {

assert
.success()
.stderr(contains("wapm_source: Querying the GraphQL API"))
.stderr(contains("builtin_loader: Downloading a webc file"))
.stderr(contains("builtin_loader: webc_package_download_start"))
.stderr(contains("module_cache::filesystem: Saved to disk"));

let assert = Command::new(get_wasmer_path())
Expand All @@ -481,7 +486,6 @@ fn run_test_caching_works_for_packages_with_versions() {

assert
.success()
.stderr(contains("wapm_source: Cache hit!"))
.stderr(contains("builtin_loader: Cache hit!"))
.stderr(contains("module_cache::filesystem: Cache hit!"));
}
Expand All @@ -502,7 +506,7 @@ fn run_test_caching_works_for_urls() {

assert
.success()
.stderr(contains("builtin_loader: Downloading a webc file"))
.stderr(contains("builtin_loader: webc_package_download_start"))
.stderr(contains("module_cache::filesystem: Saved to disk"));

let assert = Command::new(get_wasmer_path())
Expand All @@ -520,7 +524,7 @@ fn run_test_caching_works_for_urls() {
.stderr(contains("web_source: Cache hit"))
// Cache hit downloading the *.webc file
.stderr(contains(
r#"builtin_loader: Cache hit! pkg.name="python" pkg.version=0.1.0"#,
r#"builtin_loader: Cache hit! pkg=sha256:2cf6475ffcfd338775f8eae82af79380927cbce5e4d9d810d53fdb30ef997b19"#,
))
// Cache hit compiling the module
.stderr(contains("module_cache::filesystem: Cache hit!"));
Expand Down Expand Up @@ -758,6 +762,7 @@ fn wasi_runner_on_disk_with_env_vars() {
all(target_env = "musl", target_os = "linux"),
ignore = "wasmer run-unstable segfaults on musl"
)]
#[ignore = "wcgi runner is broken and hangs after the first request"]
fn wcgi_runner_on_disk() {
// Start the WCGI server in the background
let port = random_port();
Expand Down
Loading