Database cluster test method, device and system, storage medium and program product
Through the test parameters and test case labels entered by the user, a database cluster is built in a containerized manner, and multiple database clusters are tested based on the target test case set, which solves the problem of low testing efficiency in the existing technology and realizes an efficient database Cluster testing.
Patent Information
- Application Number
- CN202411691437.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-02-18
AI Technical Summary
How to efficiently test multiple database clusters to solve the problem of low testing efficiency in the prior art.
Through the test parameters entered by the user, the database cluster configuration parameters and test case labels are obtained, the database cluster is built in a containerized manner, the target test case set is determined in the test case library, and multiple database clusters are tested based on the target test case set.
It realizes automated testing of multiple database clusters, improves testing efficiency, and can build several database clusters based on the cluster configuration parameters entered by the user, and test based on the target test set determined by the test case label.
Smart Images

Figure CN119473904A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of database testing, and in particular to a method, device, system, storage medium and computer program product for testing a database cluster. Background Art
[0002] With the rapid development of information technology, database cluster technology has become a key means to ensure high availability, high performance and scalability, and is widely used to support large-scale data processing and high concurrent access requirements.
[0003] Some scenarios require testing of multiple database clusters. How to efficiently test multiple database clusters is a problem to be solved. Summary of the invention
[0004] Based on this, it is necessary to provide a test method, device, test system, storage medium and computer program product for a database cluster in response to the above technical problems.
[0005] The present application provides a method for testing a database cluster, the method comprising:
[0006] According to the test parameters input by the user, the database cluster configuration parameters and test case labels are obtained;
[0007] According to the cluster configuration parameters, construct several database clusters in a containerized manner;
[0008] Determine a target test case carrying the test case label in the test case library to obtain a target test case set;
[0009] Based on the target test case set, several database clusters are tested.
[0010] In one embodiment, the method further comprises:
[0011] According to the test parameters, a test strategy is obtained;
[0012] According to the test strategy, the execution path of the target test case set in different database clusters is obtained;
[0013] Based on the target test case set, several database clusters are tested, including:
[0014] According to the execution paths of the target test case set in different database clusters, the corresponding target test cases are applied in sequence in the corresponding database clusters to test the database clusters.
[0015] In one embodiment, the method further comprises:
[0016] According to the test parameters, a database version is obtained;
[0017] Generating a test script matching the database version according to the target test case in the target test case set;
[0018] According to the execution paths of the target test case set in different database clusters, corresponding target test cases are applied in sequence in corresponding database clusters to test the database clusters, including:
[0019] According to the execution path of the target test case set in different database clusters, the test script of the corresponding target test case is executed on the corresponding database cluster to test the database cluster.
[0020] In one embodiment, the test strategy includes at least one of a CPU priority test strategy and an I / O priority strategy.
[0021] In one embodiment, the method further comprises:
[0022] Determine the target fault in the pre-built database cluster fault library;
[0023] During the process of testing the database cluster, the target fault is injected into the database cluster.
[0024] In one embodiment, during the process of testing the database cluster, injecting the target fault into the database cluster includes:
[0025] Get the fault injection automation script;
[0026] During the process of testing the database cluster, when a trigger condition is met, the fault injection automation script is executed to inject the target fault into the database cluster.
[0027] The present application provides a test device for a database cluster, the device comprising:
[0028] The parameter acquisition module is used to obtain the database cluster configuration parameters and test case labels according to the test parameters input by the user;
[0029] A cluster building module, used to build several database clusters in a containerized manner according to the cluster configuration parameters;
[0030] A test case determination module, used to determine a target test case carrying the test case label in a test case library to obtain a target test case set;
[0031] The test module is used to test several database clusters based on the target test case set.
[0032] The present application provides a testing system, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the above method.
[0033] The present application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to execute the above method.
[0034] The present application provides a computer program product, on which a computer program is stored, and the computer program is executed by a processor to perform the above method.
[0035] The test method, device, test system, storage medium and computer program product of the above-mentioned database cluster obtain database cluster configuration parameters and test case labels according to the test parameters input by the user; construct several database clusters in a containerized manner according to the cluster configuration parameters; determine the target test case carrying the test case label in the test case library to obtain the target test case set; and test several database clusters based on the target test case set. The solution provided in the present application can construct several database clusters through the cluster configuration parameters input by the user, and automatically test multiple database clusters based on the target test case set determined by the test case label, thereby improving the test efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the related technologies, the drawings required for use in the embodiments or the related technical descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0037] Figure 1 A schematic diagram of a flow chart of a method for testing a database cluster in one embodiment;
[0038] Figure 2 A schematic diagram of a fault injection process in an embodiment;
[0039] Figure 3 An application environment diagram of a database cluster testing method in one embodiment;
[0040] Figure 4 is a structural block diagram of a test device for a database cluster in one embodiment;
[0041] Figure 5 FIG. 4 is a diagram showing the internal structure of a test system in one embodiment. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0043] The database cluster testing method provided in this application includes: Figure 1 The steps shown in the method include steps that can be executed by a test platform.
[0044] Step S101, obtaining database cluster configuration parameters and test case labels according to the test parameters input by the user.
[0045] The database cluster configuration parameters describe the topology of the database cluster that the user needs to test, for example, the database cluster that needs to be tested includes the number of databases and the connection relationship between databases.
[0046] You can collect multiple test cases and assign multi-dimensional labels to each test case, such as test level, test function, expected fault simulation category, etc. The label assigned to the test case can be called a test case label. The test level can include basic test level, advanced test level and stress test level.
[0047] For the database cluster that needs to be tested, the user can determine the functions to be tested, the test level, the expected fault simulation category, etc., and then select the corresponding test case tag in the test case tag library.
[0048] The user can input test parameters to the test platform, and the test platform can parse the database cluster configuration parameters and test case labels from the test parameters.
[0049] Step S102: constructing several database clusters in a containerized manner according to cluster configuration parameters.
[0050] After obtaining the cluster configuration parameters, the test platform can communicate with the user in a containerized manner to establish the database cluster that needs to be tested.
[0051] The test platform provides a dynamic cluster configuration function. Specifically, users can use simple parameter configuration to deploy the required database cluster on the test platform, freely set the cluster size and topology, and cover all-round simulation from single node to complex distributed system. The type and version of the database can be freely customized to be compatible with a variety of situations. The database cluster can set different architectures and operating systems to simulate tests with different requirements and multiple scenarios.
[0052] The test platform provides component-level customization. Specifically, the test platform supports independent configuration and management of each component in the database cluster (master database, slave database, shard, etc.) to meet diverse testing needs; it facilitates iteration and expansion, and is compatible with development and testing of different versions and scenarios.
[0053] The test platform provides efficient resource management functions. Specifically, the test platform can greatly improve resource utilization efficiency through containerized deployment, allowing users to quickly build and destroy test environments, effectively controlling costs while accelerating test iterations.
[0054] Step S103: determine the target test case carrying the test case label in the test case library to obtain a target test case set.
[0055] After the test platform obtains the test case label selected by the user, it can determine the test case carrying the test case label in the test case library and use it as the target test case, thereby forming a target test case set.
[0056] Step S104: testing several database clusters based on the target test case set.
[0057] After obtaining the target test case set, the test platform can test several database clusters according to the target test case set; the test platform can test multiple database clusters in parallel according to the target test case set, thereby shortening the test cycle. Since the database cluster is built in a containerized manner, the operation of each database cluster during the parallel test is independent and undisturbed, maintaining the isolation and stability of the test.
[0058] In the above-mentioned database cluster testing method, database cluster configuration parameters and test case labels are obtained according to the test parameters input by the user; several database clusters are constructed in a containerized manner according to the cluster configuration parameters; target test cases carrying test case labels are determined in the test case library to obtain target test case sets; and several database clusters are tested based on the target test case sets. The solution provided in the present application can construct several database clusters through cluster configuration parameters input by the user, and automatically test multiple database clusters based on the target test case sets determined by the test case labels, thereby improving the testing efficiency.
[0059] In one embodiment, the method provided by the present application further includes:
[0060] According to the test parameters, the test strategy is obtained; according to the test strategy, the execution path of the target test case set in different database clusters is obtained;
[0061] Based on the target test case set, several database clusters are tested, including:
[0062] According to the execution path of the target test case set in different database clusters, the corresponding target test cases are applied in the corresponding database clusters in sequence to test the database cluster.
[0063] The test strategy includes at least one of a CPU (Central Processing Unit) priority test strategy and an I / O (Input / Output) priority test strategy. The test strategy may also include an average time allocation test strategy.
[0064] For the database clusters to be tested, users can set corresponding test strategies. For example, users can set a CPU priority test strategy; when the test strategy parsed from the test parameters by the test platform is a CPU priority test strategy, the strategy parser can be called to enable the strategy parser to dynamically plan the execution path of the target test case set in each database cluster; when planning, the target test cases that can improve the CPU intensive utilization rate are prioritized.
[0065] For another example, users can set an I / O priority test strategy. When the test strategy parsed from the test parameters by the test platform is an I / O priority test strategy, the strategy parser can be called to enable the strategy parser to dynamically plan the execution path of the target test case set in each database cluster. When planning, priority is given to target test cases that can improve I / O intensive usage.
[0066] In one embodiment, the method provided by the present application further includes:
[0067] Get the database version based on the test parameters; generate a test script that matches the database version based on the target test cases in the target test case set;
[0068] According to the execution path of the target test case set in different database clusters, the corresponding target test cases are applied in the corresponding database clusters in sequence to test the database clusters, including:
[0069] According to the execution path of the target test case set in different database clusters, the test script of the corresponding target test case is executed on the corresponding database cluster to test the database cluster.
[0070] For the database cluster to be tested, users can set the database version. After the test platform parses the database version from the test parameters, it can generate a test script that matches the database version based on the target test case in the target test case set.
[0071] Assume that the target test case set includes three target test cases, which are respectively called the first target test case, the second target test case and the third target test case; the execution path of the target test case set in a certain database cluster is: the second target test case -> the first target test case -> the third target test case.
[0072] The test platform can first obtain the test script of the second target test case, and execute the test script of the second target test case on the database cluster; after the test script of the second target test case is executed, the test script of the first target test case is obtained, and the test script of the first target test case is executed on the database cluster; after the test script of the first target test case is executed, the test script of the third target test case is obtained, and the test script of the third target test case is executed on the database cluster, thereby completing the test of the database cluster.
[0073] In one embodiment, the method provided by the present application further includes Figure 2 The steps shown are: step S201, determining a target fault in a pre-built database cluster fault library; step S202, injecting a target fault into the database cluster during testing of the database cluster.
[0074] Database clusters have different architectures and workloads. We can build corresponding database cluster fault libraries for database clusters with different architectures and workloads to improve the relevance and effectiveness of testing. In some examples, the database cluster fault library can include disk I / O failures, network delays and interruptions, node failures, database deadlocks, and software logic errors.
[0075] For a certain database cluster, the test platform can determine a matching database cluster fault library from multiple database cluster fault libraries based on the architecture and workload of the database cluster. The test platform can determine at least one fault from the matching database cluster fault library, which can be called a target fault. In the process of testing the database cluster, the target fault is injected into the database cluster.
[0076] In one embodiment, during the process of testing the database cluster, injecting a target fault into the database cluster includes:
[0077] Obtain a fault injection automation script; during the test of the database cluster, when a trigger condition is met, execute the fault injection automation script to inject a target fault into the database cluster.
[0078] The test platform can generate a corresponding automation script for the target fault through an automation script tool to inject it into the database cluster. The automation script can be called a fault injection automation script. During the test of the database cluster, when the trigger condition is met, the fault injection automation script is executed to inject the target fault into the database cluster. When the random trigger time point is reached, it can be determined that the trigger condition is met; when the predetermined trigger time point is reached, it can be determined that the trigger condition is met.
[0079] In order to better understand the above method, the following Figure 3, an application example of the testing method of the database cluster of the present application is elaborated in detail.
[0080] After the test platform obtains the test parameters input by the user, it can parse the test parameters to obtain the database version, database cluster configuration parameters, test case labels and test strategies. Based on the cluster configuration parameters, the test platform builds the first database cluster, the second database cluster and the third database cluster in a containerized manner.
[0081] The test platform can determine the target test case carrying the test case label in the test case library, obtain the first target test case, the second target test case and the third target test case, and form a target test case set.
[0082] The test platform can generate a test script that matches the database version based on the first target test case; the test platform can generate a test script that matches the database version based on the second target test case; the test platform can generate a test script that matches the database version based on the third target test case.
[0083] The test platform can determine the execution path of the target test case set in each database cluster according to the test strategy; for example, the execution path of the target test case set in the first database cluster is: first target test case -> third target test case -> second target test case; the execution path of the target test case set in the second database cluster is: second target test case -> first target test case -> third target test case; the execution path of the target test case set in the third database cluster is: third target test case -> first target test case -> second target test case.
[0084] The test platform can execute the test script of the corresponding target test case on the corresponding database cluster according to the above execution path.
[0085] The test platform provided by this application can collect test cases and manage test cases. The management of test cases includes the following aspects:
[0086] (1) Fine labeling system: Each test case is given a multi-dimensional label to facilitate accurate retrieval and grouping.
[0087] (2) Time and version tracking: Record the functional release date corresponding to the test case to ensure that the test plan is closely synchronized with product iterations.
[0088] (3) Automated workflow engine: Trigger the automated testing process with one click, seamlessly connecting the entire process from data preparation, test execution to result aggregation, significantly accelerating the testing cycle.
[0089] (4) Visual test monitoring and reporting: real-time tracking of test progress, intuitive display of test data and results, comparative analysis of the performance of different test batches, and providing immediate feedback and insights to the development team.
[0090] The test platform uses container technology to simulate the database cluster, which can achieve:
[0091] (1) Dynamic cluster configuration: Users can deploy the required database cluster through simple parameter configuration, freely set the database cluster scale and topology, and cover a full range of simulations from single nodes to complex distributed systems. Database types and versions can be freely customized to be compatible with a variety of situations. Database clusters can be set up with different architectures and operating systems to simulate tests with different requirements and multiple scenarios.
[0092] (2) Component-level customization: Supports independent configuration and management of each component (master database, slave database, shard, etc.) in the database cluster to meet diverse testing needs. It facilitates iteration and expansion, and is compatible with development and testing of different versions and scenarios.
[0093] (3) Efficient resource management: Containerized deployment improves resource utilization efficiency, allows for rapid setup and destruction of test environments, effectively controls costs, and accelerates test iterations.
[0094] The simulation technique can be optimized by:
[0095] (1) Containerized separation and customized deployment: Based on different database types and their component characteristics, the database and components are encapsulated in lightweight containers. This strategy not only isolates the resource environment, but also allows independent configuration and version customization for each database or component to meet diverse testing needs.
[0096] (2) Dynamic cluster configuration and construction: Users can customize the topology of the database cluster according to the test objectives, including multiple deployment modes such as master-slave replication, sharded clusters, read-write separation, etc. Through automated scripts or graphical interfaces, database clusters that meet specific test scenarios can be quickly built to achieve on-demand construction and flexible adjustment of the test environment.
[0097] (3) Mapping of test cases and database clusters: Through intelligent scheduling algorithms, different test cases are accurately mapped to the most suitable database cluster for execution. Allocation strategies based on case characteristics ensure efficient use of test resources and high accuracy of test results, especially when dealing with I / O-intensive, CPU-sensitive or mixed test scenarios.
[0098] (4) Resource optimization and parallel testing: Utilize the efficient resource management capabilities of container orchestration tools to achieve dynamic resource allocation and load balancing between database clusters. The test platform supports the parallel execution of multiple test plans, significantly shortening the test cycle while ensuring that the operation of each database cluster is not disturbed, maintaining the isolation and stability of the test.
[0099] The high-simulation database cluster simulation technology of this application example builds a test platform that is both efficient and close to the actual production environment through refined containerized deployment, flexible cluster customization capabilities, intelligent case allocation mechanism and resource optimization strategy, greatly enhancing the practicality and reliability of database cluster testing.
[0100] The core of the test platform integrates a sophisticated data processing and verification mechanism, which aims to comprehensively monitor and ensure the robustness of the database cluster operation and the integrity of the data. This mechanism not only focuses on the precise matching of test results, but also goes deeper into the micro level of database cluster operation, and improves the verification efficiency and accuracy through the optimization of the following links.
[0101] (1) Real-time status monitoring and anomaly detection:
[0102] ① Global transaction data consistency check: Use the global transaction identifier to determine data consistency. According to the data synchronization status of the database cluster, ensure that the database cluster runs in a high-availability state.
[0103] ② Dynamic tracking of component health status: By real-time monitoring of the status changes of each component in the database cluster, including but not limited to service start, stop, restart events and performance fluctuations, potential failure points can be identified immediately to ensure service continuity.
[0104] (2) In-depth log analysis and intelligent diagnosis:
[0105] ① Intelligent log analysis engine: uses AI and machine learning technologies to automatically analyze log files, identify abnormal patterns, error codes, and performance bottlenecks, provide preliminary diagnostic suggestions, and accelerate problem location.
[0106] ② Monitoring data analysis: Integrate various monitoring data (such as CPU usage, memory usage, I / O throughput, etc.), use big data analysis methods to identify abnormal trends, and assist in determining whether the continuity of database services and data security are affected during the test.
[0107] (3) Optimization of automated test scripts:
[0108] ① Efficient script design tool: The test platform provides a highly modular script design framework with a built-in rich database operation command library, cluster management tool interface and standardized test case templates, enabling developers to quickly build, debug and maintain complex test scripts without having to write underlying code from scratch.
[0109] ②Test process automation: The test platform automates traditional manual test steps and implements one-click deployment and execution through script encapsulation, significantly shortening the development to test cycle and improving iteration speed; the test platform supports rapid response to new function releases to ensure the immediacy of function verification.
[0110] (4) Flexible modular call and deep customization:
[0111] ① Modular management: supports modular design and reuse of test scripts, allowing developers to freely combine test modules according to needs to achieve rapid construction and adjustment of test scenarios.
[0112] ② Deep customization: The design reserves interfaces to facilitate the integration of new database types, components or testing tools in the future, maintaining the system's forward-looking and flexibility to adapt to the ever-changing technology stack and testing requirements. Customize the database, storage engine, system architecture, and topology according to your needs.
[0113] Through the above optimization methods, the test platform can not only respond to test results quickly and deeply analyze the root causes of problems, but also improve the efficiency and quality of testing, providing guarantees for the stable operation of database services and data security.
[0114] In the design of an automated testing framework for database clusters, the goal is to verify the resilience and self-recovery capabilities of database clusters by simulating real-world failure scenarios. This strategy focuses on accurately setting various failure scenarios in a controlled test environment to ensure that the database cluster can maintain service continuity and data consistency when encountering challenges such as disk failures, network fluctuations, and software anomalies. This strategy includes the following aspects:
[0115] (1) Accurate fault scenario simulation:
[0116] ① Construction of database cluster fault library: Database clusters differ in architecture and workload. We can build corresponding database cluster fault libraries for database clusters with different architectures and workloads to improve the relevance and effectiveness of the test. In some examples, the database cluster fault library can include disk I / O failures, network delays and interruptions, node failures, database deadlocks, and software logic errors.
[0117] ② Dynamic injection mechanism: The test platform is equipped with an automated script tool that can dynamically inject faults on demand during the test process, support random or scheduled time point triggering, simulate sudden and continuous faults, and comprehensively test the cluster's immediate response and recovery capabilities.
[0118] (2) Automated testing process design:
[0119] ① Database cluster status monitoring: Before, during and after the test, monitor the health status of the database cluster, including but not limited to key indicators such as CPU usage, memory usage, disk space, network traffic, and service availability, to ensure that status changes before and after the failure are recorded.
[0120] ②Data consistency check: After each fault simulation, perform a data consistency check to verify whether the data remains intact during the fault handling and recovery process. This is an important criterion for measuring the recovery quality of the database cluster.
[0121] (3) Fault response and recovery verification:
[0122] ① Verification of built-in recovery logic: The database cluster’s built-in fault detection and automatic recovery mechanisms, such as master-slave switching, data replication, and automatic repair, are tested to confirm that these mechanisms can correctly and efficiently start and complete tasks under preset fault scenarios.
[0123] ② Recovery time objective (RTO, Recovery Time Object) and data loss index (RPO, Recovery Point Objective) evaluation: Record the service interruption time and data loss amount from the occurrence of the failure to the recovery of the database cluster in the test report, and compare them with the pre-set target values as the basis for performance optimization and policy adjustment.
[0124] (4) Feedback loop and optimization suggestions
[0125] ① Test report and analysis: Generate a test report that summarizes the execution details of each test, fault simulation results, database cluster response time, recovery process and final status. The test report can also include analysis of problems exposed in the test and improvement suggestions.
[0126] ② Iterative testing and tuning: Based on test feedback, continuously adjust and improve failure scenarios, optimize database cluster configuration and recovery strategies, form a continuous testing-feedback-optimization cycle, and gradually improve the stability and reliability of the database cluster.
[0127] The above strategies can ensure that the database cluster can not only respond quickly but also effectively restore services when faced with various possible failures, thereby providing highly reliable database services in actual deployment.
[0128] In order to achieve highly flexible and efficient database cluster automated testing, the test platform has an intelligent test script generation and execution framework. The framework can dynamically adjust the test environment, optimize resource allocation, and intelligently schedule test cases based on the test parameters entered by the user to meet the needs of different test strategies. The following are the key components and optimization measures of the framework:
[0129] (1) Parameter-driven dynamic configuration:
[0130] ① Input test parameters: Users can define database version, database cluster configuration parameters, test case labels, and test strategies.
[0131] ② Dynamic adaptation: After receiving the test parameters, the test platform determines the target test case set and generates a test script that is compatible with the database version. It can automatically adjust the distribution of test cases according to the scale of the database cluster to ensure test coverage and targeting.
[0132] (2) Intelligent test strategy execution engine:
[0133] ① Strategy parser: According to the selected test strategy, the strategy parser dynamically plans the execution sequence and resource allocation mode of the target test case set. For example, CPU-intensive test cases will be prioritized under the CPU priority test strategy, while I / O-intensive test cases will be optimized under the I / O priority test strategy.
[0134] ②Parallel test optimization: Use scheduling algorithms, such as priority-based queues or time slice rotation, to ensure that test cases are executed in parallel according to test strategy requirements. At the same time, the test platform has real-time monitoring and adaptive adjustment capabilities, dynamically adjusting the number of concurrent tests according to the load of the current test environment to avoid resource competition.
[0135] (3) Dynamic resources and load balancing:
[0136] ① Resource perception: Real-time monitoring of resource usage in the test environment (CPU, memory, I / O bandwidth, etc.), and adjustment of resource allocation based on the test strategy to ensure efficient operation of the test process.
[0137] ② Intelligent scheduling mechanism: Use machine learning models to predict the execution time and resource requirements of test cases, and automatically schedule test cases to the most appropriate nodes or time periods to maximize resource utilization and improve test efficiency.
[0138] (4) Real-time feedback and self-optimization:
[0139] ① Instant feedback system: During the test process, the test platform continuously collects execution logs, performance indicators and fault information, and provides a real-time visual monitoring panel to facilitate rapid identification of problems.
[0140] ② Self-optimization logic: Based on historical test data and real-time feedback, the test platform uses algorithms to learn the dependencies and optimal execution paths between test cases, continuously optimize the test process, reduce unnecessary waiting time, and accelerate the test cycle.
[0141] (5) Test result analysis and reporting
[0142] ① Comprehensive evaluation: After the test is completed, the test platform automatically generates a comprehensive report including test coverage, success rate, performance bottleneck analysis and improvement suggestions.
[0143] ②Continuous iteration: Based on test results and analysis feedback, the test platform supports rapid iteration of test strategies and resource allocation, promoting continuous optimization and stability enhancement of the database cluster.
[0144] Through the above optimization measures, the automated testing framework of the testing platform can not only improve testing efficiency and accuracy, but also ensure that the testing process is highly adapted to the specific needs of different scenarios, providing a strong guarantee for the robustness of the database cluster.
[0145] The test platform provided by this embodiment has the following effects:
[0146] (1) Highly simulated and customized test environment: Through containerization technology, the test platform can perform deeply customized deployment for different database types and versions, creating a test cluster that is highly close to the real production environment, solving the problem that traditional test environments are difficult to simulate the complex characteristics of database clusters.
[0147] (2) Enhanced data consistency and ACID verification: The system has built-in data consistency and transaction processing verification mechanisms specific to the database, which can automatically perform complex data comparisons and transaction log analysis, ensuring that the ACID properties of distributed transactions are strictly verified in various test scenarios, thereby improving the accuracy and reliability of the test. The A in ACID is the abbreviation of atomicity, which is also known as atomicity in Chinese; the C in ACID is the abbreviation of consistency, which is also known as consistency in Chinese; the I in ACID is the abbreviation of isolateI / On, which is also known as isolation in Chinese; and the D in ACID is the abbreviation of durability, which is also known as persistence in Chinese.
[0148] (3) Accurate fault simulation and recovery testing: It not only simulates common hardware failures and network problems, but also performs detailed simulations of database-specific failure types (such as deadlock and index corruption). Through intelligent fault injection and recovery processes, it effectively evaluates the fault tolerance and recovery speed of the database cluster, thereby improving the resilience of the system.
[0149] (4) Optimized resource utilization and cost efficiency: Container orchestration tools are used to dynamically allocate resources, build and destroy test clusters on demand, and significantly reduce test resource consumption. At the same time, parallel testing strategies and intelligent scheduling are used to shorten the test cycle, reduce testing costs, and accelerate software iteration.
[0150] (5) Automated and intelligent testing process: The testing platform integrates automated scripting tools to support the rapid design and execution of complex test cases. Modular management enables faster verification of new functions, reduces the workload of development and testing teams, and improves testing efficiency and quality.
[0151] (6) In-depth analysis of performance and security: By integrating professional database monitoring and analysis tools, the testing platform can deeply detect performance bottlenecks, provide security vulnerability scanning and penetration testing, and ensure that the database cluster can maintain high performance and data security under high load.
[0152] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0153] Based on the same inventive concept, the embodiment of the present application also provides a database cluster testing device for implementing the above-mentioned database cluster testing method. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above-mentioned method, so the specific limitations in the embodiments of the testing device for one or more database clusters provided below can refer to the limitations of the database cluster testing method above, and will not be repeated here.
[0154] In one embodiment, Figure 4 As shown, a test device for a database cluster is provided, comprising:
[0155] The parameter acquisition module 401 is used to obtain the database cluster configuration parameters and the test case label according to the test parameters input by the user;
[0156] A cluster building module 402 is used to build a plurality of database clusters in a containerized manner according to the cluster configuration parameters;
[0157] A test case determination module 403 is used to determine a target test case carrying the test case label in the test case library to obtain a target test case set;
[0158] The testing module 404 is used to test several database clusters based on the target test case set.
[0159] In one embodiment, the device further includes an execution path acquisition module, configured to:
[0160] According to the test parameters, a test strategy is obtained; according to the test strategy, an execution path of the target test case set in different database clusters is obtained;
[0161] The test module 404 is further used to:
[0162] According to the execution paths of the target test case set in different database clusters, the corresponding target test cases are applied in sequence in the corresponding database clusters to test the database clusters.
[0163] In one embodiment, the device further includes a script acquisition module, which is used to:
[0164] According to the test parameters, a database version is obtained; according to the target test case in the target test case set, a test script matching the database version is generated;
[0165] The test module 404 is further used to:
[0166] According to the execution path of the target test case set in different database clusters, the test script of the corresponding target test case is executed on the corresponding database cluster to test the database cluster.
[0167] In one embodiment, the test strategy includes at least one of a CPU priority test strategy and an I / O priority strategy.
[0168] In one embodiment, the device further comprises a fault testing module, which is used to:
[0169] In a pre-built database cluster fault library, a target fault is determined; and in the process of testing the database cluster, the target fault is injected into the database cluster.
[0170] In one embodiment, the fault testing module is further used to:
[0171] Obtain a fault injection automation script; during the process of testing the database cluster, when a trigger condition is met, execute the fault injection automation script to inject the target fault into the database cluster.
[0172] Each module in the test device of the above database cluster can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the test system in the form of hardware, or can be stored in the memory of the test system in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0173] In an exemplary embodiment, a test system is provided, the internal structure of which can be shown as follows: Figure 5As shown. The test system includes a processor, a memory, an input / output interface (Input / Output, referred to as I / O) and a communication interface. The processor, the memory and the input / output interface are connected through a system bus, and the communication interface is connected to the system bus through the input / output interface. The processor of the test system is used to provide computing and control capabilities. The memory of the test system includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the test system is used to store data involved in the above method. The input / output interface of the test system is used to exchange information between the processor and an external device. The communication interface of the test system is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a test method for a database cluster is implemented.
[0174] Those skilled in the art will understand that Figure 5 The structure shown in the figure is only a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the test system to which the scheme of the present application is applied. The specific test system may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0175] In one embodiment, a test system is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps in the above-mentioned various method embodiments when executing the computer program.
[0176] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.
[0177] In one embodiment, a computer program product is provided, on which a computer program is stored, and the computer program is used by a processor to execute the steps in the above-mentioned various method embodiments.
[0178] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0179] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0180] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0181] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A database cluster testing method, characterized in that: The method comprises: According to the test parameters input by the user, the database cluster configuration parameters and test case labels are obtained; According to the cluster configuration parameters, construct several database clusters in a containerized manner; Determine a target test case carrying the test case label in the test case library to obtain a target test case set; Based on the target test case set, several database clusters are tested.
2. The method according to claim 1, characterized in that: The method further comprises: According to the test parameters, a test strategy is obtained; According to the test strategy, the execution path of the target test case set in different database clusters is obtained; Based on the target test case set, several database clusters are tested, including: According to the execution paths of the target test case set in different database clusters, the corresponding target test cases are applied in sequence in the corresponding database clusters to test the database clusters.
3. The method according to claim 2, characterized in that The method further comprises: According to the test parameters, a database version is obtained; Generating a test script matching the database version according to the target test case in the target test case set; According to the execution paths of the target test case set in different database clusters, corresponding target test cases are applied in sequence in corresponding database clusters to test the database clusters, including: According to the execution path of the target test case set in different database clusters, the test script of the corresponding target test case is executed on the corresponding database cluster to test the database cluster.
4. The method according to claim 2, characterized in that: The test strategy includes at least one of a CPU priority test strategy and an I / O priority strategy.
5. The method according to claim 1, characterized in that The method further comprises: Determine the target fault in the pre-built database cluster fault library; During the process of testing the database cluster, the target fault is injected into the database cluster.
6. The method according to claim 5, characterized in that In the process of testing the database cluster, injecting the target fault into the database cluster includes: Get the fault injection automation script; During the process of testing the database cluster, when a trigger condition is met, the fault injection automation script is executed to inject the target fault into the database cluster.
7. A test device for a database cluster, characterized in that: The device comprises: The parameter acquisition module is used to obtain the database cluster configuration parameters and test case labels according to the test parameters input by the user; A cluster building module, used to build several database clusters in a containerized manner according to the cluster configuration parameters; A test case determination module, used to determine a target test case carrying the test case label in a test case library to obtain a target test case set; The test module is used to test several database clusters based on the target test case set.
8. A test system comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Parallelized distributed database engine testing method and system based on dynamic evaluation
CN114356758A
Container service testing method and device
CN114721928A
Fault test method and device based on distributed system, equipment and medium
CN115391227A
Script data testing method and device, equipment, storage medium and program product
CN118796715A
Abnormality detection method, electronic equipment and storage medium
CN118860892A
Cited By
Automatic testing method for database external table function
CN120448282A