Changeset: a310baed8a27 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/a310baed8a27
Added Files:
        sql/backends/monet5/Tests/insertonly_persist.SQL.py
Modified Files:
        sql/backends/monet5/Tests/All
Branch: insertonly
Log Message:

Test for insertonly_nowal feature.


diffs (52 lines):

diff --git a/sql/backends/monet5/Tests/All b/sql/backends/monet5/Tests/All
--- a/sql/backends/monet5/Tests/All
+++ b/sql/backends/monet5/Tests/All
@@ -33,3 +33,5 @@ limithack
 shutdown
 
 HAVE_HGE?int_notation_1e5
+
+insertonly_persist
diff --git a/sql/backends/monet5/Tests/insertonly_persist.SQL.py 
b/sql/backends/monet5/Tests/insertonly_persist.SQL.py
new file mode 100644
--- /dev/null
+++ b/sql/backends/monet5/Tests/insertonly_persist.SQL.py
@@ -0,0 +1,38 @@
+import os, tempfile
+
+from MonetDBtesting.sqltest import SQLTestCase
+try:
+    from MonetDBtesting import process
+except ImportError:
+    import process
+
+with tempfile.TemporaryDirectory() as farm_dir:
+    os.mkdir(os.path.join(farm_dir, 'db1'))
+
+    with process.server(mapiport='0', dbname='db1',
+                        dbfarm=os.path.join(farm_dir, 'db1'),
+                        args=["--set", "insertonly_nowal=true", "--set", 
"embedded_py=true"],
+                        stdin=process.PIPE,
+                        stdout=process.PIPE, stderr=process.PIPE) as s:
+        with SQLTestCase() as tc:
+            tc.connect(username="monetdb", password="monetdb", port=s.dbport, 
database='db1')
+            tc.execute("CREATE OR REPLACE FUNCTION sleep(msecs int) RETURNS 
INT EXTERNAL NAME alarm.sleep")
+            tc.execute("CREATE TABLE foo (x INT)").assertSucceeded()
+            tc.execute("ALTER TABLE foo SET INSERT ONLY").assertSucceeded()
+            tc.execute("CREATE LOADER up() LANGUAGE PYTHON { _emit.emit({'x': 
list(range(1,101))}) }").assertSucceeded()
+            tc.execute("COPY LOADER INTO foo FROM up()").assertSucceeded()
+            tc.execute("SELECT count(*) FROM 
foo").assertSucceeded().assertDataResultMatch([(100,)])
+            tc.execute("select sleep(2000)")
+            tc.execute("SELECT * FROM 
insertonly_persist('sys')").assertSucceeded()
+            # tc.execute("select sleep(10000)")
+        s.communicate()
+
+    with process.server(mapiport='0', dbname='db1',
+                        dbfarm=os.path.join(farm_dir, 'db1'),
+                        stdin=process.PIPE,
+                        stdout=process.PIPE, stderr=process.PIPE) as s:
+        with SQLTestCase() as tc:
+            tc.connect(username="monetdb", password="monetdb", port=s.dbport, 
database='db1')
+            tc.execute("SELECT COUNT(*) FROM 
foo").assertSucceeded().assertDataResultMatch([(100,)])
+
+        s.communicate()
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to