Skip to content
Snippets Groups Projects
Commit 07be10b9 authored by Dariusz Janny's avatar Dariusz Janny
Browse files

[faas#9] test suite for faas-db added.

parent 5ba15646
No related branches found
No related tags found
1 merge request!3Master
...@@ -32,5 +32,11 @@ stop: # stop container ...@@ -32,5 +32,11 @@ stop: # stop container
version: # print current component version version: # print current component version
@echo ${FAAS_DB_VERSION} @echo ${FAAS_DB_VERSION}
test: testFaasDB # run all tests
testFaasDB: # run checking docker image tests
@echo "# run test version"
bats test/faas-db-tests.bats
help: # this help help: # this help
@awk 'BEGIN {FS = ":.*?# "} /^[a-zA-Z_-]+:.*?# / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST) @awk 'BEGIN {FS = ":.*?# "} /^[a-zA-Z_-]+:.*?# / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
## structure ## structure
`_conf/`_ - directory with configuration files `_conf/`_ - directory with configuration files
`test/` - directory with tests files
## build image ## build image
To build `faas-db` docker image To build `faas-db` docker image
...@@ -26,4 +27,6 @@ up build and run container ...@@ -26,4 +27,6 @@ up build and run container
logs print docker logs logs print docker logs
stop stop container stop stop container
version print current component version version print current component version
test run all tests
testFaasDB run checking docker image tests
` `
#! /usr/bin/env bats
@test "faas-db - checking version in variables" {
[ $FAAS_DB_VERSION = "1.0-SNAPSHOT" ]
}
@test "faas-db - checking app name in variables" {
[ $FAAS_DB_NAME = "faas-db" ]
}
@test "faas-db - checking image string in variables" {
[ $FAAS_DB_IMAGE = "faas/faas-db:1.0-SNAPSHOT" ]
}
@test "faas-db - checking version in image file" {
run docker exec $FAAS_DB_NAME bash -c 'cat /faas-docker-version'
[ "$output" = "1.0-SNAPSHOT" ]
}
@test "faas-db - checking app name in image file" {
run docker exec $FAAS_DB_NAME bash -c 'cat /faas-docker-name'
[ "$output" = "faas-db" ]
}
@test "faas-db - checking image string in image file" {
run docker exec $FAAS_DB_NAME bash -c 'cat /faas-docker-image'
[ "$output" = "faas/faas-db:1.0-SNAPSHOT" ]
}
@test "faas-db - checking DB version in client command" {
run docker exec $FAAS_DB_NAME bash -c 'mysql --version'
[ "$output" = "mysql Ver 15.1 Distrib 10.5.8-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2" ]
}
@test "faas-db - checking DB version in running DB instance" {
run docker exec $FAAS_DB_NAME bash -c "mysql --disable-column-names -uroot -p${MYSQL_ROOT_PASSWORD} mysql -e 'select version();'"
[ "$output" = "10.5.8-MariaDB-1:10.5.8+maria~focal" ]
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment