diff --git a/dev_scripts/utils.sh b/dev_scripts/utils.sh index cea1de02..c3b6cf10 100755 --- a/dev_scripts/utils.sh +++ b/dev_scripts/utils.sh @@ -95,7 +95,8 @@ replace_text () { # Make sure redis is up and running: ensure_redis () { # In ci redis should be spun up as needed for tests manually. - if in_ci; then + # (windows also can't run redis, so skip it there too) + if in_ci || is_windows; then return fi @@ -109,13 +110,32 @@ ensure_redis () { } -# Returns "true" if looks like in_ci, "false" otherwise: +# Returns true/0 if looks like in_ci, false/1 otherwise: +# if in_ci; then +# echo "in ci" +# else +# echo "not in ci" +# fi in_ci () { # Check if any of the CI/CD environment variables are set if [ -n "$GITHUB_ACTIONS" ] || [ -n "$TRAVIS" ] || [ -n "$CIRCLECI" ] || [ -n "$GITLAB_CI" ]; then - echo "true" + 0 else - echo "false" + 1 + fi +} + +# Useful for platform matching, can use like: +# if is_windows; then +# echo "windows" +# else +# echo "not windows" +# fi +is_windows() { + if [ "$(expr substr $(uname -s) 1 5)" == "MINGW" ]; then + return 0 # Return true + else + return 1 # Return false fi } diff --git a/rust/bitbazaar/redis/mod.rs b/rust/bitbazaar/redis/mod.rs index f9e32ca4..91bbb692 100644 --- a/rust/bitbazaar/redis/mod.rs +++ b/rust/bitbazaar/redis/mod.rs @@ -77,6 +77,11 @@ mod tests { #[rstest] #[tokio::test] async fn test_redis_working(#[allow(unused_variables)] logging: ()) -> RResult<(), AnyErr> { + // Redis can't be run on windows, skip if so: + if cfg!(windows) { + return Ok(()); + } + let rs = RedisStandalone::new().await?; let work_r = rs.instance()?;