Database testing method and device, equipment, storage medium and program product

Through automated database testing methods, including database installation, structured query language script execution and information configuration script calls, the problems of long time and high error rate caused by manual operation of database upgrade fallback test in the existing technology are solved, and efficient and accurate database version upgrade and fallback test are achieved.

CN119248579BActive Publication Date: 2025-03-07JIANGSU HUAKU DATA TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411784113.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-06
Publication Date
2025-03-07
Estimated Expiration
2044-12-06

AI Technical Summary

Technical Problem

The existing upgrade fallback testing methods between different versions of databases are manual, resulting in long data import and export time, high error rate, and low testing efficiency.

Method used

In response to script execution commands, the target version database is installed based on the database installation script, and the structured query language script is executed on the initial version database based on the initial server node to obtain the initial query information. Then, the information configuration script is called, and the target parameter file is modified based on the associated configuration information of the initial version database to obtain the configuration parameter file. Finally, based on the configuration parameter file and initial query information, data detection is carried out on the initial version database and the target version database to obtain the detection results.

Benefits of technology

It realizes automatic installation, parameter configuration and data detection of the target version database without destroying the initial version database, improving testing efficiency and reducing error rate.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119248579B_ABST
    Figure CN119248579B_ABST
Patent Text Reader

Abstract

The present invention provides a database testing method and apparatus, equipment, storage medium and program product, which can be applied to the field of database testing technology. The method includes: in response to a script execution command, installing a target version database based on a database installation script; executing a structured query language script on table data in the initial version database based on an initial server node to obtain initial query information; calling an information configuration script, modifying a target parameter file based on associated configuration information of the initial version database to obtain a configuration parameter file, wherein the target parameter file includes configuration information of the target version database associated with the target server node, and the target version database performs an access operation on the initial version database based on the configuration parameter file; performing data detection on the initial version database and the target version database based on the configuration parameter file and the initial query information to obtain a detection result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of database testing, and in particular to a database testing method and device, equipment, storage medium and program product. Background Art

[0002] When the database is upgraded or the data is accidentally deleted or modified, database rollback can be used to restore the data to the previous state to prevent data loss or errors. Database rollback is to restore the database to a previous point in time or the state before a certain operation. The existing upgrade rollback test method between different versions of databases is to manually export the data structure and data information in the original version database and then import it into the new version database.

[0003] However, when the amount of data is too large, importing and exporting data will take a lot of time, and there are many restrictions when using tools to import and export data, which will lead to high import and export error rates or low testing efficiency. Summary of the invention

[0004] In view of the above problems, the present invention provides a database testing method and apparatus, device, storage medium and program product.

[0005] According to a first aspect of the present invention, there is provided a database testing method, comprising: in response to a script execution command, installing a target version database based on a database installation script, wherein the target version database is obtained after upgrading an initial version database; executing a structured query language script on table data in the initial version database based on an initial server node to obtain initial query information; calling an information configuration script, modifying a target parameter file based on associated configuration information of the initial version database to obtain a configuration parameter file, wherein the target parameter file includes configuration information of the target version database associated with the target server node, the target version database performs an access operation on the initial version database based on the configuration parameter file, and the associated configuration information includes spatial storage path information of the initial version database and configuration information of the initial server node; based on the configuration parameter file and the initial query information, performing data detection on the initial version database and the target version database to obtain a detection result.

[0006] Optionally, the information configuration script includes a server information configuration script, a database information configuration script, and an environment information configuration script, and the associated configuration information includes initial server node connection information, initial version database information, and file path information; wherein, calling the information configuration script to modify the target parameter file based on the associated configuration information of the initial version database to obtain the configuration parameter file includes: executing the server information configuration script to configure the target parameter file based on the initial server node connection information to obtain a first configuration parameter file; executing the database information configuration script to configure the target parameter file based on the initial version database information to obtain a second configuration parameter file; executing the environment information configuration script to configure the target parameter file based on the file path information to obtain a third configuration parameter file, wherein the configuration parameter files include the first configuration parameter file, the second configuration parameter file, and the third configuration parameter file.

[0007] Optionally, the initial server node connection information includes initial server node name information, initial server node address information, and initial server node port information; the initial version database information includes database log storage path information and space storage path information; and the file path information represents the path information of the configuration parameter file.

[0008] Optionally, the structured query language script includes a first write operation script and a first read operation script; wherein, executing the structured query language script on the initial version database based on the initial server node to obtain initial query information includes: executing the first write operation script on the table data in the initial version database based on the initial server node to obtain initial change information; executing the first read operation script on the initial change information based on the initial server node to obtain initial query information.

[0009] Optionally, based on the configuration parameter file and the initial query information, data detection is performed on the initial version database and the target version database to obtain detection results including: based on the configuration parameter file, using the target version database to execute a first read operation script on the initial change information in the initial version database to obtain first target query information; and consistency detection is performed on the initial query information and the first target query information to obtain detection results.

[0010] Optionally, based on the configuration parameter file and the initial query information, data detection is performed on the initial version database and the target version database, and the detection result also includes: based on the configuration parameter file, using the target version database to execute a second write operation script on the table data in the initial version database to obtain target change information; using the target version database to execute a second read operation script on the target change information to obtain second target query information; performing keyword error detection on the target change information to obtain a first detection result; performing keyword error detection on the second target query information to obtain a second detection result.

[0011] A second aspect of the present invention provides a database testing device, comprising:

[0012] A response module, configured to respond to a script execution command and install a target version database based on a database installation script, wherein the target version database is obtained after upgrading the initial version database;

[0013] A query module, used to execute a structured query language script on the table data in the initial version database based on the initial server node to obtain initial query information;

[0014] A configuration module is used to call an information configuration script, modify a target parameter file based on the associated configuration information of the initial version database, and obtain a configuration parameter file, wherein the target parameter file includes configuration information of the target version database associated with the target server node, and the target version database performs an access operation on the initial version database based on the configuration parameter file, and the associated configuration information includes space storage path information of the initial version database and configuration information of the initial server node;

[0015] The test module is used to perform data detection on the initial version database and the target version database based on the configuration parameter file and the initial query information to obtain the detection result.

[0016] The third aspect of the present invention provides an electronic device, comprising: one or more processors; a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned database testing method.

[0017] The fourth aspect of the present invention further provides a computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, causes the processor to execute the above-mentioned database testing method.

[0018] The fifth aspect of the present invention also provides a computer program product, including a computer program, which implements the above-mentioned database testing method when executed by a processor.

[0019] According to the database testing method and device, equipment, storage medium and program product provided by the present invention, the structured query language script is executed on the table data in the initial version database through the initial server node to obtain the initial query information; the information configuration script is called to realize that the target version database performs access operations on the initial version database based on the configuration parameter file; and data detection is performed on the initial version database and the target version database based on the configuration parameter file and the initial query information. Since the database installation script, structured query language script, information configuration script, detection script, etc. are all integrated in the total script, the execution of the total script automatically realizes the installation of the target version database, parameter configuration, etc., and the target version database performs access operations on the initial version database based on the configuration parameter file without destroying the initial version database, and then based on the initial query information and the information after the access operation, one-click testing of functions such as database version upgrade / rollback is realized, which is more convenient and simple to operate, improves the test efficiency, and reduces the error rate. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The above and other objects, features and advantages of the present invention will become more apparent through the following description of the embodiments of the present invention with reference to the accompanying drawings, in which:

[0021] Figure 1 The application scenario of the database testing method and device according to the embodiment of the present invention is shown.

[0022] Figure 2 A flowchart of a database testing method according to an embodiment of the present invention is shown.

[0023] Figure 3 An example schematic diagram of a database upgrade / rollback test according to an embodiment of the present invention is shown.

[0024] Figure 4 A structural block diagram of a database testing device according to an embodiment of the present invention is shown.

[0025] Figure 5 A block diagram of an electronic device suitable for implementing a database testing method according to an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0026] Below, embodiments of the present invention will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present invention. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of embodiments of the present invention. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of concepts of the present invention.

[0027] The terms used herein are only for describing specific embodiments and are not intended to limit the present invention. The terms "comprise", "include", etc. used herein indicate the existence of features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.

[0028] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification and should not be interpreted in an idealized or overly rigid manner.

[0029] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).

[0030] In the process of implementing the present invention, it is found that the existing upgrade rollback test method between different versions of databases is to manually export the data structure and data information in the original version database and then import it into the new version database. However, when the amount of data is too large, the import and export of data will take a lot of time, and there are many limiting factors when importing and exporting data with the help of tools (such as special fields, special table structures, fields that are too long, etc.), which will bring about the problem of high import and export error rate or low test efficiency.

[0031] In view of this, an embodiment of the present invention provides a database testing method and apparatus, device, storage medium and program product. The method includes: in response to a script execution command, installing a target version database based on a database installation script; executing a structured query language script on table data in the initial version database based on an initial server node to obtain initial query information; calling an information configuration script, modifying a target parameter file based on associated configuration information of the initial version database to obtain a configuration parameter file, wherein the target parameter file includes configuration information of the target version database associated with the target server node, and the target version database performs an access operation on the initial version database based on the configuration parameter file; performing data detection on the initial version database and the target version database based on the configuration parameter file and the initial query information to obtain a detection result.

[0032] In the technical solution of the present invention, the user information (including but not limited to user personal information, user image information, user device information, such as location information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with relevant laws, regulations and standards, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0033] Figure 1 The application scenario of the database testing method and device according to the embodiment of the present invention is shown.

[0034] like Figure 1 As shown, the business system architecture 100 according to this embodiment may include a first terminal device 101, a second terminal device 102, a third terminal device 103, a network 104, and a cluster server 105. The network 104 is used to provide a medium for a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the cluster server 105. The network 104 may include various connection types, such as wired, wireless communication links, or optical fiber cables, etc.

[0035] The user may use at least one of the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the cluster server 105 through the network 104 to receive or send messages, etc. Various communication client applications may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only for example).

[0036] The first terminal device 101, the second terminal device 102, and the third terminal device 103 may be various electronic devices having display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, and the like.

[0037] The cluster server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for websites browsed by users using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The cluster distributed database is deployed on the cluster server 105, and the cluster server 105 includes multiple server nodes that can analyze and process the received user request and other data, and feed back the processing results (such as web pages, information, or data obtained or generated according to the user request) to the terminal device.

[0038] It should be noted that the database testing method provided in the embodiment of the present invention can generally be executed by the cluster server 105. Accordingly, the database testing device provided in the embodiment of the present invention can generally be set in the cluster server 105. The database testing method provided in the embodiment of the present invention can also be executed by a server or server cluster that is different from the cluster server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the cluster server 105. Accordingly, the database testing device provided in the embodiment of the present invention can also be set in a server or server cluster that is different from the cluster server 105 and can communicate with the first terminal device 101, the second terminal device 102, the third terminal device 103 and / or the cluster server 105.

[0039] Alternatively, the database testing method provided in the embodiment of the present invention may also be executed by the first terminal device 101, the second terminal device 102 or the third terminal device 103, or may also be executed by other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103. Accordingly, the database testing apparatus provided in the embodiment of the present invention may also be provided in the first terminal device 101, the second terminal device 102 or the third terminal device 103, or may be provided in other terminal devices different from the first terminal device 101, the second terminal device 102 or the third terminal device 103.

[0040] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0041] It should be noted that the sequence numbers of the operations in the following method are only used as representations of the operations for the purpose of description, and should not be regarded as representing the execution order of the operations. Unless explicitly stated, the method does not need to be executed completely in the order shown.

[0042] Figure 2 A flowchart of a database testing method according to an embodiment of the present invention is shown.

[0043] like Figure 2 As shown, the method 200 includes operations S210 to S240.

[0044] In operation S210 , in response to a script execution command, a target version database is installed based on a database installation script.

[0045] Optionally, the script execution command represents a start request for executing a database installation script, and a database installation package is obtained after the initial version database is upgraded. The database installation script records the installation path, installation method, target server node name associated with the target version database, etc. of the database installation package. For example, the installation method is a console command line method.

[0046] Optionally, before executing the database installation script, you can perform a parameter accuracy check. The parameters mainly include the path of the initial version database, the initial server node name associated with the initial version database, and the target server node name associated with the target version database. The parameter accuracy check can include whether the path is correct, whether the server node name exists, whether the database installation package is the installation package of the target version database, etc. If the check passes, the database installation script is executed. If the check fails, a failure message is returned and the test ends.

[0047] For example, the initial server node name associated with the initial version database is ol_xxdbt1210_1, and the target server node name associated with the target version database is ol_xxdbt1210_2. The initial server node name is inconsistent with the target server node name, so the database installation package is the installation package of the target version database.

[0048] Optionally, executing the database installation script to install the target version database may include: creating a new directory at the location where the database installation script is located, decompressing the database installation package to obtain the target version database, and installing the target version database in the new directory.

[0049] In operation S220 , a structured query language script is executed on the table data in the initial version database based on the initial server node to obtain initial query information.

[0050] Optionally, a structured query language script is executed based on the initial server node, and the structured query language script calls a structured query language (SQL) file to perform transaction operations on the table data in the initial version database to obtain initial query information. Transaction operations can include write transaction operations and read transaction operations. Write transaction operations include operations such as deletion, insertion, and update, and read transaction operations can be query operations.

[0051] Optionally, the initial query information is information obtained by querying table data based on the query field. The initial query information is stored in the initial version database.

[0052] In operation S230, the information configuration script is called to modify the target parameter file based on the associated configuration information of the initial version database to obtain a configuration parameter file.

[0053] Optionally, the associated configuration information may include the spatial storage path information of the initial version database and the configuration information of the initial server node, etc. For example, the port information and address information of the initial server node. The associated configuration information is stored in the directory under the location of the initial version database. The initial server node performs transaction operations on the initial version database based on the associated configuration information.

[0054] Optionally, the target parameter file is saved in a directory under the location of the target version database, and the target parameter file includes configuration information of the target version database associated with the target server node. For example, the spatial storage path information of the target version database and the configuration information of the target server node. The target server node performs transaction operations on the target version database based on the target parameter file.

[0055] Optionally, the target parameter file of the target version database is modified to obtain a configuration parameter file, and then the target version database performs an access operation on the initial version database based on the configuration parameter file.

[0056] In operation S240, based on the configuration parameter file and the initial query information, data detection is performed on the initial version database and the target version database to obtain a detection result.

[0057] Optionally, the target version database controls the table data in the initial version database based on the configuration parameter file, obtains the access result after performing the access operation on the initial version database, and then performs data detection based on the access result and the initial query information to obtain the detection result.

[0058] Optionally, the test result may be a test success result or a test failure result. A test success result indicates that the upgrade / rollback test of the target version database has passed, and a test failure result indicates that the upgrade / rollback test of the target version database has not passed. The upgrade / rollback test may test the rollback function and performance of the target version database.

[0059] Optionally, since the database installation script, structured query language script, information configuration script, detection script, etc. are all integrated in the total script, the execution script automatically implements the target version database installation, parameter configuration, etc., and the target version database performs access operations on the initial version database based on the configuration parameter file without destroying the initial version database, and then realizes one-click testing of database version upgrade / rollback and other functions based on the initial query information and the information after the access operation. The operation is more convenient and simple, which improves the testing efficiency and reduces the error rate.

[0060] Optionally, the information configuration script includes a server information configuration script, a database information configuration script, and an environment information configuration script, and the associated configuration information includes initial server node connection information, initial version database information, and file path information; wherein, calling the information configuration script to modify the target parameter file based on the associated configuration information of the initial version database to obtain the configuration parameter file includes: executing the server information configuration script to configure the target parameter file based on the initial server node connection information to obtain a first configuration parameter file; executing the database information configuration script to configure the target parameter file based on the initial version database information to obtain a second configuration parameter file; executing the environment information configuration script to configure the target parameter file based on the file path information to obtain a third configuration parameter file, wherein the configuration parameter files include the first configuration parameter file, the second configuration parameter file, and the third configuration parameter file.

[0061] Optionally, the server information configuration script is used to configure the server information in the target parameter file, the database information configuration script is used to configure the database path information, log path information, etc. in the target parameter file, and the environment information configuration script is used to configure the execution environment information in the target parameter file.

[0062] Optionally, the database installation script also includes configuration information of the target server node associated with the target version database. The database installation script is executed to install the target version database and configure the target server node to support the target version database. The target server node performs transaction operations on the target version database based on the target parameter file. The target parameter file includes target server node connection information, target version database information, and file path information. The target parameter file is stored in the directory xx_2 where the target version database is located. The target parameter file path is xx_2 / etc. The target parameter file directory contains the first sub-file, the second sub-file, and the third sub-file. The target server node connection information is stored in the first sub-file.

[0063] Optionally, the server information configuration script is executed to copy and rename the first subfile, and the target server node connection information in the renamed first subfile is modified according to the initial server node connection information to obtain a first configuration parameter file.

[0064] For example, the initial server node is 1, the target server node is 2, the first sub-file is named sqlhost.ol_xxdbt1210_2, the first sub-file is copied to the target parameter file directory and renamed sqlhost.ol_xxdbt1210_1, and the target server node connection information in the file named sqlhost.ol_xxdbt1210_1 is modified according to the initial server node connection information to obtain the first configuration parameter file.

[0065] Optionally, the database information configuration script is executed, the target version database information is stored in the second subfile, the second subfile is copied and renamed, and the target version database information in the renamed second subfile is modified according to the initial version database information to obtain a second configuration parameter file.

[0066] For example, taking the above-mentioned initial server node as 1 and the target server node as 2 as an example, the second sub-file is named onconfig.ol_xxdbt1210_2, the second sub-file is copied to the target parameter file directory and renamed onconfig.ol_xxdbt1210_1, and the target version database information in the file named onconfig.ol_xxdbt1210_1 is modified according to the initial version database information to obtain the second configuration parameter file.

[0067] Optionally, the environment information configuration script is executed, the file path information of the target version database is stored in the third sub-file, the third sub-file is copied and renamed, and the file path information of the target version database in the renamed third sub-file is modified according to the file path information of the initial version database to obtain a third configuration parameter file.

[0068] For example, taking the above-mentioned initial server node as 1 and the target server node as 2 as an example, the third sub-file is named ol_xxdbt1210_2.ksh, the third sub-file is copied to the target parameter file directory and renamed ol_xxdbt1210_1.ksh, and the file path information of the target version database in the file named ol_xxdbt1210_1.ksh is modified according to the file path information of the initial version database to obtain the third configuration parameter file.

[0069] Optionally, after obtaining the configuration parameter file, execute (source) the third configuration parameter file ol_xxdbt1210_1.ksh to restart the target version database. Check the database status through the target version database internal command, such as checking whether the target version database can be started normally. If the startup fails, return the failure information and end the test. If the startup succeeds, perform subsequent tests.

[0070] Optionally, the restarted target version database is associated with both the target server node and the initial server node.

[0071] Optionally, the initial server node connection information includes initial server node name information, initial server node address information, and initial server node port information; the initial version database information includes database log storage path information and space storage path information; and the file path information represents the path information of the configuration parameter file.

[0072] Optionally, the initial server node address information may be a gateway protocol address (Internet Protocol, IP).

[0073] Optionally, the initial version database information includes database log storage path information and space storage path information. The space storage path information is used to access table data in the database, and the database log storage path information is used to store log records associated with database transaction operations, etc. The database log storage path information includes the database operation log file storage path, the database physical log storage path and size, and the database logical log storage path and size.

[0074] Optionally, the initial version database information may also include a database service number. When configuring the target parameter file based on the initial version database information, the spatial storage path information and database service number of the target version database need to be modified to the spatial storage path information and database service number of the initial version database, while the database log storage path information may be selectively modified.

[0075] Optionally, the file path information of the target version database may include target server node path information, first configuration parameter file path information, and second configuration parameter file path information.

[0076] Optionally, the target parameter file related to the target version database is modified based on the associated configuration information of the initial version database, and then the initial version database is connected. All configuration modification operations are to copy the original sub-file first, and then make changes to the copied file. Then, without destroying the original sub-file and the initial version database, when the configuration files are modified, the corresponding initial version database can be controlled by restarting different initial server nodes.

[0077] Optionally, the structured query language script includes a first write operation script and a first read operation script; wherein, executing the structured query language script on the initial version database based on the initial server node to obtain initial query information includes: executing the first write operation script on the table data in the initial version database based on the initial server node to obtain initial change information; executing the first read operation script on the initial change information based on the initial server node to obtain initial query information.

[0078] Optionally, for the initial version database, a first write operation script is executed based on the initial server node, and the first write operation script calls a structured query language file to perform a transaction operation on the table data in the initial version database to obtain initial change information. The structured query language file can be a data definition language (Data Definition Languages, DDL) or a data manipulation language (Data Manipulation Language, DML).

[0079] For example, a data insert operation is performed on table data in the initial version database to obtain initial change information.

[0080] Optionally, for the initial version database, a first read operation script is executed based on the initial server node, and the first read operation script calls the structured query language file to perform a transaction operation on the initial change information to obtain initial query information. For example, a query operation is performed on the initial change information based on the target field to obtain the initial query information.

[0081] Optionally, based on the configuration parameter file and the initial query information, data detection is performed on the initial version database and the target version database to obtain detection results including: based on the configuration parameter file, using the target version database to execute a first read operation script on the initial change information in the initial version database to obtain first target query information; and consistency detection is performed on the initial query information and the first target query information to obtain detection results.

[0082] Optionally, based on the configuration parameter file, the target version database can access the initial version database. The target version database executes the first read operation script on the initial change information in the initial version database based on the initial server node, such as querying the initial change information based on the target field to obtain the first target query information.

[0083] Optionally, a consistency check is performed on the contents of the initial query information and the first target query information to obtain a detection result.

[0084] Optionally, the test result may include a consistency test success result and an upgrade / rollback test failure result. The consistency test success result indicates that the contents in the initial query information and the first target query information are consistent, and the upgrade / rollback test failure result indicates that the contents in the initial query information and the first target query information are inconsistent.

[0085] Optionally, based on the configuration parameter file and the initial query information, data detection is performed on the initial version database and the target version database, and the detection result also includes: based on the configuration parameter file, using the target version database to execute a second write operation script on the table data in the initial version database to obtain target change information; using the target version database to execute a second read operation script on the target change information to obtain second target query information; performing keyword error detection on the target change information to obtain a first detection result; performing keyword error detection on the second target query information to obtain a second detection result.

[0086] Optionally, when a successful consistency check result is obtained, based on the configuration parameter file, a second write operation script is executed on the table data in the initial version database using the target version database to obtain target change information; a second read operation script is executed on the target change information using the target version database to obtain second target query information.

[0087] Optionally, keyword error detection is performed on the target change information to obtain a first detection result. For example, keyword error detection can check whether the error keyword appears in the target change information and the second target query information.

[0088] Optionally, the first detection result may include a normal write operation result and an upgrade / rollback test failure result. The normal write operation result indicates that no error message appears in the target change information, and the upgrade / rollback test failure result indicates that error message appears in the target change information.

[0089] Optionally, when the write operation function is normal, a keyword error detection is performed on the second target query information to obtain a second detection result. The second detection result may include a successful upgrade / fallback test result and a failed upgrade / fallback test result. The successful upgrade / fallback test result indicates that no error message appears in the second target query information, and the failed upgrade / fallback test result indicates that error message appears in the second target query information.

[0090] Optionally, each operation step is integrated into the script, and the script is used to automatically implement one-click testing of the database version upgrade / rollback function, which is more convenient and simple to operate, improves test efficiency, and reduces the error rate.

[0091] Figure 3An example schematic diagram of a database upgrade / rollback test according to an embodiment of the present invention is shown.

[0092] like Figure 3 As shown, the database upgrade / rollback test process 300 includes steps S301 to S309.

[0093] In step S301, the accuracy of the parameter transmission is checked. Specifically, in response to the script execution command, the accuracy of the parameter transmission can be checked before executing the database installation script. If the accuracy of the parameter transmission is successfully checked, the process jumps to step S302; if the accuracy of the parameter transmission fails, the process jumps to step S309.

[0094] In step S302, the target version database is installed. Specifically, the target version database is installed based on the database installation script, and the process jumps to step S303.

[0095] In step S303, the structured query language script is executed. Specifically, based on the initial server node, the table data in the initial version database is operated to obtain initial query information, and then the process jumps to step S304.

[0096] In step S304, the target parameter file is modified. Specifically, the information configuration script is called to modify the target parameter file based on the associated configuration information of the initial version database to obtain a configuration parameter file, and then the process jumps to step S305.

[0097] In step S305, the target version database is started. Specifically, the target version database is restarted after the configuration parameter file is obtained. If the startup is successful, jump to step S306; otherwise, jump to step S309.

[0098] In step S306, consistency check. Specifically, based on the configuration parameter file, the target version database is used to execute the first read operation script on the initial change information in the initial version database to obtain the first target query information; the initial query information and the first target query information are checked for consistency, and if a successful consistency check result is obtained, the process jumps to step S307; otherwise, the process jumps to step S309.

[0099] In step S307, keyword error detection is performed. Specifically, keyword error detection is performed on the target change information and the second target query information, and if no error result is detected, the process jumps to step S308; otherwise, the process jumps to step S309.

[0100] In step S308, the upgrade / rollback test is successful.

[0101] In step S309, the upgrade / rollback test fails.

[0102] Based on the above database testing method, the present invention also provides a database testing device. Figure 4 The device is described in detail.

[0103] Figure 4 A structural block diagram of a database testing device according to an embodiment of the present invention is shown.

[0104] like Figure 4 As shown, the database testing device 400 of this embodiment includes a response module 410 , a query module 420 , a configuration module 430 and a test module 440 .

[0105] The response module 410 is used to respond to the script execution command and install the target version database based on the database installation script, wherein the target version database is obtained after upgrading the initial version database. In one embodiment, the response module 410 can be used to perform the operation S210 described above, which will not be repeated here.

[0106] The query module 420 is used to execute the structured query language script on the table data in the initial version database based on the initial server node to obtain initial query information. In one embodiment, the query module 420 can be used to execute the operation S220 described above, which will not be described in detail here.

[0107] The configuration module 430 is used to call the information configuration script, modify the target parameter file based on the associated configuration information of the initial version database, and obtain the configuration parameter file, wherein the target parameter file includes the configuration information of the target version database associated with the target server node, and the target version database performs an access operation on the initial version database based on the configuration parameter file, and the associated configuration information includes the spatial storage path information of the initial version database and the configuration information of the initial server node. In one embodiment, the configuration module 430 can be used to perform the operation S230 described above, which will not be repeated here.

[0108] The test module 440 is used to perform data detection on the initial version database and the target version database based on the configuration parameter file and the initial query information to obtain the detection result. In one embodiment, the test module 440 can be used to perform the operation S240 described above, which will not be described in detail here.

[0109] Optionally, the configuration module 430 includes a first configuration submodule, a second configuration submodule and a third configuration submodule.

[0110] The first configuration submodule is used to execute the server information configuration script, configure the target parameter file based on the initial server node connection information, and obtain the first configuration parameter file.

[0111] The second configuration submodule is used to execute the database information configuration script, configure the target parameter file based on the initial version database information, and obtain the second configuration parameter file.

[0112] The third configuration submodule is used to execute the environment information configuration script, configure the target parameter file based on the file path information, and obtain a third configuration parameter file.

[0113] Optionally, the query module 420 includes a first query submodule and a second query submodule.

[0114] The first query submodule is used to execute a first write operation script on the table data in the initial version database based on the initial server node to obtain initial change information.

[0115] The second query submodule is used to execute a first read operation script on the initial change information based on the initial server node to obtain initial query information.

[0116] Optionally, the test module 440 includes a first test submodule and a second test submodule.

[0117] The first test submodule is used to execute a first read operation script on the initial change information in the initial version database using the target version database based on the configuration parameter file to obtain first target query information.

[0118] The second testing submodule is used to perform consistency detection on the initial query information and the first target query information to obtain a detection result.

[0119] Optionally, the test module 440 further includes a third test submodule, a fourth test submodule, a fifth test submodule and a sixth test submodule.

[0120] The third test submodule is used to execute a second write operation script on the table data in the initial version database using the target version database based on the configuration parameter file to obtain target change information.

[0121] The fourth test submodule is used to execute a second read operation script on the target change information using the target version database to obtain second target query information.

[0122] The fifth test submodule is used to perform keyword error detection on the target change information to obtain a first detection result.

[0123] The sixth testing submodule is used to perform keyword error detection on the second target query information to obtain a second detection result.

[0124] Optionally, any multiple modules among the response module 410, the query module 420, the configuration module 430 and the test module 440 can be combined into one module for implementation, or any one of the modules can be split into multiple modules. Alternatively, at least part of the functions of one or more of these modules can be combined with at least part of the functions of other modules and implemented in one module. Optionally, at least one of the response module 410, the query module 420, the configuration module 430 and the test module 440 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation methods of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, at least one of the response module 410, the query module 420, the configuration module 430 and the test module 440 can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.

[0125] Figure 5 A block diagram of an electronic device suitable for implementing a database testing method according to an embodiment of the present invention is shown.

[0126] Figure 5 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0127] like Figure 5 As shown, the computer electronic device 500 according to an embodiment of the present invention includes a processor 501, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 502 or the program loaded from the storage part 508 to the random access memory (RAM) 503. The processor 501 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 501 may also include an on-board memory for caching purposes. The processor 501 may include a single processing unit or multiple processing units for performing different actions of the method flow according to an embodiment of the present invention.

[0128] In RAM 503, various programs and data required for the operation of electronic device 500 are stored. Processor 501, ROM 502 and RAM 503 are connected to each other via bus 504. Processor 501 performs various operations of the method flow according to the embodiment of the present invention by executing the program in ROM 502 and / or RAM 503. It should be noted that the program can also be stored in one or more memories other than ROM 502 and RAM 503. Processor 501 can also perform various operations of the method flow according to the embodiment of the present invention by executing the program stored in one or more memories.

[0129] Optionally, the electronic device 500 may further include an input / output (I / O) interface 505, which is also connected to the bus 504. The electronic device 500 may further include one or more of the following components connected to the input / output (I / O) interface 505: an input portion 506 including a keyboard, a mouse, etc.; an output portion 507 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage portion 508 including a hard disk, etc.; and a communication portion 509 including a network interface card such as a LAN card, a modem, etc. The communication portion 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as needed. A removable medium 511, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 510 as needed, so that a computer program read therefrom is installed into the storage portion 508 as needed.

[0130] Optionally, the method flow according to the embodiment of the present invention can be implemented as a computer software program. For example, an embodiment of the present invention includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 509, and / or installed from the removable medium 511. When the computer program is executed by the processor 501, the above-mentioned functions defined in the system of the embodiment of the present invention are executed. Optionally, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.

[0131] The present invention also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiment; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the database testing method according to the embodiment of the present invention is implemented.

[0132] Optionally, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, apparatus, or device.

[0133] For example, optionally, the computer-readable storage medium may include the ROM 502 and / or the RAM 503 described above and / or one or more memories other than the ROM 502 and the RAM 503 .

[0134] An embodiment of the present invention also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present invention. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the database testing method provided by the embodiment of the present invention.

[0135] When the computer program is executed by the processor 501, the above functions defined in the system / device of the embodiment of the present invention are performed. Optionally, the system, device, module, unit, etc. described above can be implemented by a computer program module.

[0136] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 509, and / or installed from the removable medium 511. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.

[0137] Optionally, the program code for executing the computer program provided by the embodiment of the present invention can be written in any combination of one or more programming languages, specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages ​​include, but are not limited to, such as Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (e.g., using an Internet service provider to connect through the Internet).

[0138] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present invention. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments of the present invention can be combined and / or combined in various ways, even if such a combination or combination is not explicitly recorded in the present invention. In particular, without departing from the spirit and teachings of the present invention, the features recorded in the various embodiments of the present invention can be combined and / or combined in various ways. All these combinations and / or combinations fall within the scope of the present invention.

[0139] The embodiments of the present invention are described above. However, these embodiments are only for the purpose of illustration, and are not intended to limit the scope of the present invention. Although each embodiment is described above, it does not mean that the measures in each embodiment cannot be used in combination advantageously. Without departing from the scope of the present invention, those skilled in the art may make various substitutions and modifications, which should all fall within the scope of the present invention.

Claims

1. A database testing method, characterized in that: The method comprises: In response to the script execution command, a target version database is installed based on a database installation script, wherein the target version database is obtained after upgrading the initial version database; The structured query language script is executed on the table data in the initial version database based on the initial server node to obtain initial query information including: Executing a first write operation script on the table data in the initial version database based on the initial server node to obtain initial change information; Executing a first read operation script on the initial change information based on the initial server node to obtain the initial query information, wherein the structured query language script includes the first write operation script and the first read operation script; Calling an information configuration script, modifying a target parameter file based on the associated configuration information of the initial version database to obtain a configuration parameter file, wherein the target parameter file includes configuration information of the target version database associated with a target server node, the target version database performs an access operation on the initial version database based on the configuration parameter file, and the associated configuration information includes space storage path information of the initial version database and configuration information of the initial server node; Based on the configuration parameter file and the initial query information, data detection is performed on the initial version database and the target version database, and the detection results obtained include: Based on the configuration parameter file, using the target version database, execute the first read operation script on the initial change information in the initial version database to obtain first target query information; The initial query information and the first target query information are subjected to consistency check to obtain the test result, wherein the database installation script, the structured query language script, the information configuration script, and the test script for data detection are all integrated into the overall script.

2. The method according to claim 1, characterized in that The information configuration script includes a server information configuration script, a database information configuration script, and an environment information configuration script, and the associated configuration information includes initial server node connection information, initial version database information, and file path information; The calling information configuration script modifies the target parameter file based on the associated configuration information of the initial version database, and obtains the configuration parameter file including: Executing the server information configuration script, configuring the target parameter file based on the initial server node connection information, and obtaining a first configuration parameter file; Execute the database information configuration script, configure the target parameter file based on the initial version database information, and obtain a second configuration parameter file; Execute the environment information configuration script, configure the target parameter file based on the file path information, and obtain a third configuration parameter file, wherein the configuration parameter file includes the first configuration parameter file, the second configuration parameter file, and the third configuration parameter file.

3. The method according to claim 2, characterized in that The initial server node connection information includes initial server node name information, initial server node address information, and initial server node port information; the initial version database information includes database log storage path information and the space storage path information; the file path information represents the path information of the configuration parameter file.

4. The method according to claim 1, characterized in that The performing data detection on the initial version database and the target version database based on the configuration parameter file and the initial query information to obtain the detection result further comprises: Based on the configuration parameter file, using the target version database, execute a second write operation script on the table data in the initial version database to obtain target change information; Utilizing the target version database to execute a second read operation script on the target change information to obtain second target query information; Performing keyword error detection on the target change information to obtain a first detection result; Perform keyword error detection on the second target query information to obtain a second detection result.

5. A database testing device, characterized in that: The device comprises: A response module, configured to respond to a script execution command and install a target version database based on a database installation script, wherein the target version database is obtained after upgrading the initial version database; A query module, used to execute a structured query language script on the table data in the initial version database based on the initial server node to obtain initial query information, wherein the query module includes a first query submodule and a second query submodule; A first query submodule, configured to execute a first write operation script on the table data in the initial version database based on the initial server node to obtain initial change information; A second query submodule, configured to execute a first read operation script on the initial change information based on the initial server node to obtain the initial query information, wherein the structured query language script includes the first write operation script and the first read operation script; A configuration module, used to call an information configuration script, modify a target parameter file based on the associated configuration information of the initial version database, and obtain a configuration parameter file, wherein the target parameter file includes configuration information of the target version database associated with a target server node, the target version database performs an access operation on the initial version database based on the configuration parameter file, and the associated configuration information includes space storage path information of the initial version database and configuration information of the initial server node; A test module, used to perform data detection on the initial version database and the target version database based on the configuration parameter file and the initial query information to obtain a detection result, wherein the test module includes a first test submodule and a second test submodule; A first test submodule is configured to execute the first read operation script on the initial change information in the initial version database using the target version database based on the configuration parameter file to obtain first target query information; The second test submodule is used to perform consistency detection on the initial query information and the first target query information to obtain the detection result, wherein the database installation script, the structured query language script, the information configuration script, and the detection script for data detection are all integrated in the overall script.

6. An electronic device, characterized in that: include: one or more processors; a memory for storing one or more instructions, Wherein, when the one or more instructions are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: Executable instructions are stored thereon, and when the instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 4.

8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.

Citation Information

Patent Citations

  • Business operation monitoring alarm method and system, electronic equipment and storage medium

    CN110716832A