Skip to content

Commit

Permalink
Minor cleanups and simplifications (#4096)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobim committed Apr 30, 2024
2 parents a955a5c + 027ceb4 commit bb3377f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion libtenzir/builtins/components/metrics_collector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct metrics_collector_state {
for (const auto* plugin : plugins::get<metrics_plugin>()) {
auto ok = setup(*plugin);
if (not ok) {
return std::move(ok.error());
return ok.error();
}
}
TENZIR_ASSERT(not instances.empty());
Expand Down
1 change: 0 additions & 1 deletion tenzir/integration/data/misc/scripts/csvstat.sh

This file was deleted.

11 changes: 5 additions & 6 deletions tenzir/integration/lib/bats-tenzir/src/fixtures.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# SPDX-License-Identifier: BSD-3-Clause

export_default_paths() {
BATS_TEST_DATADIR="$(realpath $(dirname ${BATS_TEST_DIRNAME}))"
BATS_TEST_DATADIR="$(realpath "$(dirname "${BATS_TEST_DIRNAME}")")"
# Look for the first folder called `integration/` that is a parent
# of the location of the test file.
export BATS_TENZIR_DATADIR="${BATS_TEST_DATADIR%%/integration/*}/data"
Expand All @@ -27,7 +27,8 @@ export_default_node_config() {

bats_tenzir_initialize() {
# Normalize the environment unless `BATS_TENZIR_KEEP_ENVIRONMENT` is set.
if [[ ! -n ${BATS_TENZIR_KEEP_ENVIRONMENT} ]]; then
if [ -z "${BATS_TENZIR_KEEP_ENVIRONMENT}" ]; then
# shellcheck disable=SC2046
unset $(printenv | grep -o '^TENZIR[^=]*' | paste -s -)
fi

Expand All @@ -36,25 +37,23 @@ bats_tenzir_initialize() {
}

setup_node() {
local node_args=$1
# Always enforce bare mode even when using custom config.
export TENZIR_BARE_MODE=true
# Print node config
set | grep -Ee "^TENZIR" || true >&3
# The inner exec is needed so that signals to $NODE_PID actually reach the
# node.
exec {NODE_OUT}< <(exec tenzir-node --print-endpoint ${node_args})
exec {NODE_OUT}< <(exec tenzir-node --print-endpoint "${@}")
NODE_PID=$!
read -r -u "$NODE_OUT" TENZIR_ENDPOINT
export TENZIR_ENDPOINT
}

setup_node_with_plugins() {
local plugins=$1
local node_args=$2
export_default_node_config
export TENZIR_PLUGINS="$plugins"
setup_node ${node_args}
setup_node "${@:1}"
}

# Start a node with a configuration suitable for most integration tests.
Expand Down
2 changes: 1 addition & 1 deletion tenzir/integration/tests/setup_suite.bash
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ fi

libpath_relative_to_binary="$(realpath "$(dirname "$(command -v tenzir)")")/../share/tenzir/integration/lib"
libpath_relative_to_pwd="${BATS_TEST_DIRNAME%%/integration/*}/integration/lib"
export BATS_LIB_PATH=${BATS_LIB_PATH:+${BATS_LIB_PATH}:}${libpath_relative_to_binary}:${libpath_relative_to_pwd}
export BATS_LIB_PATH=${libpath_relative_to_binary}:${libpath_relative_to_pwd}${BATS_LIB_PATH:+:${BATS_LIB_PATH}}
echo ${BATS_LIB_PATH}

0 comments on commit bb3377f

Please sign in to comment.