Added structure which can be cloned for multiple test cases.
This commit is contained in:
parent
a137196de0
commit
df02926321
@ -3,8 +3,8 @@
|
||||
# runtests - run all local tests
|
||||
# testall - clean, build and run local and subdirectories' tests
|
||||
|
||||
include ../../../../build_gateway.inc
|
||||
include ../../../../makefile.inc
|
||||
include ../../../../../build_gateway.inc
|
||||
include ../../../../../makefile.inc
|
||||
|
||||
CC=cc
|
||||
TESTLOG := $(shell pwd)/testrouters.log
|
||||
@ -28,7 +28,7 @@ runtests:
|
||||
@echo "Test MaxScale R/W Split" >> $(TESTLOG)
|
||||
@echo "-------------------------------" >> $(TESTLOG)
|
||||
|
||||
ifeq ($(shell ./rwsplit.sh; echo $$?), 0)
|
||||
ifeq ($(shell ./rwsplit.sh $(TESTLOG) 127.0.0.1 4006 maxuser maxpwd ; echo $$?), 0)
|
||||
@echo "MaxScale core PASSED" >> $(TESTLOG)
|
||||
else
|
||||
@echo "MaxScale core FAILED" >> $(TESTLOG) ; exit 1
|
||||
|
@ -1,12 +1,14 @@
|
||||
#! /bin/sh
|
||||
#!/bin/sh
|
||||
TLOG=$1
|
||||
THOST=$2
|
||||
TPORT=$3
|
||||
TUSER=$4
|
||||
TPWD=$5
|
||||
RUNCMD=mysql\ --host=$THOST\ -P$TPORT\ -u$TUSER\ -p$TPWD\ --unbuffered=true\ --disable-reconnect\ --silent
|
||||
|
||||
INPUT=test_transaction_routing1.sql
|
||||
|
||||
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
|
||||
a=`$RUNCMD < ./$INPUT`
|
||||
if [ "$a" != "2" ]; then echo "$INPUT FAILED">>$TLOG; exit 1 ;
|
||||
else echo "$INPUT PASSED">>$TLOG ; fi
|
||||
|
||||
|
@ -0,0 +1,21 @@
|
||||
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;
|
||||
-- Now there are two values
|
||||
START TRANSACTION;
|
||||
DELETE FROM myCity;
|
||||
-- Now there are zero values
|
||||
SET @a = (SELECT COUNT(1) FROM myCity); -- implicit COMMIT for DELETE operation
|
||||
ROLLBACK; -- nothing to roll back
|
||||
START TRANSACTION;
|
||||
SET @b = (SELECT COUNT(*) FROM myCity); -- implicit COMMIT for empty trx
|
||||
START TRANSACTION;
|
||||
DROP TABLE myCity;
|
||||
SELECT (@a+@b) AS res; -- counts 0+0 ans sets the result to 'res'
|
||||
COMMIT;
|
Loading…
x
Reference in New Issue
Block a user