From f6d29a234f6b6c46aa4ac4db41b23d37dfaae37c Mon Sep 17 00:00:00 2001 From: Zeeshan Lakhani Date: Sat, 7 Oct 2023 22:22:48 -0400 Subject: [PATCH] chore: .. --- .github/workflows/builds.yml | 5 +++++ homestar-runtime/Cargo.toml | 1 - homestar-runtime/tests/cli.rs | 14 +++++++------- homestar-runtime/tests/fixtures/test_v4.toml | 4 ++++ homestar-runtime/tests/metrics.rs | 4 ++-- 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 69f33b707..54a955367 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -35,6 +35,7 @@ jobs: bin: homestar name: homestar-FreeBSD-x86_64.tar.gz command: build + rustflags: "-Ctarget-feature=+crt-static" - os_name: Linux-x86_64 os: ubuntu-20.04 @@ -42,6 +43,7 @@ jobs: bin: homestar name: homestar-Linux-x86_64-musl.tar.gz command: both + rustflags: "" - os_name: Linux-aarch64 os: ubuntu-20.04 @@ -49,6 +51,7 @@ jobs: bin: homestar name: homestar-Linux-aarch64-musl.tar.gz command: both + rustflags: "-Ctarget-feature=+crt-static" - release_for: Windows-x86_64 os: windows-latest @@ -99,6 +102,8 @@ jobs: - name: Build Binary uses: houseabsolute/actions-rust-cross@v0 + env: + RUSTFLAGS: ${{ matrix.platform.rustflags }} with: command: ${{ matrix.platform.command }} target: ${{ matrix.platform.target }} diff --git a/homestar-runtime/Cargo.toml b/homestar-runtime/Cargo.toml index 775eafda0..21783eacb 100644 --- a/homestar-runtime/Cargo.toml +++ b/homestar-runtime/Cargo.toml @@ -23,7 +23,6 @@ autotests = false path = "src/lib.rs" bench = false doctest = true -crate-type = ["cdylib", "rlib"] [[bin]] name = "homestar" diff --git a/homestar-runtime/tests/cli.rs b/homestar-runtime/tests/cli.rs index 76c7f20f4..7c6ec441e 100644 --- a/homestar-runtime/tests/cli.rs +++ b/homestar-runtime/tests/cli.rs @@ -5,7 +5,7 @@ use anyhow::Result; use assert_cmd::prelude::*; use once_cell::sync::Lazy; use predicates::prelude::*; -use retry::{delay::Fixed, retry}; +use retry::{delay::Exponential, retry}; use serial_test::file_serial; use std::{ net::{IpAddr, Ipv4Addr, Ipv6Addr, Shutdown, SocketAddr, TcpStream}, @@ -144,7 +144,7 @@ fn test_server_serial() -> Result<()> { .unwrap(); let socket = SocketAddr::new(IpAddr::V6(Ipv6Addr::LOCALHOST), 9991); - let result = retry(Fixed::from_millis(1000).take(10), || { + let result = retry(Exponential::from_millis(1000).take(10), || { TcpStream::connect(socket).map(|stream| stream.shutdown(Shutdown::Both)) }); @@ -212,7 +212,7 @@ fn test_workflow_run_serial() -> Result<()> { .unwrap(); let socket = SocketAddr::new(IpAddr::V6(Ipv6Addr::LOCALHOST), 3030); - let result = retry(Fixed::from_millis(1000).take(30), || { + let result = retry(Exponential::from_millis(1000).take(30), || { TcpStream::connect(socket).map(|stream| stream.shutdown(Shutdown::Both)) }); @@ -289,7 +289,7 @@ fn test_daemon_serial() -> Result<()> { .success(); let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9997); - let result = retry(Fixed::from_millis(1000).take(10), || { + let result = retry(Exponential::from_millis(1000).take(10), || { TcpStream::connect(socket).map(|stream| stream.shutdown(Shutdown::Both)) }); @@ -332,7 +332,7 @@ fn test_signal_kill_serial() -> Result<()> { .unwrap(); let socket = SocketAddr::new(IpAddr::V6(Ipv6Addr::LOCALHOST), 3030); - let result = retry(Fixed::from_millis(1000).take(10), || { + let result = retry(Exponential::from_millis(1000).take(10), || { TcpStream::connect(socket).map(|stream| stream.shutdown(Shutdown::Both)) }); @@ -386,7 +386,7 @@ fn test_server_v4_serial() -> Result<()> { .unwrap(); let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9999); - let result = retry(Fixed::from_millis(1000).take(30), || { + let result = retry(Exponential::from_millis(1000).take(30), || { TcpStream::connect(socket).map(|stream| stream.shutdown(Shutdown::Both)) }); @@ -443,7 +443,7 @@ fn test_daemon_v4_serial() -> Result<()> { .success(); let socket = SocketAddr::new(IpAddr::V4(Ipv4Addr::LOCALHOST), 9999); - let result = retry(Fixed::from_millis(1000).take(30), || { + let result = retry(Exponential::from_millis(1000).take(30), || { TcpStream::connect(socket).map(|stream| stream.shutdown(Shutdown::Both)) }); diff --git a/homestar-runtime/tests/fixtures/test_v4.toml b/homestar-runtime/tests/fixtures/test_v4.toml index 37bdce126..f4536b6cd 100644 --- a/homestar-runtime/tests/fixtures/test_v4.toml +++ b/homestar-runtime/tests/fixtures/test_v4.toml @@ -1,3 +1,7 @@ +[monitoring] +process_collector_interval = 500 +metrics_port = 4010 + [node] [node.network] diff --git a/homestar-runtime/tests/metrics.rs b/homestar-runtime/tests/metrics.rs index 889b5dc11..17b031b50 100644 --- a/homestar-runtime/tests/metrics.rs +++ b/homestar-runtime/tests/metrics.rs @@ -2,7 +2,7 @@ use crate::utils::{stop_homestar, BIN_NAME}; use anyhow::Result; use once_cell::sync::Lazy; use reqwest::StatusCode; -use retry::{delay::Fixed, retry, OperationResult}; +use retry::{delay::Exponential, retry, OperationResult}; use serial_test::file_serial; use std::{ net::{IpAddr, Ipv4Addr, Shutdown, SocketAddr, TcpStream}, @@ -20,7 +20,7 @@ const METRICS_URL: &str = "http://localhost:4004"; fn test_metrics_serial() -> Result<()> { fn sample_metrics() -> prometheus_parse::Value { let body = retry( - Fixed::from_millis(1000).take(10), + Exponential::from_millis(1000).take(10), || match reqwest::blocking::get(METRICS_URL) { Ok(response) => match response.status() { StatusCode::OK => OperationResult::Ok(response.text()),