mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 02:44:59 +00:00
squash auth tests into regular smoke tests, improve smoke tests
This is a bit complicated and entangled, sorry. First, we squash the auth-based smoke tests into the regular smoke tests; we just run all the tests with auth on and that way we don't need to spin up an entire separate cluster of machines just to run a single query against them. We improve the error detection, and standardize the jq-to-get-config code. The purpose of this is to try to make sure that, if we actually hit a failure and get "null" for a host name, we report *that* as an error, rather than running ahead and producing 20+ separate reports that ssh failed because it couldn't find a host named null.
This commit is contained in:
parent
3671129cd5
commit
cd6125dfc6
15 changed files with 83 additions and 311 deletions
|
|
@ -1,91 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# To run script: ./setup.sh <BRANCH_NAME>
|
||||
BRANCH_NAME=$1
|
||||
|
||||
echo "Running tests for branch ${BRANCH_NAME}"
|
||||
|
||||
ADMIN_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4ifQ.I1iCgk1VU7m6e-En4ACTHIs6V2dZpy_8j2blSSo7K3U
|
||||
READER_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoicmVhZGVyIn0.QcHy_W6oAYFgdBWy1CqLr55HcOyymn5zAXPJUKCvQE4
|
||||
WRITER_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoid3JpdGVyIn0.aEk-12xP9RJeXog4MHO8LhuQFEjNNG2BcWDcMzSX_HI
|
||||
export TF_IN_AUTOMATION=1
|
||||
export AUTH_ENABLED=1
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
source ./qa/scripts/utilCluster.sh
|
||||
|
||||
pushd ./qa/tf/ci/auth-smoke
|
||||
echo "Running terraform init..."
|
||||
terraform init -input=false
|
||||
echo "Running terraform apply..."
|
||||
terraform apply -input=false -auto-approve
|
||||
terraform output -json > outputs.json
|
||||
popd
|
||||
|
||||
# path for ebs device
|
||||
EBS_DEVICE_NAME=/dev/nvme1n1
|
||||
|
||||
# featurebase architecture
|
||||
FB_BINARY=featurebase_linux_arm64
|
||||
|
||||
# get the first ingest host
|
||||
INGESTNODE0=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.ingest_ips][0]["value"][0]')
|
||||
echo "using INGESTNODE0 ${INGESTNODE0}"
|
||||
|
||||
# get the first data host
|
||||
DATANODE0=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.data_node_ips][0]["value"][0]')
|
||||
echo "using DATANODE0 ${DATANODE0}"
|
||||
|
||||
DEPLOYED_CLUSTER_PREFIX=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.cluster_prefix][0]["value"]')
|
||||
echo "Using DEPLOYED_CLUSTER_PREFIX: ${DEPLOYED_CLUSTER_PREFIX}"
|
||||
|
||||
DEPLOYED_CLUSTER_REPLICA_COUNT=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.fb_cluster_replica_count][0]["value"]')
|
||||
echo "Using DEPLOYED_CLUSTER_REPLICA_COUNT: ${DEPLOYED_CLUSTDEPLOYED_CLUSTER_REPLICA_COUNTER_PREFIX}"
|
||||
|
||||
DEPLOYED_DATA_IPS=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.data_node_ips][0]["value"][]')
|
||||
echo "DEPLOYED_DATA_IPS: {"
|
||||
echo "${DEPLOYED_DATA_IPS}"
|
||||
echo "}"
|
||||
|
||||
DEPLOYED_DATA_IPS_LEN=`echo "$DEPLOYED_DATA_IPS" | wc -l`
|
||||
|
||||
DEPLOYED_INGEST_IPS=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.ingest_ips][0]["value"][]')
|
||||
echo "DEPLOYED_INGEST_IPS: {"
|
||||
echo "${DEPLOYED_INGEST_IPS}"
|
||||
echo "}"
|
||||
|
||||
DEPLOYED_INGEST_IPS_LEN=`echo "$DEPLOYED_INGEST_IPS" | wc -l`
|
||||
|
||||
|
||||
#wait until we can connect to one of the hosts
|
||||
for i in {0..24}
|
||||
do
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 ec2-user@${DATANODE0} "pwd"
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Cluster is up after ${i} tries."
|
||||
break
|
||||
fi
|
||||
sleep 10
|
||||
done
|
||||
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o StrictHostKeyChecking=no -o ConnectTimeout=10 ec2-user@${DATANODE0} "pwd"
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
echo "Unable to connect to cluster - giving up"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
setupClusterNodes $BRANCH_NAME
|
||||
|
||||
# verify featurebase running
|
||||
echo "Verifying featurebase cluster running..."
|
||||
for i in {0..24}; do
|
||||
curl -k -v https://${DATANODE0}:10101/status -H "Authorization: Bearer ${ADMIN_TOKEN}"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Cluster is up after ${i} tries"
|
||||
exit 0
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
exit $?
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# To run script: ./teardown.sh
|
||||
|
||||
cd qa/tf/ci/auth-smoke
|
||||
export TF_IN_AUTOMATION=1
|
||||
terraform destroy -auto-approve
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
source ./qa/scripts/utilCluster.sh
|
||||
|
||||
# get the first ingest host
|
||||
INGESTNODE0=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.ingest_ips][0]["value"][0]')
|
||||
echo "using INGESTNODE0 ${INGESTNODE0}"
|
||||
|
||||
# get the first data host
|
||||
DATANODE0=$(cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '[.data_node_ips][0]["value"][0]')
|
||||
echo "using DATANODE0 ${DATANODE0}"
|
||||
|
||||
HOSTS=($( cat ./qa/tf/ci/auth-smoke/outputs.json | jq -r '.data_node_ips.value' | tr -d '[],"'))
|
||||
|
||||
echo "Copying tests to remote"
|
||||
scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ./qa/scripts/auth-smoke/tests/ ec2-user@${INGESTNODE0}:/data
|
||||
scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ./datagen_linux_arm64 ec2-user@${INGESTNODE0}:/data
|
||||
if (( $? != 0 ))
|
||||
then
|
||||
echo "Copy failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# run all repros
|
||||
echo "Running smoke tests..."
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ec2-user@${INGESTNODE0} "cd /data/tests; ./run-all.sh ${HOSTS[@]}"
|
||||
SMOKETESTRESULT=$?
|
||||
|
||||
|
||||
if (( $SMOKETESTRESULT != 0 ))
|
||||
then
|
||||
echo "smoke tests complete with test failures"
|
||||
else
|
||||
echo "smoke tests complete"
|
||||
fi
|
||||
|
||||
exit $SMOKETESTRESULT
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
adding a test case to the auth-smoke directory??? no problem!!! its a snap!!!
|
||||
|
||||
just make a shell script that does the test you want and name it some thing like:
|
||||
|
||||
fb42069-test.sh
|
||||
|
||||
this will get picked up by run-all.sh and get run automatically!!!
|
||||
|
||||
# THINGS TO NOTE
|
||||
- the datanode0 ip will be passed to your script in $1 via qa/scripts/bug_repro_tests.sh
|
||||
|
||||
# ENTHUSIASM
|
||||
WOW
|
||||
|
||||
shout out to computers for making our lives easier! :) 👍
|
||||
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -eou pipefail
|
||||
|
||||
for file in `ls *-test.sh`; do
|
||||
echo "running $file";
|
||||
./$file "$@"
|
||||
done
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
ifErr() {
|
||||
res=$?
|
||||
if (( res != 0 )); then
|
||||
echo "error: $1"
|
||||
exit $res
|
||||
fi
|
||||
}
|
||||
|
||||
HOSTS=($@)
|
||||
|
||||
for host in ${HOSTS[@]}; do
|
||||
echo $host;
|
||||
done
|
||||
|
||||
HOST=${HOSTS[2]}
|
||||
|
||||
# ingest string key data to user index
|
||||
/data/datagen --source custom --custom-config /data/tests/sup218_datagen.yaml --pilosa.index=user --pilosa.hosts=https://$HOST:10101 --pilosa.batch-size=1000
|
||||
ifErr "running datagen on $HOST"
|
||||
|
||||
# install grpcurl
|
||||
wget https://github.com/fullstorydev/grpcurl/releases/download/v1.8.6/grpcurl_1.8.6_linux_arm64.tar.gz
|
||||
tar -xvf grpcurl_1.8.6_linux_arm64.tar.gz
|
||||
chmod +x grpcurl
|
||||
|
||||
for ip in ${HOSTS[@]}; do
|
||||
# then make a `select distinct test_field from user`
|
||||
./grpcurl -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4ifQ.I1iCgk1VU7m6e-En4ACTHIs6V2dZpy_8j2blSSo7K3U' -d '{"sql": "select * from user limit 1"}' $ip:20101 pilosa.Pilosa.QuerySQL
|
||||
# make sure it doesn't fail
|
||||
ifErr "select * from user failed when it shouldn't have!"
|
||||
done
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
fields:
|
||||
- name: "a_random_string"
|
||||
type: "string" # (default StringField (non-mutex))
|
||||
generator_type: "random-string" # used to generate random strings rather than pulling from known set
|
||||
min_len: 8
|
||||
max_len: 12
|
||||
charset: "AB" # set of possible characters to pull from when generating random string
|
||||
- name: "id"
|
||||
type: "uint"
|
||||
distribution: "sequential"
|
||||
min: 0
|
||||
max: 1000 # 2%24
|
||||
step: 1
|
||||
repeat: false
|
||||
- name: "type"
|
||||
type: "int" # (default IntField)
|
||||
min: 0
|
||||
max: 3
|
||||
distribution: "zipfian"
|
||||
s: 1.1
|
||||
v: 5.1
|
||||
- name: "ts"
|
||||
type: "timestamp"
|
||||
min_date: 2006-01-02T15:04:05.001Z # RFC3339Nano
|
||||
max_date: 2007-01-02T15:04:05.001Z # RFC3339Nano
|
||||
distribution: "increasing" # only "increasing" is supported right now
|
||||
min_step_duration: "10ns"
|
||||
max_step_duration: "200ms"
|
||||
- name: "slice"
|
||||
type: "uint-set" # (default IDArrayField)
|
||||
min: 0
|
||||
max: 35000
|
||||
distribution: "zipfian"
|
||||
s: 1.1
|
||||
v: 5.1
|
||||
min_num: 1
|
||||
max_num: 50
|
||||
|
||||
# idk_params describe how data from "fields" should be ingested by IDK
|
||||
idk_params:
|
||||
primary_key_config:
|
||||
field: "a_random_string" # if this is a single field named "id" then we'll use uint IDs, if it's empty we'll autogen ids, and if it's anything else we'll do string keys... yes this is a bit hacky, needs to be cleaned up.
|
||||
# fields is keyed by names of fields from top level "fields". It is
|
||||
# not required that all fields appear here, those that don't will
|
||||
# use the default ingestion.
|
||||
fields:
|
||||
id:
|
||||
- type: "ID"
|
||||
type:
|
||||
- type: "ID"
|
||||
a_decimal_field:
|
||||
- type: "Decimal"
|
||||
scale: 4
|
||||
ts:
|
||||
- type: "RecordTime"
|
||||
layout: "2006-01-02T15:04:05Z"
|
||||
epoch: 1970-01-01T00:00:00.0Z
|
||||
name: "na"
|
||||
slice:
|
||||
- type: "IDArray"
|
||||
time_quantum: "YMD"
|
||||
|
|
@ -1,18 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
source $SCRIPT_DIR/utilCluster.sh
|
||||
. $SCRIPT_DIR/utilCluster.sh
|
||||
|
||||
# get the first ingest host
|
||||
INGESTNODE0=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.ingest_ips][0]["value"][0]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json INGESTNODE0 .ingest_ips 0 '"value"' 0
|
||||
echo "using INGESTNODE0 ${INGESTNODE0}"
|
||||
|
||||
# get the first data host
|
||||
DATANODE0=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.data_node_ips][0]["value"][0]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json DATANODE0 .data_node_ips 0 '"value"' 0
|
||||
echo "using DATANODE0 ${DATANODE0}"
|
||||
|
||||
|
||||
# install librdkafka ... workaround until we have static datagen builds for arm
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ec2-user@${INGESTNODE0} "sudo yum -y install librdkafka"
|
||||
|
||||
|
|
@ -26,16 +24,16 @@ then
|
|||
fi
|
||||
|
||||
# run all repros
|
||||
echo "Running smoke tests..."
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ec2-user@${INGESTNODE0} "cd /data/bug-repros; ./run-all.sh ${DATANODE0}:10101"
|
||||
echo "Running bug-repro tests..."
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ec2-user@${INGESTNODE0} "cd /data/bug-repros; ./run-all.sh 'https://${DATANODE0}:10101'"
|
||||
SMOKETESTRESULT=$?
|
||||
|
||||
|
||||
if (( $SMOKETESTRESULT != 0 ))
|
||||
then
|
||||
echo "smoke tests complete with test failures"
|
||||
echo "bug-repro tests complete with test failures"
|
||||
else
|
||||
echo "smoke tests complete"
|
||||
echo "bug-repro tests complete"
|
||||
fi
|
||||
|
||||
exit $SMOKETESTRESULT
|
||||
|
|
|
|||
|
|
@ -1,15 +1,19 @@
|
|||
#!/bin/bash
|
||||
set -x
|
||||
|
||||
# To run script: ./setupSmokeTest.sh <BRANCH_NAME>
|
||||
ADMIN_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoiYWRtaW4ifQ.I1iCgk1VU7m6e-En4ACTHIs6V2dZpy_8j2blSSo7K3U
|
||||
READER_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoicmVhZGVyIn0.QcHy_W6oAYFgdBWy1CqLr55HcOyymn5zAXPJUKCvQE4
|
||||
WRITER_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJuYW1lIjoid3JpdGVyIn0.aEk-12xP9RJeXog4MHO8LhuQFEjNNG2BcWDcMzSX_HI
|
||||
export TF_IN_AUTOMATION=1
|
||||
export AUTH_ENABLED=0
|
||||
export AUTH_ENABLED=1
|
||||
|
||||
BRANCH_NAME=$1
|
||||
|
||||
echo "Running tests for branch ${BRANCH_NAME}"
|
||||
|
||||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||
source $SCRIPT_DIR/utilCluster.sh
|
||||
. $SCRIPT_DIR/utilCluster.sh
|
||||
|
||||
pushd ./qa/tf/ci/smoketest
|
||||
echo "Running terraform init..."
|
||||
|
|
@ -17,6 +21,8 @@ terraform init -input=false
|
|||
echo "Running terraform apply..."
|
||||
terraform apply -input=false -auto-approve
|
||||
terraform output -json > outputs.json
|
||||
echo "Outputs:"
|
||||
cat outputs.json
|
||||
popd
|
||||
|
||||
# path for ebs device
|
||||
|
|
@ -26,33 +32,52 @@ EBS_DEVICE_NAME=/dev/nvme1n1
|
|||
FB_BINARY=featurebase_linux_arm64
|
||||
|
||||
# get the first ingest host
|
||||
INGESTNODE0=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.ingest_ips][0]["value"][0]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json INGESTNODE0 .ingest_ips 0 '"value"' 0
|
||||
echo "using INGESTNODE0 ${INGESTNODE0}"
|
||||
|
||||
# get the first data host
|
||||
DATANODE0=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.data_node_ips][0]["value"][0]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json DATANODE0 .data_node_ips 0 '"value"' 0
|
||||
echo "using DATANODE0 ${DATANODE0}"
|
||||
|
||||
DEPLOYED_CLUSTER_PREFIX=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.cluster_prefix][0]["value"]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json DEPLOYED_CLUSTER_PREFIX .cluster_prefix 0 '"value"'
|
||||
echo "Using DEPLOYED_CLUSTER_PREFIX: ${DEPLOYED_CLUSTER_PREFIX}"
|
||||
|
||||
DEPLOYED_CLUSTER_REPLICA_COUNT=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.fb_cluster_replica_count][0]["value"]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json DEPLOYED_CLUSTER_REPLICA_COUNT .fb_cluster_replica_count 0 '"value"'
|
||||
echo "Using DEPLOYED_CLUSTER_REPLICA_COUNT: ${DEPLOYED_CLUSTDEPLOYED_CLUSTER_REPLICA_COUNTER_PREFIX}"
|
||||
|
||||
DEPLOYED_DATA_IPS=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.data_node_ips][0]["value"][]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json DEPLOYED_DATA_IPS .data_node_ips 0 '"value"' ""
|
||||
echo "DEPLOYED_DATA_IPS: {"
|
||||
echo "${DEPLOYED_DATA_IPS}"
|
||||
echo "}"
|
||||
|
||||
DEPLOYED_DATA_IPS_LEN=`echo "$DEPLOYED_DATA_IPS" | wc -l`
|
||||
|
||||
DEPLOYED_INGEST_IPS=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.ingest_ips][0]["value"][]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json DEPLOYED_INGEST_IPS .ingest_ips 0 '"value"' ""
|
||||
echo "DEPLOYED_INGEST_IPS: {"
|
||||
echo "${DEPLOYED_INGEST_IPS}"
|
||||
echo "}"
|
||||
|
||||
DEPLOYED_INGEST_IPS_LEN=`echo "$DEPLOYED_INGEST_IPS" | wc -l`
|
||||
|
||||
echo "Writing config.py file..."
|
||||
cat << EOT > config.py
|
||||
datanode0="${DATANODE0}"
|
||||
admin_token="${ADMIN_TOKEN}"
|
||||
reader_token="${READER_TOKEN}"
|
||||
writer_token="${WRITER_TOKEN}"
|
||||
EOT
|
||||
cp config.py ./qa/testcases/smoketest/config.py
|
||||
echo "Writing config.sh file..."
|
||||
cat << EOT > config.sh
|
||||
export DATANODE0="${DATANODE0}"
|
||||
export ADMIN_TOKEN="${ADMIN_TOKEN}"
|
||||
export READER_TOKEN="${READER_TOKEN}"
|
||||
export WRITER_TOKEN="${WRITER_TOKEN}"
|
||||
authcurl() {
|
||||
curl -H "Authorization: Bearer ${ADMIN_TOKEN}" -k "\$@"
|
||||
}
|
||||
EOT
|
||||
cp config.sh ./qa/testcases/bug-repros/config.sh
|
||||
|
||||
#wait until we can connect to one of the hosts
|
||||
for i in {0..24}
|
||||
|
|
@ -76,14 +101,15 @@ fi
|
|||
setupClusterNodes $BRANCH_NAME
|
||||
|
||||
# verify featurebase running
|
||||
echo "Verifying featurebase cluster running..."
|
||||
curl -s http://${DATANODE0}:10101/status
|
||||
if (( $? != 0 ))
|
||||
then
|
||||
echo "Featurebase cluster not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Cluster running."
|
||||
for i in {0..24}; do
|
||||
sleep 1
|
||||
curl -k -v https://${DATANODE0}:10101/status -H "Authorization: Bearer ${ADMIN_TOKEN}"
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Cluster is up after ${i} tries"
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
echo >&2 "Featurebase cluster not running."
|
||||
exit 1
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -4,24 +4,14 @@ SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|||
source $SCRIPT_DIR/utilCluster.sh
|
||||
|
||||
# get the first ingest host
|
||||
INGESTNODE0=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.ingest_ips][0]["value"][0]')
|
||||
must_get_value ./qa/tf/ci/smoketest/outputs.json INGESTNODE0 .ingest_ips 0 '"value"' 0
|
||||
echo "using INGESTNODE0 ${INGESTNODE0}"
|
||||
|
||||
# get the first data host
|
||||
DATANODE0=$(cat ./qa/tf/ci/smoketest/outputs.json | jq -r '[.data_node_ips][0]["value"][0]')
|
||||
echo "using DATANODE0 ${DATANODE0}"
|
||||
|
||||
echo "Writing config.py file..."
|
||||
cat << EOT > config.py
|
||||
datanode0="${DATANODE0}"
|
||||
EOT
|
||||
mv config.py ./qa/testcases/smoketest/config.py
|
||||
HOSTS=($( cat ./qa/tf/ci/smoketest/outputs.json | jq -r '.data_node_ips.value' | tr -d '[],"'))
|
||||
|
||||
echo "Copying tests to remote"
|
||||
scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ./qa/testcases/smoketest/*.py ec2-user@${INGESTNODE0}:/data
|
||||
if (( $? != 0 ))
|
||||
then
|
||||
echo "Copy failed"
|
||||
if ! scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ./qa/testcases/smoketest/* ./datagen_linux_arm64 ec2-user@${INGESTNODE0}:/data; then
|
||||
echo >&2 "Copy failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
|
@ -29,6 +19,10 @@ fi
|
|||
echo "Running smoke test..."
|
||||
ssh -A -i ~/.ssh/gitlab-featurebase-ci.pem -o "StrictHostKeyChecking no" ec2-user@${INGESTNODE0} "cd /data; ~/.local/bin/pytest --junitxml=report.xml"
|
||||
SMOKETESTRESULT=$?
|
||||
if [ $SMOKETESTRESULT -ne 0 ]; then
|
||||
echo >&2 "initial smoke tests failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Copying test report to local"
|
||||
scp -r -i ~/.ssh/gitlab-featurebase-ci.pem ec2-user@${INGESTNODE0}:/data/report.xml report.xml
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
/data/datagen_linux_arm64 -s custom --custom-config=./fb-1287-datagen.yaml --pilosa.index=fb1287 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
. ./config.sh
|
||||
$DATAGEN -s custom --custom-config=./fb-1287-datagen.yaml --pilosa.index=fb1287 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
|
||||
# if we get an error, exit 1
|
||||
if [[ $( curl $1/index/fb1287/query -d 'Rows(segid,from="2022-01-02T15:04",to="2022-04-02T15:04")' | jq '.error' ) != "null" ]]; then
|
||||
if [[ $( authcurl $1/index/fb1287/query -d 'Rows(segid,from="2022-01-02T15:04",to="2022-04-02T15:04")' | jq '.error' ) != "null" ]]; then
|
||||
exit 1;
|
||||
else
|
||||
exit 0;
|
||||
|
|
|
|||
|
|
@ -1,7 +1,9 @@
|
|||
#!/bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
# datagen some timestamps onto DATANODE0 in index fb_1332_test
|
||||
/data/datagen_linux_arm64 -s custom --custom-config=./fb-1332-datagen.yaml --pilosa.index=fb1332 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
$DATAGEN -s custom --custom-config=./fb-1332-datagen.yaml --pilosa.index=fb1332 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
if (( $? != 0 )); then
|
||||
echo "couldn't datagen"
|
||||
exit 1
|
||||
|
|
@ -15,7 +17,7 @@ if (( $? != 0 )); then
|
|||
fi
|
||||
|
||||
# delete that index
|
||||
if [[ $( curl -XDELETE $1/index/fb1332| jq '.error' ) != "null" ]]; then
|
||||
if [[ $( authcurl -XDELETE $1/index/fb1332| jq '.error' ) != "null" ]]; then
|
||||
echo "couldn't delete index"
|
||||
exit 1
|
||||
fi
|
||||
|
|
@ -29,7 +31,7 @@ fi
|
|||
|
||||
|
||||
# datagen some more
|
||||
/data/datagen_linux_arm64 -s custom --custom-config=./fb-1332-datagen.yaml --pilosa.index=fb1332 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
$DATAGEN -s custom --custom-config=./fb-1332-datagen.yaml --pilosa.index=fb1332 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
if (( $? != 0 )); then
|
||||
echo "couldn't ingest a second time"
|
||||
exit 1
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#!/bin/bash
|
||||
|
||||
. ./config.sh
|
||||
|
||||
ifErr() {
|
||||
RESCODE=$?
|
||||
if [[ $RESCODE != 0 ]]; then
|
||||
|
|
@ -8,13 +10,13 @@ ifErr() {
|
|||
fi
|
||||
}
|
||||
|
||||
/data/datagen_linux_arm64 -s custom --custom-config=./fb-1371-datagen.yaml --pilosa.index=fb1371 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
$DATAGEN -s custom --custom-config=./fb-1371-datagen.yaml --pilosa.index=fb1371 --pilosa.batch-size=100 --pilosa.hosts=$1
|
||||
ifErr "datagenning fb1371"
|
||||
|
||||
RES1=$( curl $1/index/fb1371/query -d 'Max(ts)' | jq '.results[0].timestampValue' )
|
||||
RES1=$( authcurl $1/index/fb1371/query -d 'Max(ts)' | jq '.results[0].timestampValue' )
|
||||
ifErr "getting Max 1"
|
||||
|
||||
RES2=$( curl $1/index/fb1371/query -d 'Max(ts)' | jq '.results[0].timestampValue' )
|
||||
RES2=$( authcurl $1/index/fb1371/query -d 'Max(ts)' | jq '.results[0].timestampValue' )
|
||||
ifErr "getting Max 2"
|
||||
|
||||
if [[ $RES1 != $RES2 ]]; then
|
||||
|
|
|
|||
|
|
@ -2,7 +2,9 @@
|
|||
|
||||
set -eou pipefail
|
||||
|
||||
. ./config.sh
|
||||
export DATAGEN="/data/datagen_linux_arm64 --auth-token ${ADMIN_TOKEN}"
|
||||
for file in `ls *-test.sh`; do
|
||||
echo "running $file";
|
||||
./$file "$@"
|
||||
sh -x ./$file "$@"
|
||||
done
|
||||
|
|
|
|||
|
|
@ -5,17 +5,18 @@ import requests
|
|||
|
||||
createIndex = { 'options': { 'keys': False } }
|
||||
createField = { 'options': { 'type': 'int', 'min': 0, 'max': 100000 } }
|
||||
headers = {"Authorization": "Bearer " + config.admin_token}
|
||||
|
||||
def setup_module(module):
|
||||
data_to_send = json.dumps(createIndex).encode("utf-8")
|
||||
response = requests.post("http://" + config.datanode0 + ":10101/index/user", data = data_to_send)
|
||||
response = requests.post("https://" + config.datanode0 + ":10101/index/user", data = data_to_send, verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
assert resp_body['success'] == True
|
||||
|
||||
data_to_send = json.dumps(createField).encode("utf-8")
|
||||
response = requests.post("http://" + config.datanode0 + ":10101/index/user/field/stats", data = data_to_send)
|
||||
response = requests.post("https://" + config.datanode0 + ":10101/index/user/field/stats", data = data_to_send, verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
|
|
@ -23,7 +24,7 @@ def setup_module(module):
|
|||
|
||||
|
||||
def teardown_module(module):
|
||||
response = requests.delete("http://" + config.datanode0 + ":10101/index/user")
|
||||
response = requests.delete("https://" + config.datanode0 + ":10101/index/user", verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
|
|
@ -31,7 +32,7 @@ def teardown_module(module):
|
|||
|
||||
|
||||
def test_api_is_responding():
|
||||
response = requests.get("http://" + config.datanode0 + ":10101/status")
|
||||
response = requests.get("https://" + config.datanode0 + ":10101/status", verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
|
|
@ -39,7 +40,7 @@ def test_api_is_responding():
|
|||
|
||||
|
||||
def test_sql3_is_responding():
|
||||
response = requests.post("http://" + config.datanode0 + ":10101/sql", data = "select 1")
|
||||
response = requests.post("https://" + config.datanode0 + ":10101/sql", data = "select 1", verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
|
|
@ -47,7 +48,7 @@ def test_sql3_is_responding():
|
|||
assert resp_body['data'][0][0] == 1
|
||||
|
||||
def test_get_index_api():
|
||||
response = requests.get("http://" + config.datanode0 + ":10101/index/user")
|
||||
response = requests.get("https://" + config.datanode0 + ":10101/index/user", verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
|
|
@ -55,13 +56,13 @@ def test_get_index_api():
|
|||
|
||||
|
||||
def test_set_and_read_query_api():
|
||||
response = requests.post("http://" + config.datanode0 + ":10101/index/user/query", data = "Set(10, stats=1)")
|
||||
response = requests.post("https://" + config.datanode0 + ":10101/index/user/query", data = "Set(10, stats=1)", verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
assert resp_body['results'][0] == True
|
||||
|
||||
response = requests.post("http://" + config.datanode0 + ":10101/index/user/query", data = "Row(stats=1)")
|
||||
response = requests.post("https://" + config.datanode0 + ":10101/index/user/query", data = "Row(stats=1)", verify = False, headers = headers)
|
||||
assert response.status_code == 200
|
||||
assert response.headers["Content-Type"] == "application/json"
|
||||
resp_body = response.json()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue