Test system for MaxScale.

Every test/makefile have the following targets:
 cleantests 	- clean local and subdirectories' tests
 buildtests	- build all local and subdirectories' tests
 runtests	- run all local tests
 testall	- clean, build and run local and subdirectories' tests

Tests for directory random_dir are always in its subdirectory, in this case in random_dir/test . If random_dir has subdirectories with tests, random_dir/child_dir, for example, tests of child_dir can be started from random_dir/test/makefile where make -C child_dir/test <test target> is called.

See MAXSCALE_HOME/test/README for further information.
This commit is contained in:
VilhoRaatikka
2014-02-07 11:06:37 +02:00
parent 0a13bf9989
commit e8ce2268e0
17 changed files with 763 additions and 228 deletions

View File

@ -0,0 +1,117 @@
#
# Example MaxScale.cnf configuration file
#
#
#
# Number of server threads
# Valid options are:
# threads=<number of threads>
[maxscale]
threads=1
# Define a monitor that can be used to determine the state and role of
# the servers.
#
# Valid options are:
#
# module=<name of module to load>
# servers=<server name>,<server name>,...
# user =<user name - must have slave replication and
# slave client privileges>
# passwd=<password of the above user, plain text currently>
[MySQL Monitor]
type=monitor
module=mysqlmon
servers=server1,server2,server3
user=maxuser
passwd=maxpwd
# A series of service definition
#
# Valid options are:
#
# router=<name of router module>
# servers=<server name>,<server name>,...
# user=<User to fetch password inforamtion with>
# passwd=<Password of the user, plain text currently>
#
# Valid router modules currently are:
# readwritesplit, readconnroute and debugcli
[RW Split Router]
type=service
router=readwritesplit
servers=server1,server2,server3
user=maxuser
passwd=maxpwd
[Read Connection Router]
type=service
router=readconnroute
router_options=slave
servers=server1,server2,server3
user=maxuser
passwd=maxpwd
[HTTPD Router]
type=service
router=testroute
servers=server1,server2,server3
[Debug Interface]
type=service
router=debugcli
# Listener definitions for the services
#
# Valid options are:
#
# service=<name of service defined elsewhere>
# protocol=<name of protocol module with which to listen>
# port=<Listening port>
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
[Read Connection Listener]
type=listener
service=Read Connection Router
protocol=MySQLClient
port=4008
[Debug Listener]
type=listener
service=Debug Interface
protocol=telnetd
port=4442
[HTTPD Listener]
type=listener
service=HTTPD Router
protocol=HTTPD
port=6444
# Definition of the servers
[server1]
type=server
address=127.0.0.1
port=3000
protocol=MySQLBackend
[server2]
type=server
address=127.0.0.1
port=3001
protocol=MySQLBackend
[server3]
type=server
address=127.0.0.1
port=3002
protocol=MySQLBackend

67
server/test/makefile Normal file
View File

@ -0,0 +1,67 @@
# cleantests - clean local and subdirectories' tests
# buildtests - build all local and subdirectories' tests
# runtests - run all local tests
# testall - clean, build and run local and subdirectories' tests
include ../../build_gateway.inc
include ../../makefile.inc
TEST_ROOT := $(ROOT_PATH)/test
PARENT_DIR := $(ROOT_PATH)/server
CUR_DIR := $(PARENT_DIR)/test
export MAXSCALE_HOME=$(CUR_DIR)/MaxScale
CC=cc
TESTLOG := $(CUR_DIR)/testserver.log
ifndef $(HAVE_SRV)
HAVE_SRV := N
endif
cleantests:
- $(DEL) *.o
- $(DEL) *~
ifeq ($(HAVE_SRV), N)
- $(DEL) Documentation
- $(DEL) bin
- $(DEL) lib
- $(DEL) MaxScale/etc
- $(DEL) MaxScale/modules
- $(DEL) MaxScale/mysql
endif
$(MAKE) -C $(PARENT_DIR)/core cleantests
testall:
$(MAKE) HAVE_SRV=$(HAVE_SRV) cleantests
$(MAKE) HAVE_SRV=$(HAVE_SRV) buildtests
$(MAKE) runtests
@echo "" >> $(TESTLOG)
@echo "-------------------------------" >> $(TESTLOG)
@echo $(shell date) >> $(TESTLOG)
@echo "Test Server Core" >> $(TESTLOG)
$(MAKE) -C $(ROOT_PATH)/server/core testall
@echo "Query Classifier PASSED" >> $(TESTLOG)
buildtests:
ifeq ($(HAVE_SRV), Y)
@echo "Test server already built"
else
$(MAKE) -C $(ROOT_PATH) buildtestserver
endif
runtests:
@echo "" >> $(TESTLOG)
@echo "-------------------------------" >> $(TESTLOG)
@echo $(shell date) >> $(TESTLOG)
@echo "Test MaxScale server" >> $(TESTLOG)
@echo "-------------------------------" >> $(TESTLOG)
@echo "MAXSCALE_HOME="$(MAXSCALE_HOME) >> $(TESTLOG)
cp $(CUR_DIR)/MaxScale_test.cnf $(MAXSCALE_HOME)/etc/MaxScale.cnf
bin/maxscale 2>> $(TESTLOG)
@echo "Put your tests here"
@sleep 5
@echo "MaxScale server PASSED" >> $(TESTLOG)
@echo "" >> $(TESTLOG)
@killall maxscale