Commit 50ee4be4 authored by zauberstuhl's avatar zauberstuhl
Browse files

Add multi-server test to testproject

parent 06ad97a4
Pipeline #869 passed with stages
in 20 minutes and 38 seconds
......@@ -4,9 +4,11 @@
load test_helper
@test "$btf create database" {
create_database tp1
[ "$?" -eq 0 ]
@test "$btf create databases" {
for tp in tp1 tp2; do
create_database $tp
[ "$?" -eq 0 ]
done
}
@test "$btf start testproject#1 server" {
......@@ -27,20 +29,27 @@ load test_helper
# [ "$code" -eq "0" ]
}
@test "$btf start testproject#2 server" {
start_app tp2 3000 testproject$(latest_tag testproject)
[ "$?" -eq 0 ]
}
@test "$btf test initial count, it should be zero" {
get "http://$(container_ip tp1):3000"
echo "expected 200, got $HTTP_STATUS_CODE"
[ "$HTTP_STATUS_CODE" == "200" ]
echo "expected 0, got $HTTP_BODY"
[ "$HTTP_BODY" == "0" ]
for tp in tp1 tp2; do
get "http://$(container_ip $tp):3000"
echo "expected 200, got $HTTP_STATUS_CODE"
[ "$HTTP_STATUS_CODE" == "200" ]
echo "expected 0, got $HTTP_BODY"
[ "$HTTP_BODY" == "0" ]
done
}
@test "$btf increase count by one" {
get "http://$(container_ip tp1):3000/add"
@test "$btf increase count on tp1 via tp2" {
get "http://$(container_ip tp2):3000/add@$(container_ip tp1):3000"
[ "$HTTP_STATUS_CODE" == "200" ]
}
@test "$btf test count, it should be one" {
@test "$btf test count on tp1, it should be one" {
get "http://$(container_ip tp1):3000"
echo "expected 200, got $HTTP_STATUS_CODE"
[ "$HTTP_STATUS_CODE" == "200" ]
......@@ -48,20 +57,24 @@ load test_helper
[ "$HTTP_BODY" == "1" ]
}
@test "$btf check the database for results too" {
@test "$btf check the database on tp1 too" {
result=$(query tp1 "select count(*) from testtable;")
echo "expected 1, got $result"
[[ $result =~ "1" ]]
}
@test "$btf stop and delete the container" {
stop_app tp1
[ "$?" -eq 0 ]
remove_app tp1
[ "$?" -eq 0 ]
@test "$btf stop and delete the containers" {
for tp in tp1 tp2; do
stop_app $tp
[ "$?" -eq 0 ]
remove_app $tp
[ "$?" -eq 0 ]
done
}
@test "$btf drop database" {
drop_database tp1
[ "$?" -eq 0 ]
@test "$btf drop databases" {
for tp in tp1 tp2; do
drop_database $tp
[ "$?" -eq 0 ]
done
}
FROM debian:jessie
RUN apt-get update
RUN apt-get install -y git-core postgresql-client netcat
RUN apt-get install -y \
git-core postgresql-client netcat curl
RUN git clone https://git.feneas.org/feneas/federation/testsuite-testproject.git
WORKDIR testsuite-testproject
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment