[tarantool-patches] [PATCH v3 07/10] box: sort error codes in misc.test

Kirill Shcherbatov kshcherbatov at tarantool.org
Thu Jun 14 20:32:25 MSK 2018


As error codes were not sorted, changing any of error
constants significantly change test case output. This
cause unnecessary changes on each such commit.
---
 test/box/misc.result   | 325 +++++++++++++++++++++++++------------------------
 test/box/misc.test.lua |   4 +-
 2 files changed, 166 insertions(+), 163 deletions(-)

diff --git a/test/box/misc.result b/test/box/misc.result
index a2bbdca..930d0a8 100644
--- a/test/box/misc.result
+++ b/test/box/misc.result
@@ -319,173 +319,174 @@ type(require('yaml').encode(box.slab.info()));
 ----------------
 t = {}
 for k,v in pairs(box.error) do
-   table.insert(t, 'box.error.'..tostring(k)..' : '..tostring(v))
+   if type(v) == 'number' then
+    t[v] = 'box.error.'..tostring(k)
+   end
 end;
 ---
 ...
 t;
 ---
-- - 'box.error.UNKNOWN_REPLICA : 62'
-  - 'box.error.WRONG_INDEX_RECORD : 106'
-  - 'box.error.NO_SUCH_TRIGGER : 34'
-  - 'box.error.SEQUENCE_EXISTS : 146'
-  - 'box.error.CHECKPOINT_IN_PROGRESS : 120'
-  - 'box.error.FIELD_TYPE : 23'
-  - 'box.error.SQL_BIND_PARAMETER_MAX : 156'
-  - 'box.error.WRONG_SPACE_FORMAT : 141'
-  - 'box.error.SQL_BIND_TYPE : 155'
-  - 'box.error.UNKNOWN_UPDATE_OP : 28'
-  - 'box.error.WRONG_COLLATION_OPTIONS : 151'
-  - 'box.error.CURSOR_NO_TRANSACTION : 80'
-  - 'box.error.TUPLE_REF_OVERFLOW : 86'
-  - 'box.error.ALTER_SEQUENCE : 143'
-  - 'box.error.INVALID_XLOG_NAME : 75'
-  - 'box.error.SAVEPOINT_EMPTY_TX : 60'
-  - 'box.error.NO_SUCH_FUNCTION : 51'
-  - 'box.error.ROLE_LOOP : 87'
-  - 'box.error.TUPLE_NOT_FOUND : 4'
-  - 'box.error.LOADING : 116'
-  - 'box.error.VIEW_MISSING_SQL : 161'
-  - 'box.error.BACKUP_IN_PROGRESS : 129'
-  - 'box.error.DROP_USER : 44'
-  - 'box.error.MODIFY_INDEX : 14'
-  - 'box.error.PASSWORD_MISMATCH : 47'
-  - 'box.error.UNSUPPORTED_ROLE_PRIV : 98'
-  - 'box.error.ACCESS_DENIED : 42'
-  - 'box.error.CANT_CREATE_COLLATION : 150'
-  - 'box.error.USER_EXISTS : 46'
-  - 'box.error.WAL_IO : 40'
-  - 'box.error.PROC_RET : 21'
-  - 'box.error.PRIV_GRANTED : 89'
-  - 'box.error.CREATE_SPACE : 9'
-  - 'box.error.GRANT : 88'
-  - 'box.error.INVALID_INDEX_FILE : 131'
-  - 'box.error.UNKNOWN_SCHEMA_OBJECT : 49'
-  - 'box.error.WRONG_DD_VERSION : 140'
-  - 'box.error.CREATE_ROLE : 84'
-  - 'box.error.VINYL_MAX_TUPLE_SIZE : 139'
-  - 'box.error.LOAD_FUNCTION : 99'
-  - 'box.error.INVALID_XLOG : 74'
-  - 'box.error.PRIV_NOT_GRANTED : 91'
-  - 'box.error.TRANSACTION_CONFLICT : 97'
-  - 'box.error.GUEST_USER_PASSWORD : 96'
-  - 'box.error.PROC_C : 102'
-  - 'box.error.INVALID_RUN_FILE : 132'
-  - 'box.error.NONMASTER : 6'
-  - 'box.error.MEMTX_MAX_TUPLE_SIZE : 110'
-  - 'box.error.DROP_FUNCTION : 71'
-  - 'box.error.CFG : 59'
-  - 'box.error.NO_SUCH_FIELD : 37'
-  - 'box.error.CONNECTION_TO_SELF : 117'
-  - 'box.error.FUNCTION_MAX : 54'
-  - 'box.error.ILLEGAL_PARAMS : 1'
-  - 'box.error.PARTIAL_KEY : 136'
-  - 'box.error.SAVEPOINT_NO_TRANSACTION : 114'
-  - 'box.error.LOAD_MODULE : 138'
-  - 'box.error.FUNCTION_LANGUAGE : 100'
-  - 'box.error.ROLE_GRANTED : 90'
-  - 'box.error.CHECKPOINT_ROLLBACK : 134'
-  - 'box.error.NO_SUCH_USER : 45'
-  - 'box.error.CANT_UPDATE_PRIMARY_KEY : 94'
-  - 'box.error.EXACT_MATCH : 19'
-  - 'box.error.ROLE_EXISTS : 83'
-  - 'box.error.REPLICASET_UUID_IS_RO : 65'
-  - 'box.error.INDEX_TYPE : 13'
-  - 'box.error.NO_SUCH_PROC : 33'
-  - 'box.error.MEMORY_ISSUE : 2'
-  - 'box.error.KEY_PART_TYPE : 18'
-  - 'box.error.CREATE_FUNCTION : 50'
-  - 'box.error.ALREADY_RUNNING : 126'
-  - 'box.error.SQL_BIND_VALUE : 154'
-  - 'box.error.NO_SUCH_INDEX : 35'
-  - 'box.error.UNKNOWN_RTREE_INDEX_DISTANCE_TYPE : 103'
-  - 'box.error.TUPLE_FOUND : 3'
-  - 'box.error.VIEW_IS_RO : 113'
-  - 'box.error.LOCAL_INSTANCE_ID_IS_READ_ONLY : 128'
-  - 'box.error.FUNCTION_EXISTS : 52'
-  - 'box.error.UPDATE_ARG_TYPE : 26'
-  - 'box.error.FOREIGN_KEY_CONSTRAINT : 162'
-  - 'box.error.CROSS_ENGINE_TRANSACTION : 81'
-  - 'box.error.ACTION_MISMATCH : 160'
-  - 'box.error.FORMAT_MISMATCH_INDEX_PART : 27'
-  - 'box.error.injection : table: <address>
-  - 'box.error.FUNCTION_TX_ACTIVE : 30'
-  - 'box.error.SQL_BIND_NOT_FOUND : 159'
-  - 'box.error.RELOAD_CFG : 58'
-  - 'box.error.NO_SUCH_ENGINE : 57'
-  - 'box.error.COMMIT_IN_SUB_STMT : 122'
-  - 'box.error.SQL_EXECUTE : 157'
-  - 'box.error.NULLABLE_MISMATCH : 153'
-  - 'box.error.LAST_DROP : 15'
-  - 'box.error.NO_SUCH_ROLE : 82'
-  - 'box.error.DECOMPRESSION : 124'
-  - 'box.error.CREATE_SEQUENCE : 142'
-  - 'box.error.CREATE_USER : 43'
-  - 'box.error.SPACE_FIELD_IS_DUPLICATE : 149'
-  - 'box.error.INSTANCE_UUID_MISMATCH : 66'
-  - 'box.error.SEQUENCE_OVERFLOW : 147'
-  - 'box.error.SYSTEM : 115'
-  - 'box.error.KEY_PART_IS_TOO_LONG : 118'
-  - 'box.error.TUPLE_FORMAT_LIMIT : 16'
-  - 'box.error.BEFORE_REPLACE_RET : 53'
-  - 'box.error.NO_SUCH_SAVEPOINT : 61'
-  - 'box.error.TRUNCATE_SYSTEM_SPACE : 137'
-  - 'box.error.VY_QUOTA_TIMEOUT : 135'
-  - 'box.error.WRONG_INDEX_OPTIONS : 108'
-  - 'box.error.INVALID_VYLOG_FILE : 133'
-  - 'box.error.INDEX_FIELD_COUNT_LIMIT : 127'
-  - 'box.error.READ_VIEW_ABORTED : 130'
-  - 'box.error.USER_MAX : 56'
-  - 'box.error.PROTOCOL : 104'
-  - 'box.error.TUPLE_NOT_ARRAY : 22'
-  - 'box.error.KEY_PART_COUNT : 31'
-  - 'box.error.ALTER_SPACE : 12'
-  - 'box.error.ACTIVE_TRANSACTION : 79'
-  - 'box.error.EXACT_FIELD_COUNT : 38'
-  - 'box.error.DROP_SEQUENCE : 144'
-  - 'box.error.INVALID_MSGPACK : 20'
-  - 'box.error.MORE_THAN_ONE_TUPLE : 41'
-  - 'box.error.RTREE_RECT : 101'
-  - 'box.error.SUB_STMT_MAX : 121'
-  - 'box.error.UNKNOWN_REQUEST_TYPE : 48'
-  - 'box.error.SPACE_EXISTS : 10'
-  - 'box.error.PROC_LUA : 32'
-  - 'box.error.ROLE_NOT_GRANTED : 92'
-  - 'box.error.NO_SUCH_SPACE : 36'
-  - 'box.error.WRONG_INDEX_PARTS : 107'
-  - 'box.error.DROP_SPACE : 11'
-  - 'box.error.MIN_FIELD_COUNT : 39'
-  - 'box.error.REPLICASET_UUID_MISMATCH : 63'
-  - 'box.error.UPDATE_FIELD : 29'
-  - 'box.error.COMPRESSION : 119'
-  - 'box.error.INVALID_ORDER : 68'
-  - 'box.error.INDEX_EXISTS : 85'
-  - 'box.error.SPLICE : 25'
-  - 'box.error.UNKNOWN : 0'
-  - 'box.error.DROP_PRIMARY_KEY : 17'
-  - 'box.error.NULLABLE_PRIMARY : 152'
-  - 'box.error.NO_SUCH_SEQUENCE : 145'
-  - 'box.error.SQL : 158'
-  - 'box.error.INVALID_UUID : 64'
-  - 'box.error.INJECTION : 8'
-  - 'box.error.TIMEOUT : 78'
-  - 'box.error.IDENTIFIER : 70'
-  - 'box.error.ITERATOR_TYPE : 72'
-  - 'box.error.REPLICA_MAX : 73'
-  - 'box.error.MISSING_REQUEST_FIELD : 69'
-  - 'box.error.MISSING_SNAPSHOT : 93'
-  - 'box.error.WRONG_SPACE_OPTIONS : 111'
-  - 'box.error.READONLY : 7'
-  - 'box.error.UNSUPPORTED : 5'
-  - 'box.error.UPDATE_INTEGER_OVERFLOW : 95'
-  - 'box.error.NO_CONNECTION : 77'
-  - 'box.error.INVALID_XLOG_ORDER : 76'
-  - 'box.error.UPSERT_UNIQUE_SECONDARY_KEY : 105'
-  - 'box.error.ROLLBACK_IN_SUB_STMT : 123'
-  - 'box.error.WRONG_SCHEMA_VERSION : 109'
-  - 'box.error.UNSUPPORTED_INDEX_FEATURE : 112'
-  - 'box.error.INDEX_PART_TYPE_MISMATCH : 24'
-  - 'box.error.INVALID_XLOG_TYPE : 125'
+- 0: box.error.UNKNOWN
+  1: box.error.ILLEGAL_PARAMS
+  2: box.error.MEMORY_ISSUE
+  3: box.error.TUPLE_FOUND
+  4: box.error.TUPLE_NOT_FOUND
+  5: box.error.UNSUPPORTED
+  6: box.error.NONMASTER
+  7: box.error.READONLY
+  8: box.error.INJECTION
+  9: box.error.CREATE_SPACE
+  10: box.error.SPACE_EXISTS
+  11: box.error.DROP_SPACE
+  12: box.error.ALTER_SPACE
+  13: box.error.INDEX_TYPE
+  14: box.error.MODIFY_INDEX
+  15: box.error.LAST_DROP
+  16: box.error.TUPLE_FORMAT_LIMIT
+  17: box.error.DROP_PRIMARY_KEY
+  18: box.error.KEY_PART_TYPE
+  19: box.error.EXACT_MATCH
+  20: box.error.INVALID_MSGPACK
+  21: box.error.PROC_RET
+  22: box.error.TUPLE_NOT_ARRAY
+  23: box.error.FIELD_TYPE
+  24: box.error.INDEX_PART_TYPE_MISMATCH
+  25: box.error.SPLICE
+  26: box.error.UPDATE_ARG_TYPE
+  27: box.error.FORMAT_MISMATCH_INDEX_PART
+  28: box.error.UNKNOWN_UPDATE_OP
+  29: box.error.UPDATE_FIELD
+  30: box.error.FUNCTION_TX_ACTIVE
+  31: box.error.KEY_PART_COUNT
+  32: box.error.PROC_LUA
+  33: box.error.NO_SUCH_PROC
+  34: box.error.NO_SUCH_TRIGGER
+  35: box.error.NO_SUCH_INDEX
+  36: box.error.NO_SUCH_SPACE
+  37: box.error.NO_SUCH_FIELD
+  38: box.error.EXACT_FIELD_COUNT
+  39: box.error.MIN_FIELD_COUNT
+  40: box.error.WAL_IO
+  41: box.error.MORE_THAN_ONE_TUPLE
+  42: box.error.ACCESS_DENIED
+  43: box.error.CREATE_USER
+  44: box.error.DROP_USER
+  45: box.error.NO_SUCH_USER
+  46: box.error.USER_EXISTS
+  47: box.error.PASSWORD_MISMATCH
+  48: box.error.UNKNOWN_REQUEST_TYPE
+  49: box.error.UNKNOWN_SCHEMA_OBJECT
+  50: box.error.CREATE_FUNCTION
+  51: box.error.NO_SUCH_FUNCTION
+  52: box.error.FUNCTION_EXISTS
+  53: box.error.BEFORE_REPLACE_RET
+  54: box.error.FUNCTION_MAX
+  56: box.error.USER_MAX
+  57: box.error.NO_SUCH_ENGINE
+  58: box.error.RELOAD_CFG
+  59: box.error.CFG
+  60: box.error.SAVEPOINT_EMPTY_TX
+  61: box.error.NO_SUCH_SAVEPOINT
+  62: box.error.UNKNOWN_REPLICA
+  63: box.error.REPLICASET_UUID_MISMATCH
+  64: box.error.INVALID_UUID
+  65: box.error.REPLICASET_UUID_IS_RO
+  66: box.error.INSTANCE_UUID_MISMATCH
+  68: box.error.INVALID_ORDER
+  69: box.error.MISSING_REQUEST_FIELD
+  70: box.error.IDENTIFIER
+  71: box.error.DROP_FUNCTION
+  72: box.error.ITERATOR_TYPE
+  73: box.error.REPLICA_MAX
+  74: box.error.INVALID_XLOG
+  75: box.error.INVALID_XLOG_NAME
+  76: box.error.INVALID_XLOG_ORDER
+  77: box.error.NO_CONNECTION
+  78: box.error.TIMEOUT
+  79: box.error.ACTIVE_TRANSACTION
+  80: box.error.CURSOR_NO_TRANSACTION
+  81: box.error.CROSS_ENGINE_TRANSACTION
+  82: box.error.NO_SUCH_ROLE
+  83: box.error.ROLE_EXISTS
+  84: box.error.CREATE_ROLE
+  85: box.error.INDEX_EXISTS
+  86: box.error.TUPLE_REF_OVERFLOW
+  87: box.error.ROLE_LOOP
+  88: box.error.GRANT
+  89: box.error.PRIV_GRANTED
+  90: box.error.ROLE_GRANTED
+  91: box.error.PRIV_NOT_GRANTED
+  92: box.error.ROLE_NOT_GRANTED
+  93: box.error.MISSING_SNAPSHOT
+  94: box.error.CANT_UPDATE_PRIMARY_KEY
+  95: box.error.UPDATE_INTEGER_OVERFLOW
+  96: box.error.GUEST_USER_PASSWORD
+  97: box.error.TRANSACTION_CONFLICT
+  98: box.error.UNSUPPORTED_ROLE_PRIV
+  99: box.error.LOAD_FUNCTION
+  100: box.error.FUNCTION_LANGUAGE
+  101: box.error.RTREE_RECT
+  102: box.error.PROC_C
+  103: box.error.UNKNOWN_RTREE_INDEX_DISTANCE_TYPE
+  104: box.error.PROTOCOL
+  105: box.error.UPSERT_UNIQUE_SECONDARY_KEY
+  106: box.error.WRONG_INDEX_RECORD
+  107: box.error.WRONG_INDEX_PARTS
+  108: box.error.WRONG_INDEX_OPTIONS
+  109: box.error.WRONG_SCHEMA_VERSION
+  110: box.error.MEMTX_MAX_TUPLE_SIZE
+  111: box.error.WRONG_SPACE_OPTIONS
+  112: box.error.UNSUPPORTED_INDEX_FEATURE
+  113: box.error.VIEW_IS_RO
+  114: box.error.SAVEPOINT_NO_TRANSACTION
+  115: box.error.SYSTEM
+  116: box.error.LOADING
+  117: box.error.CONNECTION_TO_SELF
+  118: box.error.KEY_PART_IS_TOO_LONG
+  119: box.error.COMPRESSION
+  120: box.error.CHECKPOINT_IN_PROGRESS
+  121: box.error.SUB_STMT_MAX
+  122: box.error.COMMIT_IN_SUB_STMT
+  123: box.error.ROLLBACK_IN_SUB_STMT
+  124: box.error.DECOMPRESSION
+  125: box.error.INVALID_XLOG_TYPE
+  126: box.error.ALREADY_RUNNING
+  127: box.error.INDEX_FIELD_COUNT_LIMIT
+  128: box.error.LOCAL_INSTANCE_ID_IS_READ_ONLY
+  129: box.error.BACKUP_IN_PROGRESS
+  130: box.error.READ_VIEW_ABORTED
+  131: box.error.INVALID_INDEX_FILE
+  132: box.error.INVALID_RUN_FILE
+  133: box.error.INVALID_VYLOG_FILE
+  134: box.error.CHECKPOINT_ROLLBACK
+  135: box.error.VY_QUOTA_TIMEOUT
+  136: box.error.PARTIAL_KEY
+  137: box.error.TRUNCATE_SYSTEM_SPACE
+  138: box.error.LOAD_MODULE
+  139: box.error.VINYL_MAX_TUPLE_SIZE
+  140: box.error.WRONG_DD_VERSION
+  141: box.error.WRONG_SPACE_FORMAT
+  142: box.error.CREATE_SEQUENCE
+  143: box.error.ALTER_SEQUENCE
+  144: box.error.DROP_SEQUENCE
+  145: box.error.NO_SUCH_SEQUENCE
+  146: box.error.SEQUENCE_EXISTS
+  147: box.error.SEQUENCE_OVERFLOW
+  149: box.error.SPACE_FIELD_IS_DUPLICATE
+  150: box.error.CANT_CREATE_COLLATION
+  151: box.error.WRONG_COLLATION_OPTIONS
+  152: box.error.NULLABLE_PRIMARY
+  153: box.error.NULLABLE_MISMATCH
+  154: box.error.SQL_BIND_VALUE
+  155: box.error.SQL_BIND_TYPE
+  156: box.error.SQL_BIND_PARAMETER_MAX
+  157: box.error.SQL_EXECUTE
+  158: box.error.SQL
+  159: box.error.SQL_BIND_NOT_FOUND
+  160: box.error.ACTION_MISMATCH
+  161: box.error.VIEW_MISSING_SQL
+  162: box.error.FOREIGN_KEY_CONSTRAINT
 ...
 test_run:cmd("setopt delimiter ''");
 ---
diff --git a/test/box/misc.test.lua b/test/box/misc.test.lua
index 073a748..e24228a 100644
--- a/test/box/misc.test.lua
+++ b/test/box/misc.test.lua
@@ -111,7 +111,9 @@ type(require('yaml').encode(box.slab.info()));
 ----------------
 t = {}
 for k,v in pairs(box.error) do
-   table.insert(t, 'box.error.'..tostring(k)..' : '..tostring(v))
+   if type(v) == 'number' then
+    t[v] = 'box.error.'..tostring(k)
+   end
 end;
 t;
 
-- 
2.7.4





More information about the Tarantool-patches mailing list