X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fovsdb-mutation.at;h=fc898b56d92ac8f76d0b8667d3de7c392c3bff07;hb=003ce655b7116d18c86a74c50391e54990346931;hp=cf4ca01100bc77b9a2d34e9fc1c3c9e30eb65da0;hpb=bd76d25d8b3b7d11c5a326e91d784ad2cdeecd45;p=sliver-openvswitch.git diff --git a/tests/ovsdb-mutation.at b/tests/ovsdb-mutation.at index cf4ca0110..fc898b56d 100644 --- a/tests/ovsdb-mutation.at +++ b/tests/ovsdb-mutation.at @@ -99,6 +99,18 @@ test-ovsdb: syntax "["u","delete",["uuid","9179ca6d-6d65-400a-b455-3ad92783a099" ]]) AT_CLEANUP +AT_SETUP([disallowed mutations on immutable columns]) +AT_KEYWORDS([ovsdb negative mutation]) +AT_CHECK([[test-ovsdb parse-mutations \ + '{"columns": + {"i": {"type": "integer", "mutable": false}}}' \ + '[["i", "+=", 1]]' +]], + [1], [], + [[test-ovsdb: syntax "["i","+=",1]": constraint violation: Cannot mutate immutable column i in table mytable. +]]) +AT_CLEANUP + OVSDB_CHECK_POSITIVE([mutations on sets], [[parse-mutations \ '{"columns": @@ -143,11 +155,11 @@ OVSDB_CHECK_POSITIVE([mutations on sets], [["r","/=",4]] [["r","insert",["set",[1,2]]]] [["r","delete",["set",[1,2,3]]]] -[["b","insert",["set",[true]]]] -[["b","delete",["set",[false]]]] -[["s","insert",["set",["a"]]]] +[["b","insert",true]] +[["b","delete",false]] +[["s","insert","a"]] [["s","delete",["set",["a","b"]]]] -[["u","insert",["set",[["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]] +[["u","insert",["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]] [["u","delete",["set",[["uuid","9179ca6d-6d65-400a-b455-3ad92783a099"],["uuid","b10d28f7-af18-4a67-9e78-2a6394516c59"]]]]]]], [mutation]) @@ -449,13 +461,13 @@ OVSDB_CHECK_POSITIVE([executing mutations on integer sets], {"i": ["set", [0, 1, 2]]}']]], [[mutation 0: row 0: no change -row 1: {"i":["set",[1]]} +row 1: {"i":1} row 2: {"i":["set",[1,2]]} row 3: {"i":["set",[1,2,3]]} mutation 1: row 0: no change -row 1: {"i":["set",[-2]]} +row 1: {"i":-2} row 2: {"i":["set",[-2,-1]]} row 3: {"i":["set",[-2,-1,0]]} @@ -478,7 +490,7 @@ row 2: no change row 3: constraint violation: Result of "%=" operation contains duplicates. mutation 5: -row 0: {"i":["set",[1]]} +row 0: {"i":1} row 1: {"i":["set",[0,1]]} row 2: no change row 3: no change @@ -492,7 +504,7 @@ row 3: {"i":["set",[0,1,2,3]]} mutation 7: row 0: no change row 1: no change -row 2: {"i":["set",[0]]} +row 2: {"i":0} row 3: {"i":["set",[0,2]]} mutation 8: @@ -502,6 +514,45 @@ row 2: no change row 3: {"i":["set",[0,1]]} ]], [mutation]) +OVSDB_CHECK_POSITIVE([executing mutations on integer sets with constraints], + [[execute-mutations \ + '{"columns": {"i": {"type": {"key": "integer", + "min": 1, + "max": 2}}}}' \ + '[[["i", "insert", ["set", [1]]]], + [["i", "insert", ["set", [2]]]], + [["i", "delete", ["set", [1]]]], + [["i", "delete", ["set", [2]]]], + [["i", "delete", ["set", [0, 1]]]]]' \ + '[{"i": ["set", [0]]}, + {"i": ["set", [2]]}, + {"i": ["set", [0, 1]]}']]], + [[mutation 0: +row 0: {"i":["set",[0,1]]} +row 1: {"i":["set",[1,2]]} +row 2: no change + +mutation 1: +row 0: {"i":["set",[0,2]]} +row 1: no change +row 2: constraint violation: Attempted to store 3 elements in set of 1 to 2 integers. + +mutation 2: +row 0: no change +row 1: no change +row 2: {"i":0} + +mutation 3: +row 0: no change +row 1: constraint violation: Attempted to store 0 elements in set of 1 to 2 integers. +row 2: no change + +mutation 4: +row 0: constraint violation: Attempted to store 0 elements in set of 1 to 2 integers. +row 1: no change +row 2: constraint violation: Attempted to store 0 elements in set of 1 to 2 integers. +]], [mutation]) + OVSDB_CHECK_POSITIVE([executing mutations on real sets], [[execute-mutations \ '{"columns": {"r": {"type": {"key": {"type": "real", @@ -512,52 +563,52 @@ OVSDB_CHECK_POSITIVE([executing mutations on real sets], [["r", "*=", 2.5]], [["r", "/=", 4]], [["r", "*=", 0]], - [["r", "insert", ["set", [1.5]]]], - [["r", "insert", ["set", [3]]]], + [["r", "insert", 1.5]], + [["r", "insert", 3]], [["r", "delete", ["set", [1.5, 3.5]]]], [["r", "delete", ["set", [0.5, 1.5, 2.5]]]]]' \ '[{"r": ["set", []]}, - {"r": ["set", [0.5]]}, + {"r": 0.5}, {"r": ["set", [0.5, 1.5]]}, {"r": ["set", [0.5, 1.5, 2.5]]}']]], [[mutation 0: row 0: no change -row 1: {"r":["set",[1]]} +row 1: {"r":1} row 2: {"r":["set",[1,2]]} row 3: {"r":["set",[1,2,3]]} mutation 1: row 0: no change -row 1: {"r":["set",[-1]]} +row 1: {"r":-1} row 2: {"r":["set",[-1,0]]} row 3: {"r":["set",[-1,0,1]]} mutation 2: row 0: no change -row 1: {"r":["set",[1.25]]} +row 1: {"r":1.25} row 2: {"r":["set",[1.25,3.75]]} row 3: constraint violation: 6.25 is greater than maximum allowed value 6 mutation 3: row 0: no change -row 1: {"r":["set",[0.125]]} +row 1: {"r":0.125} row 2: {"r":["set",[0.125,0.375]]} row 3: {"r":["set",[0.125,0.375,0.625]]} mutation 4: row 0: no change -row 1: {"r":["set",[0]]} +row 1: {"r":0} row 2: constraint violation: Result of "*=" operation contains duplicates. row 3: constraint violation: Result of "*=" operation contains duplicates. mutation 5: -row 0: {"r":["set",[1.5]]} +row 0: {"r":1.5} row 1: {"r":["set",[0.5,1.5]]} row 2: no change row 3: no change mutation 6: -row 0: {"r":["set",[3]]} +row 0: {"r":3} row 1: {"r":["set",[0.5,3]]} row 2: {"r":["set",[0.5,1.5,3]]} row 3: {"r":["set",[0.5,1.5,2.5,3]]} @@ -565,7 +616,7 @@ row 3: {"r":["set",[0.5,1.5,2.5,3]]} mutation 7: row 0: no change row 1: no change -row 2: {"r":["set",[0.5]]} +row 2: {"r":0.5} row 3: {"r":["set",[0.5,2.5]]} mutation 8: @@ -589,13 +640,13 @@ OVSDB_CHECK_POSITIVE([executing mutations on boolean sets], {"b": ["set", [true]]}, {"b": ["set", [false, true]]}']]], [[mutation 0: -row 0: {"b":["set",[false]]} +row 0: {"b":false} row 1: no change row 2: {"b":["set",[false,true]]} row 3: no change mutation 1: -row 0: {"b":["set",[true]]} +row 0: {"b":true} row 1: {"b":["set",[false,true]]} row 2: no change row 3: no change @@ -610,13 +661,13 @@ mutation 3: row 0: no change row 1: {"b":["set",[]]} row 2: no change -row 3: {"b":["set",[true]]} +row 3: {"b":true} mutation 4: row 0: no change row 1: no change row 2: {"b":["set",[]]} -row 3: {"b":["set",[false]]} +row 3: {"b":false} mutation 5: row 0: no change @@ -639,13 +690,13 @@ OVSDB_CHECK_POSITIVE([executing mutations on string sets], {"s": ["set", ["a", "b"]]}, {"s": ["set", ["a", "b", "c", "d"]]}']]], [[mutation 0: -row 0: {"s":["set",["a"]]} +row 0: {"s":"a"} row 1: no change row 2: no change row 3: no change mutation 1: -row 0: {"s":["set",["b"]]} +row 0: {"s":"b"} row 1: {"s":["set",["a","b"]]} row 2: no change row 3: no change @@ -659,13 +710,13 @@ row 3: no change mutation 3: row 0: no change row 1: {"s":["set",[]]} -row 2: {"s":["set",["b"]]} +row 2: {"s":"b"} row 3: {"s":["set",["b","c","d"]]} mutation 4: row 0: no change row 1: no change -row 2: {"s":["set",["a"]]} +row 2: {"s":"a"} row 3: {"s":["set",["a","c","d"]]} mutation 5: @@ -689,19 +740,19 @@ OVSDB_CHECK_POSITIVE([executing mutations on uuid sets], {"u": ["set", [["uuid", "a60fe7ff-317b-4568-9106-892b37445313"]]]}, {"u": ["set", [["uuid", "2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]}']]], [[mutation 0: -row 0: {"u":["set",[["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} +row 0: {"u":["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]} row 1: no change row 2: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} mutation 1: -row 0: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} +row 0: {"u":["uuid","a60fe7ff-317b-4568-9106-892b37445313"]} row 1: {"u":["set",[["uuid","a60fe7ff-317b-4568-9106-892b37445313"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 2: no change row 3: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} mutation 2: -row 0: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"]]]} +row 0: {"u":["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"]} row 1: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","ddd9e79d-7782-414c-8b22-1046c60b6ec2"]]]} row 2: {"u":["set",[["uuid","2607d30e-e652-4927-9fec-8bbf1b60c7e9"],["uuid","a60fe7ff-317b-4568-9106-892b37445313"]]]} row 3: no change