Added test for readwrite split: SET and TRANSACTION - COMMIT
Added test for readwrite split: SET and TRANSACTION - COMMIT
This commit is contained in:
parent
d660d3590d
commit
f320c17834
39
server/modules/routing/readwritesplit/test/makefile
Normal file
39
server/modules/routing/readwritesplit/test/makefile
Normal file
@ -0,0 +1,39 @@
|
||||
# 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
|
||||
|
||||
CC=cc
|
||||
TESTLOG := $(shell pwd)/testrouters.log
|
||||
RET := -1
|
||||
|
||||
cleantests:
|
||||
- $(DEL) *.o
|
||||
- $(DEL) *~
|
||||
|
||||
testall:
|
||||
$(MAKE) cleantests
|
||||
$(MAKE) DEBUG=Y buildtests
|
||||
$(MAKE) runtests
|
||||
|
||||
buildtests :
|
||||
|
||||
runtests:
|
||||
@echo "" >> $(TESTLOG)
|
||||
@echo "-------------------------------" >> $(TESTLOG)
|
||||
@echo $(shell date) >> $(TESTLOG)
|
||||
@echo "Test MaxScale R/W Split" >> $(TESTLOG)
|
||||
@echo "-------------------------------" >> $(TESTLOG)
|
||||
|
||||
ifeq ($(shell ./rwsplit.sh; echo $$?), 0)
|
||||
@echo "MaxScale core PASSED" >> $(TESTLOG)
|
||||
else
|
||||
@echo "MaxScale core FAILED" >> $(TESTLOG) ; exit 1
|
||||
endif
|
||||
@echo "" >> $(TESTLOG)
|
||||
|
||||
pesce:
|
||||
@echo "fine"
|
12
server/modules/routing/readwritesplit/test/rwsplit.sh
Executable file
12
server/modules/routing/readwritesplit/test/rwsplit.sh
Executable file
@ -0,0 +1,12 @@
|
||||
#! /bin/sh
|
||||
|
||||
|
||||
a=`mysql --host=127.0.0.1 -P 4606 -umassi -pmassi --unbuffered=true --disable-reconnect --silent < ./transaction_with_set.sql`
|
||||
#a=`mysql --host=107.170.19.59 -P 4606 -uvai -pvai --unbuffered=true --disable-reconnect --silent < ./transaction_with_set.sql`
|
||||
|
||||
if [ "$a" -eq 2 ]; then
|
||||
exit 0
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
@ -0,0 +1,19 @@
|
||||
USE test;
|
||||
SET autocommit = 0;
|
||||
SET @a= -1;
|
||||
SET @b = -2;
|
||||
START TRANSACTION;
|
||||
CREATE TABLE IF NOT EXISTS myCity (a int, b char(20));
|
||||
INSERT INTO myCity VALUES (1, 'Milan');
|
||||
INSERT INTO myCity VALUES (2, 'London');
|
||||
COMMIT;
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
SET @a = (SELECT COUNT(1) FROM myCity);
|
||||
ROLLBACK;
|
||||
START TRANSACTION;
|
||||
SET @b = (SELECT COUNT(*) FROM myCity);
|
||||
START TRANSACTION;
|
||||
DROP TABLE myCity;
|
||||
SELECT (@a+@b) AS res;
|
||||
COMMIT;
|
Loading…
x
Reference in New Issue
Block a user