Merge pull request #7639 from jayunit100/e2e-k8bps
E2E: Soak test and Functional tests for K8Petstore
This commit is contained in:
commit
cb60af4c74
|
|
@ -16,16 +16,30 @@
|
||||||
|
|
||||||
echo "WRITING KUBE FILES , will overwrite the jsons, then testing pods. is kube clean ready to go?"
|
echo "WRITING KUBE FILES , will overwrite the jsons, then testing pods. is kube clean ready to go?"
|
||||||
|
|
||||||
|
|
||||||
|
#Args below can be overriden when calling from cmd line.
|
||||||
|
#Just send all the args in order.
|
||||||
#for dev/test you can use:
|
#for dev/test you can use:
|
||||||
#kubectl=$GOPATH/src/github.com/GoogleCloudPlatform/kubernetes/cluster/kubectl.sh"
|
#kubectl=$GOPATH/src/github.com/GoogleCloudPlatform/kubernetes/cluster/kubectl.sh"
|
||||||
kubectl="kubectl"
|
kubectl="kubectl"
|
||||||
VERSION="r.2.8.19"
|
VERSION="r.2.8.19"
|
||||||
PUBLIC_IP="10.1.4.89" # ip which we use to access the Web server.
|
PUBLIC_IP="10.1.4.89" # ip which we use to access the Web server.
|
||||||
SECONDS=1000 # number of seconds to measure throughput.
|
|
||||||
FE="1" # amount of Web server
|
FE="1" # amount of Web server
|
||||||
LG="1" # amount of load generators
|
LG="1" # amount of load generators
|
||||||
SLAVE="1" # amount of redis slaves
|
SLAVE="1" # amount of redis slaves
|
||||||
|
TEST_SECONDS="1000" # 0 = Dont run tests, if > 0, run tests for n seconds.
|
||||||
|
NS="k8petstore" # namespace
|
||||||
|
|
||||||
|
kubectl="${1:-$kubectl}"
|
||||||
|
VERSION="${2:-$VERSION}"
|
||||||
|
PUBLIC_IP="${3:-$PUBLIC_IP}"
|
||||||
|
FE="${4:-$FE}"
|
||||||
|
LG="${5:-$LG}"
|
||||||
|
SLAVE="${6:-$SLAVE}"
|
||||||
|
TEST_SECONDS="${7:-$TEST}"
|
||||||
|
NS="${8:-$NS}"
|
||||||
|
|
||||||
|
echo "Running w/ args: kubectl $kubectl version $VERSION ip $PUBLIC_IP sec $_SECONDS fe $FE lg $LG slave $SLAVE test $TEST NAMESPACE $NS"
|
||||||
function create {
|
function create {
|
||||||
|
|
||||||
cat << EOF > fe-rc.json
|
cat << EOF > fe-rc.json
|
||||||
|
|
@ -188,53 +202,74 @@ cat << EOF > slave-rc.json
|
||||||
"labels": {"name": "redisslave"}
|
"labels": {"name": "redisslave"}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
$kubectl create -f rm.json --api-version=v1beta1
|
$kubectl create -f rm.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f rm-s.json --api-version=v1beta1
|
$kubectl create -f rm-s.json --api-version=v1beta1 --namespace=$NS
|
||||||
sleep 3 # precaution to prevent fe from spinning up too soon.
|
sleep 3 # precaution to prevent fe from spinning up too soon.
|
||||||
$kubectl create -f slave-rc.json --api-version=v1beta1
|
$kubectl create -f slave-rc.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f rs-s.json --api-version=v1beta1
|
$kubectl create -f rs-s.json --api-version=v1beta1 --namespace=$NS
|
||||||
sleep 3 # see above comment.
|
sleep 3 # see above comment.
|
||||||
$kubectl create -f fe-rc.json --api-version=v1beta1
|
$kubectl create -f fe-rc.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f fe-s.json --api-version=v1beta1
|
$kubectl create -f fe-s.json --api-version=v1beta1 --namespace=$NS
|
||||||
$kubectl create -f bps-load-gen-rc.json --api-version=v1beta1
|
$kubectl create -f bps-load-gen-rc.json --api-version=v1beta1 --namespace=$NS
|
||||||
}
|
}
|
||||||
|
|
||||||
function test {
|
function pollfor {
|
||||||
pass_http=0
|
pass_http=0
|
||||||
|
|
||||||
### Test HTTP Server comes up.
|
### Test HTTP Server comes up.
|
||||||
for i in `seq 1 150`;
|
for i in `seq 1 150`;
|
||||||
do
|
do
|
||||||
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
### Just testing that the front end comes up. Not sure how to test total entries etc... (yet)
|
||||||
echo "Trying curl ... $i . expect a few failures while pulling images... "
|
echo "Trying curl ... $PUBLIC_IP:3000 , attempt $i . expect a few failures while pulling images... "
|
||||||
curl "$PUBLIC_IP:3000" > result
|
curl "$PUBLIC_IP:3000" > result
|
||||||
cat result
|
cat result
|
||||||
cat result | grep -q "k8-bps"
|
cat result | grep -q "k8-bps"
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
echo "TEST PASSED after $i tries !"
|
echo "TEST PASSED after $i tries !"
|
||||||
i=1000
|
i=1000
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
echo "the above RESULT didn't contain target string for trial $i"
|
echo "the above RESULT didn't contain target string for trial $i"
|
||||||
fi
|
fi
|
||||||
sleep 5
|
sleep 3
|
||||||
done
|
done
|
||||||
|
|
||||||
if [ $i -eq 1000 ]; then
|
if [ $i -eq 1000 ]; then
|
||||||
pass_http=-1
|
pass_http=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function tests {
|
||||||
pass_load=0
|
pass_load=0
|
||||||
|
|
||||||
### Print statistics of db size, every second, until $SECONDS are up.
|
### Print statistics of db size, every second, until $SECONDS are up.
|
||||||
for i in `seq 1 $SECONDS`;
|
for i in `seq 1 $TEST_SECONDS`;
|
||||||
do
|
do
|
||||||
echo "curl : $i"
|
echo "curl : $PUBLIC_IP:3000 , $i of $TEST_SECONDS"
|
||||||
curl "$PUBLIC_IP:3000/llen" >> result
|
curr_cnt="`curl "$PUBLIC_IP:3000/llen"`"
|
||||||
|
### Write CSV File of # of trials / total transcations.
|
||||||
|
echo "$i $curr_cnt" >> result
|
||||||
|
echo "total transactions so far : $curr_cnt"
|
||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
create
|
create
|
||||||
|
|
||||||
test
|
pollfor
|
||||||
|
|
||||||
|
if [[ $pass_http -eq 1 ]]; then
|
||||||
|
echo "Passed..."
|
||||||
|
else
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $TEST_SECONDS -eq 0 ]]; then
|
||||||
|
echo "skipping tests, TEST_SECONDS value was 0"
|
||||||
|
else
|
||||||
|
echo "running polling tests now for $TEST_SECONDS"
|
||||||
|
tests
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue