Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
zakstucke committed Jun 18, 2024
1 parent ce1e678 commit 24223a1
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 4 deletions.
28 changes: 24 additions & 4 deletions dev_scripts/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
}

Expand Down
5 changes: 5 additions & 0 deletions rust/bitbazaar/redis/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?;
Expand Down

0 comments on commit 24223a1

Please sign in to comment.