CN-121509281-B - Message queue testing method and device for alliance chain, electronic equipment and program product
Abstract
The application is suitable for the technical field of block chains, and provides a message queue testing method, device, electronic equipment and program product of a alliance chain. The method comprises the steps of determining target parameters according to test cases corresponding to message queues to be tested of a alliance chain, generating test tasks and test scenes according to the target parameters, scheduling test resources according to the test tasks and the test scenes, selecting message queue types of the message queues to be tested according to the target parameters, determining target security transmission protocols and target encryption algorithms according to the target parameters and the test scenes, and conducting encryption test on the message queues to be tested through the test tasks, the test scenes, the test resources, the message queue types, the target security transmission protocols and the target encryption algorithms. By the method, the electronic equipment can automatically test the message queue of the alliance chain, so that the testing efficiency of the message queue of the alliance chain is improved.
Inventors
- DUAN HAO
- LV ZHICHENG
- CHEN WEITAO
- CHEN YULIN
- DING TIE
Assignees
- 杭州高新区(滨江)区块链与数据安全研究院
Dates
- Publication Date
- 20260512
- Application Date
- 20260113
Claims (9)
- 1. A method for testing message queues of a federation chain, comprising: Determining target parameters according to the test cases corresponding to the message queues to be tested of the alliance chains; Generating a test task and a test scene according to the target parameters, and scheduling test resources according to the test task and the test scene; Selecting the message queue type of the message queue to be tested according to the target parameter; Determining a target secure transmission protocol and a target encryption algorithm according to the target parameters and the test scene; Performing encryption test on the message queue to be tested through the test task, the test scene, the test resource, the message queue type, the target secure transmission protocol and the target encryption algorithm; the target parameters comprise the business load characteristics of the alliance chain, the communication delay among nodes of the alliance chain, the consensus algorithm type of the alliance chain and the message flow distribution mode of the alliance chain, the selecting the message queue type of the message queue to be tested according to the target parameters comprises the following steps: And selecting the message queue type of the message queue to be tested according to the service load characteristic, the communication delay among the nodes, the common algorithm type, the message flow distribution mode, the target selection weight corresponding to each message queue type to be selected and a preset queue type selection strategy, wherein the message flow distribution mode refers to the transmission path, the flow direction characteristic or the distribution density of the message among different nodes in the alliance chain.
- 2. The method of claim 1, wherein the target parameters include a node type of the federation chain, a network topology of the federation chain, configuration parameters of the message queue to be tested, a test task generation policy, and a test scenario generation policy, wherein the generating test tasks and test scenarios according to the target parameters includes: generating the test task according to the node type, the network topology, the configuration parameters and the test task generation strategy; And generating the test scene according to the historical test data, the custom test parameters and the test scene generation strategy.
- 3. The method of claim 1, wherein the target selection weights for each of the candidate message queue types are determined by: Inputting target operation indexes of the alliance chain as reward functions into a weight selection model after training is completed, so as to instruct the weight selection model to optimize and output initial selection weights corresponding to each type of the message queue to be selected according to the target operation indexes, wherein the target operation indexes comprise any one or more of transaction processing amount per second, message delay value, message processing error rate and message retry rate; And respectively determining the optimized initial selection weights corresponding to the message queue types to be selected as the target selection weights corresponding to the message queue types to be selected.
- 4. The method of claim 1, wherein the target parameters include security levels of the federation chain and test policies of the federation chain, wherein the determining a target secure transport protocol and a target encryption algorithm based on the target parameters and the test scenario comprises: Determining the target secure transmission protocol from a plurality of preset secure transmission protocols to be selected according to the security level, the test strategy, the test scene and a preset secure transmission protocol determination strategy; determining at least one encryption algorithm combination to be selected according to the target secure transmission protocol, the test scene and a preset encryption algorithm combination determining strategy, wherein each encryption algorithm combination to be selected comprises a plurality of encryption algorithms; according to the test scene, respectively determining the corresponding performance parameters of each encryption algorithm combination to be selected, and according to each performance parameter, determining a target encryption algorithm combination from each encryption algorithm combination to be selected; And jointly determining each encryption algorithm included in the target encryption algorithm combination as the target encryption algorithm.
- 5. The method according to claim 2, wherein said performing encryption testing on said message queue under test by said test task, said test scenario, said test resource, said message queue type, said target secure transport protocol, and said target encryption algorithm comprises: deploying the message queue to be tested in the test scene according to the message queue type, the target secure transmission protocol and the target encryption algorithm through the test resource; And carrying out encryption test on the deployed message queue to be tested according to the test task.
- 6. The method according to any one of claims 1 to 5, wherein after said encryption testing of said message queue to be tested by said test task, said test scenario, said test resource, said message queue type, said target secure transport protocol and said target encryption algorithm, said method further comprises: The method comprises the steps of obtaining target data generated in the encryption test process of the message queue to be tested, wherein the target data comprises any one or more of block generation rate, message backlog length and node synchronization delay; And optimizing any one or more of a test task generation strategy, a test scene generation strategy, a queue type selection strategy, a secure transmission protocol determination strategy and an encryption algorithm combination determination strategy according to the target data.
- 7. A message queue testing apparatus for a federation chain, comprising: the first determining unit is used for determining target parameters according to the test cases corresponding to the message queues to be tested of the alliance chain; the scheduling unit is used for generating a test task and a test scene according to the target parameters and scheduling test resources according to the test task and the test scene; The selecting unit is used for selecting the message queue type of the message queue to be tested according to the target parameter; the second determining unit is used for determining a target secure transmission protocol and a target encryption algorithm according to the target parameter and the test scene; The test unit is used for carrying out encryption test on the message queue to be tested through the test task, the test scene, the test resource, the message queue type, the target secure transmission protocol and the target encryption algorithm; The target parameters include the service load characteristics of the alliance chain, the communication delay between nodes of the alliance chain, the consensus algorithm type of the alliance chain and the message flow distribution mode of the alliance chain, and the selection unit is specifically configured to: And selecting the message queue type of the message queue to be tested according to the service load characteristics, the communication delay among the nodes, the type of the consensus algorithm, the message flow distribution mode, the target selection weight corresponding to each type of the message queue to be tested and a preset queue type selection strategy.
- 8. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, performs the steps of the message queue testing method of the coalition chain of any one of claims 1 to 6.
- 9. A computer program product, which when executed by a processor implements the steps of a message queue testing method of a federation chain according to any one of claims 1 to 6.
Description
Message queue testing method and device for alliance chain, electronic equipment and program product Technical Field The application belongs to the technical field of blockchains, and particularly relates to a method, a device, electronic equipment and a program product for testing a message queue of a alliance chain. Background In testing a federation chain, message queues are a critical component for implementing asynchronous communications, transaction broadcasting, and event delivery between nodes. At present, in the process of testing the message queue of the alliance chain, the whole test process is usually required to be completed manually, for example, a test task and a test scene are required to be generated manually, test resources are required to be scheduled manually, a target security transmission protocol and a target encryption algorithm used in the test process are required to be determined manually, the existing intelligent degree of testing the message queue of the alliance chain is low, and the test efficiency of the message queue of the alliance chain is reduced. Disclosure of Invention In view of the above, the embodiments of the present application provide a method, an apparatus, an electronic device, and a program product for testing a message queue of a federation chain, so as to solve the technical problem in the prior art that the testing efficiency of the message queue of the federation chain is low. In a first aspect, an embodiment of the present application provides a method for testing a message queue of a federation chain, including: Determining target parameters according to the test cases corresponding to the message queues to be tested of the alliance chains; Generating a test task and a test scene according to the target parameters, and scheduling test resources according to the test task and the test scene; Selecting the message queue type of the message queue to be tested according to the target parameter; Determining a target secure transmission protocol and a target encryption algorithm according to the target parameters and the test scene; And carrying out encryption test on the message queue to be tested through the test task, the test scene, the test resource, the message queue type, the target secure transmission protocol and the target encryption algorithm. Optionally, the target parameters include a node type of the alliance chain, a network topology structure of the alliance chain, a configuration parameter of the message queue to be tested, a test task generating policy, and a test scene generating policy, and the generating test tasks and test scenes according to the target parameters includes: generating the test task according to the node type, the network topology, the configuration parameters and the test task generation strategy; And generating the test scene according to the historical test data, the custom test parameters and the test scene generation strategy. Optionally, the target parameter includes a service load characteristic of the federation chain, a communication delay between nodes of the federation chain, a consensus algorithm type of the federation chain, and a message flow distribution mode of the federation chain, and the selecting the message queue type of the message queue to be tested according to the target parameter includes: And selecting the message queue type of the message queue to be tested according to the service load characteristics, the communication delay among the nodes, the type of the consensus algorithm, the message flow distribution mode, the target selection weight corresponding to each type of the message queue to be tested and a preset queue type selection strategy. Optionally, the target selection weight corresponding to each message queue type to be selected is determined by: Inputting target operation indexes of the alliance chain as reward functions into a weight selection model after training is completed, so as to instruct the weight selection model to optimize and output initial selection weights corresponding to each type of the message queue to be selected according to the target operation indexes, wherein the target operation indexes comprise any one or more of transaction processing amount per second, message delay value, message processing error rate and message retry rate; And respectively determining the optimized initial selection weights corresponding to the message queue types to be selected as the target selection weights corresponding to the message queue types to be selected. Optionally, the target parameters include security level of the alliance chain and test policy of the alliance chain, and the determining a target secure transmission protocol and a target encryption algorithm according to the target parameters and the test scene includes: Determining the target secure transmission protocol from a plurality of preset secure transmission protocols to be selected according to the security level