Skip to content

Commit

Permalink
[CONSUL-435] Replace docker run in set_ttl_check_state & wait_for_age…
Browse files Browse the repository at this point in the history
…nt_service_register functions (#55)
  • Loading branch information
cocolavayen authored and joselo85 committed Dec 21, 2022
1 parent 45f272e commit 9877322
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions test/integration/connect/envoy/helpers.windows.bash
Original file line number Diff line number Diff line change
Expand Up @@ -610,10 +610,9 @@ function kill_envoy {
local BOOTSTRAP_NAME=$1
local DC=${2:-primary}


PORT=$( cat /c/workdir/$DC/envoy/${BOOTSTRAP_NAME}-bootstrap.json | jq .admin.address.socket_address.port_value )
PID=$( netstat -qo | grep "127.0.0.1:$PORT" | sed -r "s/.* //g" )
KILL=$( tskill $PID )
tskill $PID
}

function must_match_in_statsd_logs {
Expand Down Expand Up @@ -853,7 +852,8 @@ function get_ca_root {
function wait_for_agent_service_register {
local SERVICE_ID=$1
local DC=${2:-primary}
retry_default docker_curl "$DC" -sLf "http://consul-${DC}:8500/v1/agent/service/${SERVICE_ID}" >/dev/null

retry_default docker_consul_exec "$DC" bash -c "curl -sLf 'http://consul-${DC}:8500/v1/agent/service/${SERVICE_ID}' >/dev/null"
}

function set_ttl_check_state {
Expand All @@ -873,7 +873,7 @@ function set_ttl_check_state {
return 1
esac

retry_default docker_curl "${DC}" -sL -XPUT "http://consul-${DC}:8500/v1/agent/check/warn/${CHECK_ID}"
retry_default docker_consul_exec "$DC" bash -c "curl -sL -XPUT 'http://consul-${DC}:8500/v1/agent/check/warn/${CHECK_ID}' >/dev/null"
}

function get_upstream_fortio_name {
Expand Down
12 changes: 7 additions & 5 deletions test/integration/connect/envoy/run-tests.windows.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ function init_workdir {
# don't wipe logs between runs as they are already split and we need them to
# upload as artifacts later.
rm -rf workdir/${CLUSTER}
rm -rf workdir/logs
mkdir -p workdir/${CLUSTER}/{consul,consul-server,register,envoy,bats,statsd,data}

# Reload consul config from defaults
Expand Down Expand Up @@ -451,12 +452,12 @@ function stop_and_copy_files {
# Create CMD file to execute within the container
echo "XCOPY C:\workdir_bak C:\workdir /e /h /c /i /y" > copy.cmd
# Stop dummy container to copy local workdir to container's workdir_bak
docker.exe stop envoy_workdir_1
docker.exe stop envoy_workdir_1 > /dev/null
docker.exe cp workdir/. envoy_workdir_1:/workdir_bak
# Copy CMD file into container
docker.exe cp copy.cmd envoy_workdir_1:/
# Start dummy container and execute the CMD file
docker.exe start envoy_workdir_1
docker.exe start envoy_workdir_1 > /dev/null
docker.exe exec envoy_workdir_1 copy.cmd
# Delete local CMD file after execution
rm copy.cmd
Expand All @@ -470,7 +471,7 @@ function run_tests {

init_vars

# Initialize the workdir
echo "Initialize the workdir"
init_workdir primary

if is_set $REQUIRE_SECONDARY
Expand All @@ -494,12 +495,13 @@ function run_tests {
return 0
fi

# Wipe state
echo "Wipe volumes"
wipe_volumes

# Use this function to populate the shared volume
echo "Copying base files to shared volume"
stop_and_copy_files

echo "Starting Consul primary cluster"
start_consul primary

if is_set $REQUIRE_SECONDARY; then
Expand Down

0 comments on commit 9877322

Please sign in to comment.