Commit 82e11a32 authored by Kirill Smelkov's avatar Kirill Smelkov

X test for py vs go message codes

parent a624f645
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
# Copyright (C) 2017 Nexedi SA and Contributors.
# Kirill Smelkov <kirr@nexedi.com>
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.
"""generate registry of neo/py packet codes for tests"""
def main():
pyprotog = {}
execfile('../../neo/lib/protocol.py', pyprotog)
pypackets = pyprotog['Packets']
# dump to go what to expect
with open("ztestdata_proto_py_test.go", "w") as f:
def emit(v):
print >>f, v
emit("// Code generated by %s; DO NOT EDIT." % __file__)
emit("package neo")
emit("\nvar pyMsgRegistry = map[uint16]string{")
pycodev = pypackets.keys()
pycodev.sort()
for pycode in pycodev:
pymsg = pypackets[pycode]
emit('\t%d:\t"%s",' % (pycode, pymsg.__name__))
emit("}")
if __name__ == '__main__':
main()
// Code generated by ./py/pyneo-gen-testdata; DO NOT EDIT.
package neo
var pyMsgRegistry = map[uint16]string{
1: "RequestIdentification",
3: "Ping",
5: "CloseClient",
6: "PrimaryMaster",
8: "NotPrimaryMaster",
9: "NotifyNodeInformation",
10: "Recovery",
12: "LastIDs",
14: "PartitionTable",
16: "NotifyPartitionTable",
17: "PartitionChanges",
18: "StartOperation",
19: "StopOperation",
20: "UnfinishedTransactions",
22: "LockedTransactions",
24: "FinalTID",
26: "ValidateTransaction",
27: "BeginTransaction",
29: "FailedVote",
30: "FinishTransaction",
32: "LockInformation",
34: "InvalidateObjects",
35: "UnlockInformation",
36: "GenerateOIDs",
38: "Deadlock",
39: "RebaseTransaction",
41: "RebaseObject",
43: "StoreObject",
45: "AbortTransaction",
46: "StoreTransaction",
48: "VoteTransaction",
50: "GetObject",
52: "TIDList",
54: "TransactionInformation",
56: "ObjectHistory",
58: "PartitionList",
60: "NodeList",
62: "SetNodeState",
63: "AddPendingNodes",
64: "TweakPartitionTable",
65: "SetClusterState",
66: "Repair",
67: "RepairOne",
68: "ClusterInformation",
69: "ClusterState",
71: "ObjectUndoSerial",
73: "TIDListFrom",
75: "Pack",
77: "CheckReplicas",
78: "CheckPartition",
79: "CheckTIDRange",
81: "CheckSerialRange",
83: "PartitionCorrupted",
84: "NotifyReady",
85: "LastTransaction",
87: "CheckCurrentSerial",
89: "NotifyTransactionFinished",
90: "Replicate",
91: "ReplicationDone",
92: "FetchTransactions",
94: "FetchObjects",
96: "AddTransaction",
97: "AddObject",
98: "Truncate",
32768: "Error",
32769: "AnswerRequestIdentification",
32771: "AnswerPing",
32774: "AnswerPrimaryMaster",
32778: "AnswerRecovery",
32780: "AnswerLastIDs",
32782: "AnswerPartitionTable",
32788: "AnswerUnfinishedTransactions",
32790: "AnswerLockedTransactions",
32792: "AnswerFinalTID",
32795: "AnswerBeginTransaction",
32798: "AnswerFinishTransaction",
32800: "AnswerLockInformation",
32804: "AnswerGenerateOIDs",
32807: "AnswerRebaseTransaction",
32809: "AnswerRebaseObject",
32811: "AnswerStoreObject",
32814: "AnswerStoreTransaction",
32816: "AnswerVoteTransaction",
32818: "AnswerGetObject",
32820: "AnswerTIDList",
32822: "AnswerTransactionInformation",
32824: "AnswerObjectHistory",
32826: "AnswerPartitionList",
32828: "AnswerNodeList",
32837: "AnswerClusterState",
32839: "AnswerObjectUndoSerial",
32841: "AnswerTIDListFrom",
32843: "AnswerPack",
32847: "AnswerCheckTIDRange",
32849: "AnswerCheckSerialRange",
32853: "AnswerLastTransaction",
32855: "AnswerCheckCurrentSerial",
32860: "AnswerFetchTransactions",
32862: "AnswerFetchObjects",
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment