Changeset: b7be059b95ff for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b7be059b95ff Branch: mtest Log Message:
merged diffs (truncated from 854 to 300 lines): diff --git a/sql/test/wlcr/Tests/All b/sql/test/wlcr/Tests/All --- a/sql/test/wlcr/Tests/All +++ b/sql/test/wlcr/Tests/All @@ -1,41 +1,41 @@ # This is a scenario for continual replication # first create a master with some sample data -wlcr00 -wlc01 - -# check the log records without replication -wlr01 - -# create the first replica synchronized with the master -wlr10 - -# add two sets of tuples to the master -wlc20 -wlc21 - -# and automatically roll forward the clone in 2 steps -wlr20 - -# prepare an update to the master -wlc30 +#wlcr00 +#wlc01 +# +### check the log records without replication +#wlr01 +# +### create the first replica synchronized with the master +#wlr10 +# +### add two sets of tuples to the master +#wlc20 +#wlc21 +# +### and automatically roll forward the clone in 2 steps +#wlr20 +# +### prepare an update to the master +#wlc30 +# +### roll forward to clone +#wlr30 +# +### delete some tupples +#wlc40 +#wlr35 +#wlr40 +# +### clear the complete table +#wlc50 +#wlr50 -# roll forward to clone -wlr30 - -# delete some tupples -wlc40 -wlr35 -wlr40 +## restart for timing based roll forward +#wlc70 +#wlr70 -# clear the complete table -wlc50 -wlr50 - -# restart for timing based roll forward -wlc70 -wlr70 - -# stop the master -wlc100 -wlr100 -wlr110 +## stop the master +#wlc100 +#wlr100 +#wlr110 diff --git a/sql/test/wlcr/Tests/wlc01.py b/sql/test/wlcr/Tests/wlc01.py --- a/sql/test/wlcr/Tests/wlc01.py +++ b/sql/test/wlcr/Tests/wlc01.py @@ -1,40 +1,61 @@ +from MonetDBtesting.sqltest import SQLTestCase try: from MonetDBtesting import process except ImportError: import process import os, sys -dbfarm = os.getenv('GDK_DBFARM') -tstdb = os.getenv('TSTDB') +DBFARM = os.getenv('GDK_DBFARM') +TSTDB = os.getenv('TSTDB') +MAPIPORT = os.getenv('MAPIPORT') -if not tstdb or not dbfarm: +if not TSTDB or not DBFARM: print('No TSTDB or GDK_DBFARM in environment') sys.exit(1) -#clean up first -dbname = tstdb - -with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s, \ - process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: - - cout, cerr = c.communicate('''\ -call wlc.beat(0); -call wlc.master(); - -create table tmp0(i int, s string); -insert into tmp0 values(1,'gaap'), (2,'sleep'); -drop table tmp0; -create table tmp(i int, s string); -insert into tmp values(1,'hello'), (2,'world'); -select * from tmp; -''') +with process.server(mapiport=MAPIPORT, dbname=TSTDB, stdout=process.PIPE, stderr=process.PIPE) as s: + with SQLTestCase() as tc: + tc.connect(database=TSTDB, port=MAPIPORT) + tc.execute(""" + call wlc.beat(0); + call wlc.master();""").assertSucceeded() + tc.execute("create table tmp0(i int, s string);""").assertSucceeded() + tc.execute("insert into tmp0 values(1,'gaap'), (2,'sleep');")\ + .assertSucceeded()\ + .assertRowCount(2) + tc.execute("drop table tmp0;").assertSucceeded() + tc.execute("create table tmp(i int, s string);").assertSucceeded() + tc.execute("insert into tmp values(1,'hello'), (2,'world');")\ + .assertSucceeded()\ + .assertRowCount(2) + tc.execute("select * from tmp;")\ + .assertSucceeded()\ + .assertRowCount(2)\ + .assertDataResultMatch(data=[(1, 'hello'), (2, 'world')]) sout, serr = s.communicate() - sys.stdout.write(sout) - sys.stdout.write(cout) - sys.stderr.write(serr) - sys.stderr.write(cerr) +#with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s, \ +# process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +# +# cout, cerr = c.communicate('''\ +#call wlc.beat(0); +#call wlc.master(); +# +#create table tmp0(i int, s string); +#insert into tmp0 values(1,'gaap'), (2,'sleep'); +#drop table tmp0; +#create table tmp(i int, s string); +#insert into tmp values(1,'hello'), (2,'world'); +#select * from tmp; +#''') +# +# sout, serr = s.communicate() +# +# sys.stdout.write(sout) +# sys.stdout.write(cout) +# sys.stderr.write(serr) +# sys.stderr.write(cerr) def listfiles(path): sys.stdout.write("#LISTING OF THE LOG FILES\n") @@ -52,6 +73,6 @@ def listfiles(path): except IOError: sys.stderr.write('Failure to read file ' + file + '\n') -listfiles(os.path.join(dbfarm, tstdb)) -listfiles(os.path.join(dbfarm, tstdb, 'wlc_logs')) +listfiles(os.path.join(DBFARM, TSTDB)) +listfiles(os.path.join(DBFARM, TSTDB, 'wlc_logs')) diff --git a/sql/test/wlcr/Tests/wlc20.py b/sql/test/wlcr/Tests/wlc20.py --- a/sql/test/wlcr/Tests/wlc20.py +++ b/sql/test/wlcr/Tests/wlc20.py @@ -3,6 +3,7 @@ try: except ImportError: import process import os, sys +from MonetDBtesting.sqltest import SQLTestCase dbfarm = os.getenv('GDK_DBFARM') tstdb = os.getenv('TSTDB') @@ -14,19 +15,32 @@ if not tstdb or not dbfarm: dbname = tstdb with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s, \ - process.client('sql', server = s, stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) as c: - - cout, cerr = c.communicate('''\ -insert into tmp values(3,'blah'),(4,'bloh'); -select * from tmp; -''') + SQLTestCase() as tc: + tc.connect(database=dbname) + tc.execute("insert into tmp values(3,'blah'),(4,'bloh');")\ + .assertSucceeded()\ + .assertRowCount(2) + tc.execute("select * from tmp;")\ + .assertSucceeded()\ + .assertDataResultMatch([(1, 'hello'), (2, 'world'), (3, 'blah'), (4, 'bloh')]) sout, serr = s.communicate() - sys.stdout.write(sout) - sys.stdout.write(cout) - sys.stderr.write(serr) - sys.stderr.write(cerr) + +#with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s, \ +# process.client('sql', server = s, stdin = process.PIPE, stdout = process.PIPE, stderr = process.PIPE) as c: +# +# cout, cerr = c.communicate('''\ +#insert into tmp values(3,'blah'),(4,'bloh'); +#select * from tmp; +#''') +# +# sout, serr = s.communicate() +# +# sys.stdout.write(sout) +# sys.stdout.write(cout) +# sys.stderr.write(serr) +# sys.stderr.write(cerr) def listfiles(path): sys.stdout.write("#LISTING OF THE LOG FILES\n") diff --git a/sql/test/wlcr/Tests/wlc21.py b/sql/test/wlcr/Tests/wlc21.py --- a/sql/test/wlcr/Tests/wlc21.py +++ b/sql/test/wlcr/Tests/wlc21.py @@ -3,6 +3,7 @@ try: except ImportError: import process import os, sys +from MonetDBtesting.sqltest import SQLTestCase dbfarm = os.getenv('GDK_DBFARM') tstdb = os.getenv('TSTDB') @@ -13,20 +14,34 @@ if not tstdb or not dbfarm: dbname = tstdb + with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s, \ - process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: - - cout, cerr = c.communicate('''\ -insert into tmp values(5,'red'),(6,'fox'); -select * from tmp; -''') + SQLTestCase() as tc: + tc.connect(database=dbname) + tc.execute("insert into tmp values(5,'red'),(6,'fox');")\ + .assertSucceeded()\ + .assertRowCount(2) + tc.execute("select * from tmp;")\ + .assertSucceeded()\ + .assertDataResultMatch([(1, 'hello'), (2, 'world'), (3, 'blah'), (4, 'bloh'), (5, 'red'), (6, 'fox')]) sout, serr = s.communicate() - sys.stdout.write(sout) - sys.stdout.write(cout) - sys.stderr.write(serr) - sys.stderr.write(cerr) + +#with process.server(dbname=dbname, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as s, \ +# process.client('sql', server=s, stdin=process.PIPE, stdout=process.PIPE, stderr=process.PIPE) as c: +# +# cout, cerr = c.communicate('''\ +#insert into tmp values(5,'red'),(6,'fox'); +#select * from tmp; +#''') +# +# sout, serr = s.communicate() +# +# sys.stdout.write(sout) +# sys.stdout.write(cout) +# sys.stderr.write(serr) +# sys.stderr.write(cerr) def listfiles(path): sys.stdout.write("#LISTING OF THE LOG FILES\n") diff --git a/sql/test/wlcr/Tests/wlc30.py b/sql/test/wlcr/Tests/wlc30.py --- a/sql/test/wlcr/Tests/wlc30.py +++ b/sql/test/wlcr/Tests/wlc30.py @@ -3,6 +3,7 @@ try: except ImportError: import process import os, sys +from MonetDBtesting.sqltest import SQLTestCase dbfarm = os.getenv('GDK_DBFARM') _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list