Skip to content

Commit

Permalink
Remove some leftovers from removed map code.
Browse files Browse the repository at this point in the history
  • Loading branch information
pphaneuf committed May 26, 2021
1 parent 997f2c7 commit bbf209b
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions integration/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,89 +271,6 @@ EOF
echo "${create_output}" | grep '"name":' > /dev/null
}

# map_prep_test prepares a set of running processes for a Trillian map test.
# Parameters:
# - number of map servers to run
# Env:
# - If TEST_MYSQL_URI is set, uses that for the server --mysql_uri flag.
# Populates:
# - RPC_SERVER_1 : first RPC server
# - RPC_SERVERS : RPC target, either comma-separated list of RPC addresses or etcd service
# - RPC_SERVER_PIDS : bash array of RPC server pids
map_prep_test() {
# Default to one map server.
local rpc_server_count=${1:-1}

# Wipe the test database
yes | bash "${TRILLIAN_PATH}/scripts/resetdb.sh"

local mapserver_opts=''
if [[ "${TEST_MYSQL_URI}" != "" ]]; then
mapserver_opts+=" --mysql_uri=${TEST_MYSQL_URI}"
fi

# Start a set of Map RPC servers.
for ((i=0; i < rpc_server_count; i++)); do
port=$(pick_unused_port)
RPC_SERVERS="${RPC_SERVERS},localhost:${port}"
http=$(pick_unused_port ${port})

echo "Starting Map RPC server on localhost:${port}, HTTP on localhost:${http}"
go run ${GOFLAGS} github.com/google/trillian/cmd/trillian_map_server \
${mapserver_opts} \
--rpc_endpoint="localhost:${port}" \
--http_endpoint="localhost:${http}" \
--single_transaction=true \
--alsologtostderr \
&
pid=$!
RPC_SERVER_PIDS+=(${pid})
wait_for_server_startup ${port}

# Use the first Map server as the Admin server (any would do)
if [[ $i -eq 0 ]]; then
RPC_SERVER_1="localhost:${port}"
fi
done
RPC_SERVERS="${RPC_SERVERS:1}"
}

# map_stop_tests closes down a set of running processes for a map test.
# Assumes the following variables are set:
# - RPC_SERVER_PIDS : bash array of RPC server pids
map_stop_test() {
echo "Stopping Map RPC servers (pids ${RPC_SERVER_PIDS[@]}"
kill_pid ${RPC_SERVER_PIDS[@]}
}

# map_provision creates new Trillian maps
# Parameters:
# - location of admin server instance
# - number of maps to provision (default: 1)
# Populates:
# - MAP_IDS: comma-separated list of tree IDs for provisioned maps
map_provision() {
local admin_server="$1"
local count=${2:-1}

echo 'Running createtree'
for ((i=0; i < count; i++)); do
local map_id=$(go run ${GOFLAGS} github.com/google/trillian/cmd/createtree \
--logtostderr \
--admin_server="${admin_server}" \
--tree_type=MAP \
--hash_strategy=TEST_MAP_HASHER \
--pem_key_path=${TRILLIAN_PATH}/testdata/map-rpc-server.privkey.pem \
--pem_key_password=towel)
echo "Created map ${tree_id}"
if [[ $i -eq 0 ]]; then
MAP_IDS="${map_id}"
else
MAP_IDS="${MAP_IDS},${map_id}"
fi
done
}

# on_exit will clean up anything in ${TO_KILL} and ${TO_DELETE}.
on_exit() {
local pids=
Expand Down

0 comments on commit bbf209b

Please sign in to comment.