diff options
author | Ben Pfaff <blp@nicira.com> | 2010-02-09 10:17:58 -0800 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2010-02-09 14:25:32 -0800 |
commit | 9cb53f2613d0194b85dddfdafc11d7193d6561e3 (patch) | |
tree | af5d76eb2aea8f392976d0358a9923a0a461a436 /tests | |
parent | 7b09e42666aa1d345d44c112ff7f74ac8f030297 (diff) |
ovsdb: Add support for multiple databases to the protocol.
This also adds protocol compatibility to the database itself and to
ovsdb-client. It doesn't actually add multiple database support to
ovsdb-server, since we don't really need that yet.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/ovsdb-execution.at | 155 | ||||
-rw-r--r-- | tests/ovsdb-file.at | 3 | ||||
-rw-r--r-- | tests/ovsdb-idl.at | 75 | ||||
-rw-r--r-- | tests/ovsdb-monitor.at | 44 | ||||
-rw-r--r-- | tests/ovsdb-server.at | 23 | ||||
-rw-r--r-- | tests/ovsdb-trigger.at | 42 |
6 files changed, 233 insertions, 109 deletions
diff --git a/tests/ovsdb-execution.at b/tests/ovsdb-execution.at index 06080f71..ca155a1e 100644 --- a/tests/ovsdb-execution.at +++ b/tests/ovsdb-execution.at @@ -1,7 +1,7 @@ AT_BANNER([OVSDB -- execution]) m4_define([ORDINAL_SCHEMA], - [[{"name": "mydb", + [[{"name": "ordinals", "tables": { "ordinals": { "columns": { @@ -53,10 +53,12 @@ m4_define([OVSDB_CHECK_EXECUTION], m4_define([EXECUTION_EXAMPLES], [ OVSDB_CHECK_EXECUTION([insert row, query table], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": []}]]]], [[[{"uuid":["uuid","<0>"]}] @@ -65,16 +67,20 @@ OVSDB_CHECK_EXECUTION([insert row, query table], OVSDB_CHECK_EXECUTION([insert rows, query by value], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}]]], - [[[{"op": "insert", + [[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": [["name", "==", "zero"]]}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": [["name", "==", "one"]]}]]]], [[[{"uuid":["uuid","<0>"]}] @@ -85,7 +91,8 @@ OVSDB_CHECK_EXECUTION([insert rows, query by value], OVSDB_CHECK_EXECUTION([insert rows, query by named-uuid], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}, @@ -104,19 +111,23 @@ OVSDB_CHECK_EXECUTION([insert rows, query by named-uuid], OVSDB_CHECK_EXECUTION([insert rows, update rows by value], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}]]], - [[[{"op": "insert", + [[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}, "uuid-name": "first"}]]], - [[[{"op": "update", + [[["ordinals", + {"op": "update", "table": "ordinals", "where": [["name", "==", "zero"]], "row": {"name": "nought"}}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": [], "sort": ["number"]}]]]], @@ -128,19 +139,23 @@ OVSDB_CHECK_EXECUTION([insert rows, update rows by value], OVSDB_CHECK_EXECUTION([insert rows, mutate rows], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}]]], - [[[{"op": "insert", + [[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}, "uuid-name": "first"}]]], - [[[{"op": "mutate", + [[["ordinals", + {"op": "mutate", "table": "ordinals", "where": [["name", "==", "zero"]], "mutations": [["number", "+=", 2]]}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": [], "sort": ["number"]}]]]], @@ -152,7 +167,8 @@ OVSDB_CHECK_EXECUTION([insert rows, mutate rows], OVSDB_CHECK_EXECUTION([insert rows, delete by named-uuid], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}, @@ -172,18 +188,22 @@ OVSDB_CHECK_EXECUTION([insert rows, delete by named-uuid], OVSDB_CHECK_EXECUTION([insert rows, delete rows by value], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}]]], - [[[{"op": "insert", + [[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}, "uuid-name": "first"}]]], - [[[{"op": "delete", + [[["ordinals", + {"op": "delete", "table": "ordinals", "where": [["name", "==", "zero"]]}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": []}]]]], [[[{"uuid":["uuid","<0>"]}] @@ -194,18 +214,22 @@ OVSDB_CHECK_EXECUTION([insert rows, delete rows by value], OVSDB_CHECK_EXECUTION([insert rows, delete by (non-matching) value], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}]]], - [[[{"op": "insert", + [[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}, "uuid-name": "first"}]]], - [[[{"op": "delete", + [[["ordinals", + {"op": "delete", "table": "ordinals", "where": [["name", "==", "nought"]]}]]], - [[[{"op": "select", + [[["ordinals", + {"op": "select", "table": "ordinals", "where": [], "sort": ["number"]}]]]], @@ -217,7 +241,8 @@ OVSDB_CHECK_EXECUTION([insert rows, delete by (non-matching) value], OVSDB_CHECK_EXECUTION([insert rows, delete all], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}, "uuid-name": "first"}, @@ -237,7 +262,8 @@ OVSDB_CHECK_EXECUTION([insert rows, delete all], OVSDB_CHECK_EXECUTION([insert row, query table, commit], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "select", @@ -250,7 +276,8 @@ OVSDB_CHECK_EXECUTION([insert row, query table, commit], OVSDB_CHECK_EXECUTION([insert row, query table, commit durably], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "select", @@ -263,7 +290,8 @@ OVSDB_CHECK_EXECUTION([insert row, query table, commit durably], OVSDB_CHECK_EXECUTION([equality wait with correct rows], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -282,7 +310,8 @@ OVSDB_CHECK_EXECUTION([equality wait with correct rows], OVSDB_CHECK_EXECUTION([equality wait with extra row], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -302,7 +331,8 @@ OVSDB_CHECK_EXECUTION([equality wait with extra row], OVSDB_CHECK_EXECUTION([equality wait with missing row], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -320,7 +350,8 @@ OVSDB_CHECK_EXECUTION([equality wait with missing row], OVSDB_CHECK_EXECUTION([inequality wait with correct rows], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -339,7 +370,8 @@ OVSDB_CHECK_EXECUTION([inequality wait with correct rows], OVSDB_CHECK_EXECUTION([inequality wait with extra row], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -359,7 +391,8 @@ OVSDB_CHECK_EXECUTION([inequality wait with extra row], OVSDB_CHECK_EXECUTION([inequality wait with missing row], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -377,13 +410,16 @@ OVSDB_CHECK_EXECUTION([inequality wait with missing row], OVSDB_CHECK_EXECUTION([insert and update constraints], [CONSTRAINT_SCHEMA], - [[[[{"op": "insert", + [[[["constraints", + {"op": "insert", "table": "constrained", "row": {}}]]], - [[[{"op": "insert", + [[["constraints", + {"op": "insert", "table": "constrained", "row": {"positive": -1}}]]], - [[[{"op": "update", + [[["constraints", + {"op": "update", "table": "constrained", "where": [], "row": {"positive": -2}}]]]], @@ -394,7 +430,8 @@ OVSDB_CHECK_EXECUTION([insert and update constraints], OVSDB_CHECK_EXECUTION([referential integrity -- simple], [CONSTRAINT_SCHEMA], - [[[[{"op": "insert", + [[[["constraints", + {"op": "insert", "table": "b", "row": {"b": 1}, "uuid-name": "brow"}, @@ -410,25 +447,32 @@ OVSDB_CHECK_EXECUTION([referential integrity -- simple], "table": "a", "row": {"a": 2, "a2b": ["set", [["named-uuid", "brow"]]]}}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "b", "where": []}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "a", "where": [["a", "==", 0]]}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "b", "where": []}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "a", "where": [["a", "==", 1]]}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "b", "where": []}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "a", "where": [["a", "==", 2]]}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "b", "where": []}]]]], [[[{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"uuid":["uuid","<2>"]},{"uuid":["uuid","<3>"]}] @@ -443,7 +487,8 @@ OVSDB_CHECK_EXECUTION([referential integrity -- simple], OVSDB_CHECK_EXECUTION([referential integrity -- mutual references], [CONSTRAINT_SCHEMA], - [[[[{"op": "insert", + [[[["constraints", + {"op": "insert", "table": "a", "row": {"a": 0, "a2b": ["set", [["named-uuid", "row2"]]], @@ -455,23 +500,29 @@ OVSDB_CHECK_EXECUTION([referential integrity -- mutual references], "b2b": ["set", [["named-uuid", "row2"]]], "b2a": ["set", [["named-uuid", "row1"]]]}, "uuid-name": "row2"}]]], - [[[{"op": "insert", + [[["constraints", + {"op": "insert", "table": "a", "row": {"a2b": ["set", [["uuid", "b516b960-5b19-4fc2-bb82-fe1cbd6d0241"]]]}}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "a", "where": [["a", "==", 0]]}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "b", "where": [["b", "==", 1]]}]]], dnl Try the deletions again to make sure that the refcounts got rolled back. - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "a", "where": [["a", "==", 0]]}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "b", "where": [["b", "==", 1]]}]]], - [[[{"op": "delete", + [[["constraints", + {"op": "delete", "table": "a", "where": [["a", "==", 0]]}, {"op": "delete", diff --git a/tests/ovsdb-file.at b/tests/ovsdb-file.at index d08b6de8..4f8f7ee4 100644 --- a/tests/ovsdb-file.at +++ b/tests/ovsdb-file.at @@ -36,7 +36,8 @@ AT_DATA([schema], [ORDINAL_SCHEMA touch .db.~lock~ AT_CHECK([ovsdb-tool create db schema], [0], [], [ignore]) AT_CHECK([[ovsdb-tool transact db ' - [{"op": "insert", + ["ordinals", + {"op": "insert", "table": "ordinals", "row": {"name": "five", "number": 5}}, {"op": "comment", diff --git a/tests/ovsdb-idl.at b/tests/ovsdb-idl.at index 6fc57f37..9b90b032 100644 --- a/tests/ovsdb-idl.at +++ b/tests/ovsdb-idl.at @@ -38,7 +38,8 @@ OVSDB_CHECK_IDL([simple idl, initially empty, no ops], OVSDB_CHECK_IDL([simple idl, initially empty, various ops], [], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "simple", "row": {"i": 1, "r": 2.0, @@ -54,15 +55,18 @@ OVSDB_CHECK_IDL([simple idl, initially empty, various ops], {"op": "insert", "table": "simple", "row": {}}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "simple", "where": [], "row": {"b": true}}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "simple", "where": [], "row": {"r": 123.5}}]' \ - '[{"op": "insert", + '["idltest", + {"op": "insert", "table": "simple", "row": {"i": -1, "r": 125, @@ -73,11 +77,13 @@ OVSDB_CHECK_IDL([simple idl, initially empty, various ops], "ba": ["set", [false]], "sa": ["set", []], "ua": ["set", []]}}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "simple", "where": [["i", "<", 1]], "row": {"s": "newstring"}}]' \ - '[{"op": "delete", + '["idltest", + {"op": "delete", "table": "simple", "where": [["i", "==", 0]]}]' \ 'reconnect']], @@ -109,7 +115,8 @@ OVSDB_CHECK_IDL([simple idl, initially empty, various ops], ]]) OVSDB_CHECK_IDL([simple idl, initially populated], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "simple", "row": {"i": 1, "r": 2.0, @@ -125,7 +132,8 @@ OVSDB_CHECK_IDL([simple idl, initially populated], {"op": "insert", "table": "simple", "row": {}}]']], - [['[{"op": "update", + [['["idltest", + {"op": "update", "table": "simple", "where": [], "row": {"b": true}}]']], @@ -138,7 +146,8 @@ OVSDB_CHECK_IDL([simple idl, initially populated], ]]) OVSDB_CHECK_IDL([simple idl, writing via IDL], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "simple", "row": {"i": 1, "r": 2.0, @@ -168,7 +177,8 @@ OVSDB_CHECK_IDL([simple idl, writing via IDL], ]]) OVSDB_CHECK_IDL([simple idl, increment operation], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "simple", "row": {}}]']], [['set 0 r 2.0, increment simple i']], @@ -180,11 +190,13 @@ OVSDB_CHECK_IDL([simple idl, increment operation], OVSDB_CHECK_IDL([self-linking idl, consistent ops], [], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "link1", "row": {"i": 0, "k": ["named-uuid", "self"]}, "uuid-name": "self"}]' \ - '[{"op": "insert", + '["idltest", + {"op": "insert", "table": "link1", "row": {"i": 1, "k": ["named-uuid", "row2"]}, "uuid-name": "row1"}, @@ -192,11 +204,13 @@ OVSDB_CHECK_IDL([self-linking idl, consistent ops], "table": "link1", "row": {"i": 2, "k": ["named-uuid", "row1"]}, "uuid-name": "row2"}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "link1", "where": [["i", "==", 1]], "row": {"k": ["uuid", "#1#"]}}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "link1", "where": [], "row": {"k": ["uuid", "#0#"]}}]']], @@ -220,27 +234,33 @@ OVSDB_CHECK_IDL([self-linking idl, consistent ops], OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], [], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "link1", "row": {"i": 0, "k": ["uuid", "cf197cc5-c8c9-42f5-82d5-c71a9f2cb96b"]}}]' \ - '+[{"op": "insert", + '+["idltest", + {"op": "insert", "table": "link1", "uuid-name": "one", "row": {"i": 1, "k": ["named-uuid", "one"]}}, {"op": "insert", "table": "link1", "row": {"i": 2, "k": ["named-uuid", "one"]}}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "link1", "where": [], "row": {"k": ["uuid", "c2fca39a-e69a-42a4-9c56-5eca85839ce9"]}}]' \ - '+[{"op": "delete", + '+["idltest", + {"op": "delete", "table": "link1", "where": [["_uuid", "==", ["uuid", "#1#"]]]}]' \ - '+[{"op": "delete", + '+["idltest", + {"op": "delete", "table": "link1", "where": [["_uuid", "==", ["uuid", "#2#"]]]}]' \ - '[{"op": "delete", + '["idltest", + {"op": "delete", "table": "link1", "where": []}]' \ ]], @@ -260,7 +280,8 @@ OVSDB_CHECK_IDL([self-linking idl, inconsistent ops], OVSDB_CHECK_IDL([self-linking idl, sets], [], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "link1", "row": {"i": 0, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i0"]]]}, "uuid-name": "i0"}, @@ -276,15 +297,18 @@ OVSDB_CHECK_IDL([self-linking idl, sets], "table": "link1", "row": {"i": 3, "k": ["named-uuid", "i0"], "ka": ["set", [["named-uuid", "i3"]]]}, "uuid-name": "i3"}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "link1", "where": [], "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "#1#"], ["uuid", "#2#"], ["uuid", "#3#"]]]}}]' \ - '[{"op": "update", + '["idltest", + {"op": "update", "table": "link1", "where": [], "row": {"ka": ["set", [["uuid", "#0#"], ["uuid", "88702e78-845b-4a6e-ad08-cf68922ae84a"], ["uuid", "#2#"], ["uuid", "1ac2b12e-b767-4805-a55d-43976e40c465"]]]}}]' \ - '+[{"op": "delete", + '+["idltest", + {"op": "delete", "table": "link1", "where": []}]']], [[000: empty @@ -306,7 +330,8 @@ OVSDB_CHECK_IDL([self-linking idl, sets], OVSDB_CHECK_IDL([external-linking idl, consistent ops], [], - [['[{"op": "insert", + [['["idltest", + {"op": "insert", "table": "link2", "row": {"i": 0}, "uuid-name": "row0"}, diff --git a/tests/ovsdb-monitor.at b/tests/ovsdb-monitor.at index 5ebf1228..87afa1ee 100644 --- a/tests/ovsdb-monitor.at +++ b/tests/ovsdb-monitor.at @@ -24,7 +24,7 @@ m4_define([OVSDB_CHECK_MONITOR], m4_foreach([txn], [$3], [AT_CHECK([ovsdb-tool transact db 'txn'], [0], [ignore], [ignore])]) AT_CHECK([ovsdb-server --detach --pidfile=$PWD/server-pid --remote=punix:socket --unixctl=$PWD/unixctl db], [0], [ignore], [ignore]) - AT_CHECK([ovsdb-client --detach --pidfile=$PWD/client-pid monitor --format=csv unix:socket $4 > output], + AT_CHECK([ovsdb-client --detach --pidfile=$PWD/client-pid monitor --format=csv unix:socket ordinals $4 > output], [0], [ignore], [ignore], [kill `cat server-pid`]) m4_foreach([txn], [$5], [AT_CHECK([ovsdb-client transact unix:socket 'txn'], [0], @@ -40,7 +40,8 @@ OVSDB_CHECK_MONITOR([monitor insert into empty table], [ORDINAL_SCHEMA], [], [ordinals], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}]]]], [[row,action,name,number,_version @@ -49,11 +50,13 @@ OVSDB_CHECK_MONITOR([monitor insert into empty table], OVSDB_CHECK_MONITOR([monitor insert into populated table], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 10, "name": "ten"}}]]]], [ordinals], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}]]]], [[row,action,name,number,_version @@ -64,11 +67,13 @@ row,action,name,number,_version OVSDB_CHECK_MONITOR([monitor delete], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 10, "name": "ten"}}]]]], [ordinals], - [[[[{"op": "delete", + [[[["ordinals", + {"op": "delete", "table": "ordinals", "where": [["number", "==", 10]]}]]]], [[row,action,name,number,_version @@ -79,11 +84,13 @@ row,action,name,number,_version OVSDB_CHECK_MONITOR([monitor row update], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 10, "name": "ten"}}]]]], [ordinals], - [[[[{"op": "update", + [[[["ordinals", + {"op": "update", "table": "ordinals", "where": [["number", "==", 10]], "row": {"name": "five plus five"}}]]]], @@ -96,15 +103,18 @@ row,action,name,number,_version OVSDB_CHECK_MONITOR([monitor no-op row updates], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 10, "name": "ten"}}]]]], [ordinals], - [[[[{"op": "update", + [[[["ordinals", + {"op": "update", "table": "ordinals", "where": [["number", "==", 10]], "row": {"number": 10, "name": "ten"}}]]], - [[[{"op": "insert", + [[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 9, "name": "nine"}}]]]], [[row,action,name,number,_version @@ -115,11 +125,13 @@ row,action,name,number,_version OVSDB_CHECK_MONITOR([monitor insert-and-update transaction], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 10, "name": "ten"}}]]]], [ordinals], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 9, "name": "nine"}, "uuid-name": "nine"}, @@ -136,11 +148,13 @@ row,action,name,number,_version OVSDB_CHECK_MONITOR([monitor insert-update-and-delete transaction], [ORDINAL_SCHEMA], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 10, "name": "ten"}}]]]], [ordinals], - [[[[{"op": "insert", + [[[["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 9, "name": "nine"}, "uuid-name": "nine"}, diff --git a/tests/ovsdb-server.at b/tests/ovsdb-server.at index 0b021899..8d81e112 100644 --- a/tests/ovsdb-server.at +++ b/tests/ovsdb-server.at @@ -38,6 +38,23 @@ cat stdout >> output EXECUTION_EXAMPLES +AT_SETUP([database multiplexing implementation]) +AT_KEYWORDS([ovsdb server positive]) +AT_DATA([schema], [ORDINAL_SCHEMA +]) +AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) +AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --unixctl=$PWD/unixctl --remote=punix:socket db], [0], [ignore], [ignore]) +AT_CHECK( + [[ovsdb-client list-dbs unix:socket]], + [0], [ordinals +], [ignore], [test ! -e pid || kill `cat pid`]) +AT_CHECK( + [[ovsdb-client get-schema unix:socket nonexistent]], + [1], [], [[ovsdb-client: syntax "{"syntax":"[\"nonexistent\"]","details":"get_schema request specifies unknown database nonexistent","error":"unknown database"}": syntax error: Parsing database schema failed: Required 'name' member is missing. +]], [test ! -e pid || kill `cat pid`]) +OVSDB_SERVER_SHUTDOWN +AT_CLEANUP + AT_SETUP([--remote=db: implementation]) AT_KEYWORDS([ovsdb server positive]) AT_DATA([schema], @@ -50,13 +67,15 @@ AT_DATA([schema], AT_CHECK([ovsdb-tool create db schema], [0], [ignore], [ignore]) AT_CHECK( [[ovsdb-tool transact db \ - '[{"op": "insert", + '["mydb", + {"op": "insert", "table": "Manager", "row": {"manager": "punix:socket"}}]']], [0], [ignore], [ignore]) AT_CHECK([ovsdb-server --detach --pidfile=$PWD/pid --remote=db:Manager,manager --unixctl=$PWD/unixctl db], [0], [ignore], [ignore]) AT_CHECK( [[ovsdb-client transact unix:socket \ - '[{"op": "select", + '["mydb", + {"op": "select", "table": "Manager", "where": [], "columns": ["manager"]}]']], diff --git a/tests/ovsdb-trigger.at b/tests/ovsdb-trigger.at index 97330fb5..c2b1b967 100644 --- a/tests/ovsdb-trigger.at +++ b/tests/ovsdb-trigger.at @@ -14,7 +14,8 @@ m4_define([OVSDB_CHECK_TRIGGER], OVSDB_CHECK_TRIGGER([trigger fires immediately], ['ORDINAL_SCHEMA' [\ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -36,7 +37,8 @@ OVSDB_CHECK_TRIGGER([trigger fires immediately], OVSDB_CHECK_TRIGGER([trigger times out], ['ORDINAL_SCHEMA' [\ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", @@ -58,14 +60,16 @@ t=10: trigger 0 (delayed): [{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]},{"de OVSDB_CHECK_TRIGGER([trigger fires after delay], ['ORDINAL_SCHEMA' [\ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}}]' \ '["advance", 5]' \ - '[{"op": "wait", + '["ordinals", + {"op": "wait", "timeout": 10, "table": "ordinals", "where": [], @@ -75,7 +79,8 @@ OVSDB_CHECK_TRIGGER([trigger fires after delay], {"name": "one", "number": 1}, {"name": "two", "number": 2}]}]' \ '["advance", 5]' \ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 2, "name": "two"}}]']], [[t=0: trigger 0 (immediate): [{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}] @@ -86,14 +91,16 @@ t=10: trigger 1 (delayed): [{}] OVSDB_CHECK_TRIGGER([delayed trigger modifies database], ['ORDINAL_SCHEMA' [\ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}}]' \ '["advance", 5]' \ - '[{"op": "wait", + '["ordinals", + {"op": "wait", "timeout": 10, "table": "ordinals", "where": [], @@ -106,11 +113,13 @@ OVSDB_CHECK_TRIGGER([delayed trigger modifies database], "table": "ordinals", "where": [["number", "<", 2]]}]' \ '["advance", 5]' \ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 2, "name": "two"}}]' \ '["advance", 5]' \ - '[{"op": "select", + '["ordinals", + {"op": "select", "table": "ordinals", "where": []}]']], [[t=0: trigger 0 (immediate): [{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}] @@ -122,14 +131,16 @@ t=15: trigger 3 (immediate): [{"rows":[{"_uuid":["uuid","<2>"],"_version":["uuid OVSDB_CHECK_TRIGGER([one delayed trigger wakes up another], ['ORDINAL_SCHEMA' [\ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 0, "name": "zero"}}, {"op": "insert", "table": "ordinals", "row": {"number": 1, "name": "one"}}]' \ '["advance", 5]' \ - '[{"op": "wait", + '["ordinals", + {"op": "wait", "timeout": 10, "table": "ordinals", "where": [], @@ -142,7 +153,8 @@ OVSDB_CHECK_TRIGGER([one delayed trigger wakes up another], {"op": "insert", "table": "ordinals", "row": {"number": 3, "name": "three"}}]' \ - '[{"op": "wait", + '["ordinals", + {"op": "wait", "timeout": 10, "table": "ordinals", "where": [], @@ -155,11 +167,13 @@ OVSDB_CHECK_TRIGGER([one delayed trigger wakes up another], "table": "ordinals", "where": [["number", "<", 2]]}]' \ '["advance", 5]' \ - '[{"op": "insert", + '["ordinals", + {"op": "insert", "table": "ordinals", "row": {"number": 2, "name": "two"}}]' \ '["advance", 5]' \ - '[{"op": "select", + '["ordinals", + {"op": "select", "table": "ordinals", "where": []}]']], [[t=0: trigger 0 (immediate): [{"uuid":["uuid","<0>"]},{"uuid":["uuid","<1>"]}] |