summaryrefslogtreecommitdiff
path: root/tests/ovsdb-table.at
blob: 26ff90e7a28ef790bda06ebb7bf060f5591cfa96 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
AT_BANNER([OVSDB -- tables])

OVSDB_CHECK_POSITIVE_CPY([non-root table with one column],
  [[parse-table mytable '{"columns": {"name": {"type": "string"}}}']],
  [[{"columns":{"name":{"type":"string"}}}]])

OVSDB_CHECK_POSITIVE_CPY([immutable table with one column],
  [[parse-table mytable \
    '{"columns": {"name": {"type": "string"}},
      "mutable": false}']],
  [[{"columns":{"name":{"type":"string"}},"mutable":false}]])

OVSDB_CHECK_POSITIVE_CPY([root table with one column],
  [[parse-table mytable \
    '{"columns": {"name": {"type": "string"}},
      "isRoot": true}']],
  [[{"columns":{"name":{"type":"string"}},"isRoot":true}]])

OVSDB_CHECK_POSITIVE_CPY([non-root table with default_is_root=true],
  [[parse-table mytable '{"columns": {"name": {"type": "string"}}}' true]],
  [[{"columns":{"name":{"type":"string"}},"isRoot":false}]])

OVSDB_CHECK_POSITIVE_CPY([root table with default_is_root=true],
  [[parse-table mytable \
    '{"columns": {"name": {"type": "string"}},
      "isRoot": true}' true]],
  [[{"columns":{"name":{"type":"string"}}}]])

OVSDB_CHECK_POSITIVE_CPY([table with maxRows of 2],
  [[parse-table mytable '{"columns": {"name": {"type": "string"}}, 
                          "maxRows": 2}']],
  [[{"columns":{"name":{"type":"string"}},"maxRows":2}]])

OVSDB_CHECK_POSITIVE_CPY([table with index],
  [[parse-table mytable '{"columns": {"a": {"type": "integer"},
                                      "b": {"type": "string"}},
                          "indexes": [["b", "a"]]}']],
  [[{"columns":{"a":{"type":"integer"},"b":{"type":"string"}},"indexes":[["b","a"]]}]])

OVSDB_CHECK_NEGATIVE_CPY([table with syntax error in index],
  [[parse-table mytable '{"columns": {"a": {"type": "integer"},
                                      "b": {"type": "string"}},
                          "indexes": [["b", "a"], [0]]}']],
  [[array of distinct column names expected]])

OVSDB_CHECK_NEGATIVE_CPY([table with empty index],
  [[parse-table mytable '{"columns": {"a": {"type": "integer"},
                                      "b": {"type": "string"}},
                          "indexes": [[]]}']],
  [[index must have at least one column]])

OVSDB_CHECK_NEGATIVE_CPY([table with index of ephemeral column],
  [[parse-table mytable '{"columns": {"a": {"type": "integer",
                                            "ephemeral": true},
                                      "b": {"type": "string"}},
                          "indexes": [["b", "a"]]}']],
  [[ephemeral columns (such as a) may not be indexed]])

OVSDB_CHECK_NEGATIVE_CPY([column names may not begin with _],
  [[parse-table mytable \
    '{"columns": {"_column": {"type": "integer"}}}']],
  [[names beginning with "_" are reserved]],
  [table])

OVSDB_CHECK_NEGATIVE_CPY([table must have at least one column (1)],
  [[parse-table mytable '{}']],
  [[Parsing table schema for table mytable failed: Required 'columns' member is missing.]])

OVSDB_CHECK_NEGATIVE_CPY([table must have at least one column (2)],
  [[parse-table mytable '{"columns": {}}']],
  [[table must have at least one column]])

OVSDB_CHECK_NEGATIVE_CPY([table maxRows must be positive],
  [[parse-table mytable '{"columns": {"name": {"type": "string"}}, 
                          "maxRows": 0}']],
  [[syntax "{"columns":{"name":{"type":"string"}},"maxRows":0}": syntax error: maxRows must be at least 1]])