summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBen Pfaff <blp@nicira.com>2011-05-31 12:48:49 -0700
committerBen Pfaff <blp@nicira.com>2011-05-31 13:45:59 -0700
commitdd089894cacbf11f0e9359f52ecd2923b627ba90 (patch)
tree1fbc1479c277f0ff90e620668e0f12f9f45d968e /tests
parentb20ae4b33368497bfd674873508dd8a2941077f1 (diff)
downloadopenvswitch-dd089894cacbf11f0e9359f52ecd2923b627ba90.tar.gz
ovsdb: Add test for number-of-elements constraints.
This test already passes, but I did not see any existing test that checked for this problem.
Diffstat (limited to 'tests')
-rw-r--r--tests/ovsdb-mutation.at39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/ovsdb-mutation.at b/tests/ovsdb-mutation.at
index 4308dd305..3d753176d 100644
--- a/tests/ovsdb-mutation.at
+++ b/tests/ovsdb-mutation.at
@@ -502,6 +502,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",