X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fovsdb-mutation.at;h=fc898b56d92ac8f76d0b8667d3de7c392c3bff07;hb=c5cf10598f8c9f4428291e9df3ecd72a05fb1ccf;hp=4308dd3059f3763ef9be9f6f3821d54c1d30403d;hpb=5f55c39b21e69025045437ffbd3bb98fe6ce2e89;p=sliver-openvswitch.git diff --git a/tests/ovsdb-mutation.at b/tests/ovsdb-mutation.at index 4308dd305..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": @@ -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",