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

Run CI on all platforms #876

Merged
merged 3 commits into from
Feb 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 28 additions & 2 deletions .github/workflows/per-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,20 @@ jobs:
test:
name: Unit Tests
timeout-minutes: 10
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest ]
include:
- os: windows-latest
- os: ubuntu-latest
- os: ubuntu-arm
runsOn: ubuntu-24.04-arm64-2-core
- os: macos-intel
runsOn: macos-13
- os: macos-arm
runsOn: macos-14
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -69,7 +82,20 @@ jobs:
TEMPORAL_CLIENT_CERT: ${{ secrets.TEMPORAL_CLIENT_CERT }}
TEMPORAL_CLIENT_KEY: ${{ secrets.TEMPORAL_CLIENT_KEY }}
timeout-minutes: 20
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, ubuntu-arm, macos-intel, macos-arm, windows-latest ]
include:
- os: windows-latest
- os: ubuntu-latest
- os: ubuntu-arm
runsOn: ubuntu-24.04-arm64-2-core
- os: macos-intel
runsOn: macos-13
- os: macos-arm
runsOn: macos-14
runs-on: ${{ matrix.runsOn || matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
Expand Down
81 changes: 43 additions & 38 deletions tests/integ_tests/ephemeral_server_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use futures_util::stream;
use futures_util::TryStreamExt;
use futures_util::{stream, TryStreamExt};
use std::time::{SystemTime, UNIX_EPOCH};
use temporal_client::{ClientOptionsBuilder, TestService, WorkflowService};
use temporal_sdk_core::ephemeral_server::{
Expand Down Expand Up @@ -29,7 +28,7 @@ async fn temporal_cli_default() {
#[tokio::test]
async fn temporal_cli_fixed() {
let config = TemporalDevServerConfigBuilder::default()
.exe(fixed_cached_download("v0.4.0"))
.exe(fixed_cached_download("v1.2.0"))
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
Expand Down Expand Up @@ -81,43 +80,49 @@ async fn temporal_cli_concurrent_starts() -> Result<(), Box<dyn std::error::Erro
Ok(())
}

#[tokio::test]
async fn test_server_default() {
let config = TestServerConfigBuilder::default()
.exe(default_cached_download())
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
}
// Test server downloads aren't available for arm linux
#[cfg(not(all(target_os = "linux", any(target_arch = "arm", target_arch = "aarch64"))))]
mod test_server {
use super::*;

#[tokio::test]
async fn test_server_fixed() {
let config = TestServerConfigBuilder::default()
.exe(fixed_cached_download("v1.16.0"))
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
}
#[tokio::test]
async fn test_server_default() {
let config = TestServerConfigBuilder::default()
.exe(default_cached_download())
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
}

#[tokio::test]
async fn test_server_shutdown_port_reuse() {
// Start, test shutdown, do again immediately on same port to ensure we can
// reuse after shutdown
let config = TestServerConfigBuilder::default()
.exe(default_cached_download())
.port(Some(10124))
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
#[tokio::test]
async fn test_server_fixed() {
let config = TestServerConfigBuilder::default()
.exe(fixed_cached_download("v1.16.0"))
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
}

#[tokio::test]
async fn test_server_shutdown_port_reuse() {
// Start, test shutdown, do again immediately on same port to ensure we can
// reuse after shutdown
let config = TestServerConfigBuilder::default()
.exe(default_cached_download())
.port(Some(10124))
.build()
.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
let mut server = config.start_server().await.unwrap();
assert_ephemeral_server(&server).await;
server.shutdown().await.unwrap();
}
}

fn fixed_cached_download(version: &str) -> EphemeralExe {
Expand Down
5 changes: 3 additions & 2 deletions tests/integ_tests/metrics_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,7 @@ async fn otel_errors_logged_as_errors() {
let _guard = tracing::subscriber::set_default(subscriber);

let opts = OtelCollectorOptionsBuilder::default()
.url("https://localhostt:9995/v1/metrics".parse().unwrap()) // Invalid endpoint
.url("https://localhost:12345/v1/metrics".parse().unwrap()) // Nothing bound on that port
.build()
.unwrap();
let exporter = build_otlp_metric_exporter(opts).unwrap();
Expand All @@ -1174,7 +1174,8 @@ async fn otel_errors_logged_as_errors() {
let _worker = starter.get_worker().await;

// Wait to allow exporter to attempt sending metrics and fail.
tokio::time::sleep(Duration::from_secs(2)).await;
// Windows takes a while to fail the network attempt for some reason so 5s.
tokio::time::sleep(Duration::from_secs(5)).await;

let logs = logs.lock().unwrap();
let log_str = String::from_utf8_lossy(&logs);
Expand Down
Loading