Chaotic test method and device, electronic equipment and storage medium

By verifying the permissions of test users during chaos testing, the test location and namespace scope are ensured to be within the preset range, thus solving the problem of fault injection affecting other systems in existing technologies and improving the security of system operation.

CN115904941BActive Publication Date: 2026-06-23AGRICULTURAL BANK OF CHINA

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
AGRICULTURAL BANK OF CHINA
Filing Date
2022-10-28
Publication Date
2026-06-23

AI Technical Summary

Technical Problem

In existing chaos testing tools, the fault injection permission management method is either zero or one, which causes the test to affect other systems deployed on the same node, thus affecting system security.

Method used

After the test user passes the permission verification, the platform service resources are obtained based on the test information, the chaos test resources are determined, and test cases are generated for testing. This ensures that the test location and namespace scope are within the preset range, avoiding impact on other systems.

Benefits of technology

It improves the security of system operation, prevents fault injection from affecting other projects deployed on the same node, and protects the system operation from interference.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115904941B_ABST
    Figure CN115904941B_ABST
Patent Text Reader

Abstract

The application discloses a kind of chaotic test method, device, electronic equipment and storage medium.The method comprises: in the case where determining that test user passes through test authority authentication, platform service resource is acquired based on the test information of the test user;When detecting the resource state change of the platform service resource, determine chaotic test resource based on the platform service resource;Test case of the cluster service platform is generated based on the chaotic test resource and the test information, and the cluster service platform is tested based on the test case.The technical solution disclosed by the application solves the problem that the fault injection of one project in the test process of the prior art affects other projects deployed on the same node, achieves the purpose of protecting the system from being affected during chaotic testing, and improves the security of system operation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of computer technology, and in particular to a chaos testing method, apparatus, electronic device, and storage medium. Background Technology

[0002] As distributed systems become increasingly complex, and with the gradual migration of systems to the cloud, system stability faces significant challenges. Chaos testing can proactively identify weaknesses in a system and examine its response to unexpected situations, thereby making the system more robust.

[0003] Chaos testing is now widely used, making a good chaos testing tool crucial. Existing chaos testing tools can inject faults at the node, pod, and container levels. However, node-level failures affect not only the target system but also all systems deployed on that node. Therefore, a permission verification module is needed to ensure the test proceeds smoothly without impacting other systems.

[0004] The current access control scheme uses a zero-or-one approach, where users only have either "use" or "cannot use" permissions. As long as a user has "use" permission, they can create any fault injection based on nodes, pods, and containers, without any further granular access control. This open management approach may unnecessarily impact other systems deployed on the same node, thereby affecting the system's security during testing. Summary of the Invention

[0005] This invention provides a chaos testing method, apparatus, electronic device, and storage medium to solve the problem in existing technology where fault injection in one project affects other projects deployed on the same node. It achieves the goal of protecting the system operation from being affected during chaos testing and improves the security of system operation.

[0006] In a first aspect, embodiments of the present invention provide a chaos testing method, the method comprising:

[0007] If it is confirmed that the test user has passed the test permission verification, the platform service resources are obtained based on the test user's test information.

[0008] When a change in the resource status of the platform service resources is detected, chaos test resources are determined based on the platform service resources;

[0009] Test cases for the cluster service platform are generated based on the chaos test resources and the test information, and the cluster service platform is tested based on the test cases.

[0010] Optionally, the method further includes:

[0011] Upon receiving a test instruction from a test user, obtain the test information of the test user;

[0012] Obtain a preset permission verification mechanism, and perform test permission verification on the test information based on the permission verification mechanism to determine whether the test user has passed the test permission verification.

[0013] Optionally, the test information includes the test location and the test namespace scope;

[0014] The step of verifying test permissions for the test information based on the permission verification mechanism to determine whether the test user has test permissions includes:

[0015] Based on the permission verification mechanism, the permission verification is performed sequentially on the test location and the scope of the test namespace.

[0016] If both the test location and the test namespace scope pass verification, it indicates that the test user has passed the test permission verification.

[0017] Optionally, the method further includes:

[0018] If the test location fails verification, a first test prompt message is generated based on a preset test location threshold, so that the test user can generate a test location that meets the test location threshold.

[0019] If the test namespace scope fails validation, a second test prompt message is generated based on a preset test namespace scope threshold, so that the test user can generate a test namespace scope that meets the test namespace scope threshold.

[0020] Optionally, the method further includes:

[0021] Obtain a preset monitoring mechanism, and monitor the platform service resources in the cluster service platform based on the monitoring mechanism;

[0022] Based on the monitoring results, determine whether the resource status of the platform service resources has changed.

[0023] Optionally, creating chaos test resources based on the platform service resources includes:

[0024] Obtain the event operations corresponding to the resource state changes, and perform corresponding operations on the platform service resources based on the event operations to obtain the chaos test resources.

[0025] Optionally, the step of generating test cases for the cluster service platform based on the chaos test resources and the test information, and testing the cluster service platform based on the test cases, includes:

[0026] Based on the test information, multiple test locations of the cluster service platform are determined, and test faults are injected into each of the test locations based on the chaos test resources.

[0027] Test cases for the cluster service platform are generated based on the test faults, and the cluster service platform is tested based on the test cases.

[0028] Secondly, embodiments of the present invention also provide a chaos testing device, the device comprising:

[0029] The platform service resource acquisition module is used to create platform service resources based on the test information of the test user, provided that the test user has test permissions.

[0030] The chaos test resource acquisition module is used to create chaos test resources based on the platform service resources when a change in the resource status of the platform service resources is detected.

[0031] The chaos testing module is used to generate test cases for the cluster service platform based on the chaos testing resources and the test information, and to test the cluster service platform based on the test cases.

[0032] Thirdly, embodiments of the present invention also provide an electronic device, comprising:

[0033] At least one processor; and

[0034] A memory communicatively connected to the at least one processor; wherein,

[0035] The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the chaos testing method according to any embodiment of the present invention.

[0036] Fourthly, embodiments of the present invention also provide a computer-readable storage medium storing computer instructions that, when executed by a processor, implement the chaos testing method of any embodiment of the present invention.

[0037] The technical solution provided by this invention obtains platform service resources based on the test user's test information after verifying the test user's test permissions; when a change in the resource status of the platform service resources is detected, chaotic test resources are determined based on the platform service resources; test cases for the cluster service platform are generated based on the chaotic test resources and test information, and the cluster service platform is tested based on the test cases. This technical solution verifies the test user's test permissions based on the desired test location before conducting chaotic testing, i.e., it determines whether the test location exceeds a preset range. When the test user passes the test verification, chaotic testing is allowed, solving the problem in existing technologies where fault injection in one project affects other projects deployed on the same node. This achieves the goal of protecting system operation from being affected during chaotic testing, improving system security.

[0038] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description

[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0040] Figure 1 This is a flowchart of a chaos testing method provided in Embodiment 1 of the present invention;

[0041] Figure 2 This is a flowchart of an authorization verification method provided in Embodiment 1 of the present invention;

[0042] Figure 3 This is a flowchart of determining resources according to Embodiment 1 of the present invention;

[0043] Figure 4 This is a schematic diagram of the structure of a chaos testing device according to Embodiment 2 of the present invention;

[0044] Figure 5 This is a schematic diagram of the structure of an electronic device that implements the chaos testing method of this invention. Detailed Implementation

[0045] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0046] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in sequences other than those illustrated or described herein.

[0047] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.

[0048] It is understood that before using the technical solutions disclosed in the various embodiments of this disclosure, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0049] For example, upon receiving a user's active request, a prompt message is sent to the user to explicitly inform them that the requested operation will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the software or hardware, such as the electronic device, application, server, or storage medium performing the operations of this disclosed technical solution, based on the prompt message.

[0050] As an optional but non-limiting implementation, in response to a user's active request, sending a prompt message to the user can be done via a pop-up window, where the prompt message can be presented in text format. Furthermore, the pop-up window can also include a selection control allowing the user to choose "agree" or "disagree" to provide personal information to the electronic device.

[0051] It is understood that the above notification and user authorization process are merely illustrative and do not constitute a limitation on the implementation of this disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of this disclosure.

[0052] It is understood that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and related provisions.

[0053] Example 1

[0054] Figure 1 The flowchart below illustrates a chaos testing method provided in Embodiment 1 of the present invention. This embodiment is applicable to chaos testing of a cluster service platform. The method can be executed by a chaos testing device, which can be implemented in hardware and / or software and can be configured in a cloud server. Figure 1 As shown, the method includes:

[0055] S110. If it is determined that the test user has passed the test permission verification, obtain platform service resources based on the test user's test information.

[0056] Currently, user permissions for test users in chaos testing are limited to a zero-to-one permission management method. This means that if a user has access to the current system, they can perform chaos testing at any test location within the system. However, if a user performs chaos testing at a node within the current system, it can cause other applications running on that node to malfunction, affecting the continuity and security of the system. To address this issue, the technical solution of this invention verifies the test permission based on the test location the user intends to perform the chaos test before the test user begins the test. Specifically, it determines whether the test location exceeds a preset range. When the test user passes the verification, it indicates that the test location is within the preset range, and the user is allowed to perform chaos testing at their desired location.

[0057] Specifically, user permissions can be verified using a pre-defined test management service on the cluster service platform. After successful verification, chaos testing can be performed on the cluster service platform using this pre-defined test management service. Optionally, the cluster service platform can be Kubernetes, and the pre-defined test management service can be the operator component within Kubernetes. Specifically, this operator component is written in Go.

[0058] Optionally, the method for verifying the permissions of test users based on a preset test management service in this embodiment of the invention may include: upon receiving a test instruction from a test user, obtaining the test information of the test user; obtaining a preset permission verification mechanism, and verifying the test permissions of the test information based on the permission verification mechanism to determine whether the test user has passed the test permission verification.

[0059] In this embodiment, the test user can be the user performing chaos testing on the system, and the test information can also be understood as the test information for performing chaos testing on the system. Optionally, the test information can be obtained from pre-generated test documents based on the test user information. Specifically, the test information may include information such as the test location where the test user performs the test.

[0060] Specifically, test users process the acquired test information using YAML to create user resources that generate custom resources. It's important to note that these user resources can be initial platform service resources that need adjustment. That is, after adjusting the user resources, platform service resources for chaos testing can be obtained. Furthermore, based on the user resources, a pre-defined permission verification mechanism from the test management service is obtained, and test permissions are verified for the test information based on this mechanism.

[0061] In this embodiment, the test information includes the test location and the test namespace scope. Accordingly, the method for verifying test permissions for the test information includes: sequentially verifying permissions for the test location and the test namespace scope based on a permission verification mechanism; if both the test location and the test namespace scope pass verification, it indicates that the test user has passed the test permission verification.

[0062] It should be noted that the test location includes the level corresponding to the test location of the injected test fault in the cluster service platform. The cluster service platform in this embodiment includes nodes, pods, and containers, ordered from high to low level.

[0063] Specifically, when obtaining test information, the test location that needs to be injected with the fault is subject to a first-level test permission verification mechanism based on a preset test location threshold. Optionally, if the test location is within the test location threshold range, it means that the current test user has passed the permission verification for the test location. For example, whether the test location is within the test location threshold range can be understood as follows: when the test location threshold is pod, if the test user's test location is a container or pod, the test user passes the permission verification for the test location; conversely, if the test user's test location is a node, the test user fails the permission verification for the test location.

[0064] It should be noted that if the test location fails the verification, a first test prompt message will be generated based on the preset test location threshold, so that the test user can generate a test location that meets the test location threshold.

[0065] Specifically, when a test user receives the first test prompt, the test user can modify the test position based on the test position threshold in the first test prompt to generate a test position within the test position threshold range, thereby verifying the test position; of course, the test user can also regenerate a test position within the test position threshold range and perform subsequent chaos tests based on that test position.

[0066] Optionally, when the test user passes the permission verification for the test location, a second level of test permission verification is performed on the test namespace scope for the test user.

[0067] Specifically, the cluster service platform checks if a test namespace scope corresponding to the test location exists. Optionally, if it exists, it means the test user has passed the permission verification for the test namespace scope; otherwise, if it does not exist, it means the test user has not passed the permission verification for the test namespace scope.

[0068] It should be noted that if the test namespace scope fails validation, a second test prompt message will be generated based on the preset test namespace scope threshold, so that the test user can generate a test namespace scope that meets the test namespace scope threshold.

[0069] The preset test namespace scope threshold can be understood as the namespace scope existing in the cluster service platform. Specifically, when a test user receives the second test prompt, they can modify their test namespace scope based on the test namespace scope threshold in the second test prompt to generate a test namespace scope within the threshold range, thus passing the test namespace scope verification. Alternatively, the test user can regenerate a test namespace scope within the threshold range and perform subsequent chaos tests based on that test namespace scope.

[0070] Optionally, if both the test location and the test namespace scope pass verification, it means that the test user has passed the test permission verification; otherwise, if either the test location or the test namespace scope fails verification, it means that the test user has not passed the test permission verification, i.e., does not have the permission to perform chaos testing.

[0071] Optionally, once the test user has passed the test permission verification (i.e., the test user has test permissions), finalizers are set on the previously created user resources to obtain the completed platform service resources, i.e., PaaSBlade.

[0072] S120. When a change in the resource status of a platform service resource is detected, the chaos test resource is determined based on the platform service resource.

[0073] In this embodiment of the invention, the chaos test resource can be a resource used to inject test faults during chaos testing. Specifically, in Kubernetes, the chaos test resource can be understood as ChaosBlade.

[0074] In practical applications, after a platform service resource is created, the cluster service platform's preset test management service monitors the platform service resource to obtain information on changes in its resource status. In this embodiment, the creation of a platform service resource is one type of resource status change. Specifically, other types of status changes include the modification and deletion of platform service resources.

[0075] Optionally, the method for monitoring platform service resources in this embodiment may include: obtaining a preset monitoring mechanism, and monitoring platform service resources in the cluster service platform based on the monitoring mechanism; and determining whether the resource status of the platform service resources has changed based on the monitoring results.

[0076] The preset monitoring mechanism can be understood as the operator's reconcile mechanism. In practical applications, when a PaaSLabe is created, the controller in the operator monitors the creation operation and then enters the reconcile mechanism. When the reconcile mechanism detects that a platform service resource has been added, deleted, or modified, it indicates that the resource status of the platform service resource has changed.

[0077] Based on the above implementation, when the resource state changes, the chaos test resource is determined based on the changed platform service resource. Optionally, the method for creating the chaos test resource based on the platform service resource in this embodiment may include: obtaining the event operation corresponding to the resource state change, performing the corresponding operation on the platform service resource based on the event operation, and obtaining the chaos test resource.

[0078] Event operations can include deletion operations, retrieval operations, etc. Specifically, after determining the event operation corresponding to the state change, the event result corresponding to the operation result after the event operation is determined, and the method of obtaining the chaos test resources is determined based on the event result, and the chaos test resources are obtained based on the method of obtaining them.

[0079] For example, the event operation corresponding to a change in resource status is identified as an acquisition operation. Further, it is determined whether the acquisition operation was successful. If successful, the chaos test resource is directly obtained based on the acquisition result; otherwise, if unsuccessful, the chaos test resource is created based on the platform service resource.

[0080] S130. Generate test cases for the cluster service platform based on chaotic test resources and test information, and test the cluster service platform based on the test cases.

[0081] In this embodiment of the invention, the method for testing a cluster service platform may include: determining multiple test locations of the cluster service platform based on test information, injecting test faults at each test location based on chaotic test resources, generating test cases for the cluster service platform based on each test fault, and testing the cluster service platform based on the test cases.

[0082] Specifically, the test locations contained in the test information are obtained, and the corresponding test locations are determined based on these locations. For example, if the test level includes pods and containers, the test pods that need to be tested are determined based on the test information, and the test containers that need to be tested are determined within those test pods. The determined test pods and test containers are used as test locations for injecting test faults, and test faults are injected at each location. Test cases for the cluster service platform are generated based on the injected test faults and other test information, and the test cases are tested to complete the chaos test of the cluster service platform.

[0083] The technical solution provided by this invention obtains platform service resources based on the test user's test information after verifying the test user's test permissions; when a change in the resource status of the platform service resources is detected, chaotic test resources are determined based on the platform service resources; test cases for the cluster service platform are generated based on the chaotic test resources and test information, and the cluster service platform is tested based on the test cases. This technical solution verifies the test user's test permissions based on the desired test location before conducting chaotic testing, i.e., it determines whether the test location exceeds a preset range. When the test user passes the test verification, chaotic testing is allowed, solving the problem in existing technologies where fault injection in one project affects other projects deployed on the same node. This achieves the goal of protecting system operation from being affected during chaotic testing, improving system security.

[0084] Based on the above embodiments, this invention also provides a preferred embodiment. This preferred embodiment uses Kubernetes as an example of the cluster service platform in this invention to describe the chaos testing method in detail. Optionally, the steps of the chaos testing method in this preferred embodiment include: first, not granting the user permission to use the ChaosBlade tool, and then granting the user permission to use the PaaSBlade tool. When the user creates and uses the PaaSBlade tool object through a YAML file, a permission check is performed on the fault injection test the user wants to create. If the check passes, the PaaSBlade tool creates and uses the ChaosBlade tool object to perform fault injection; if the check fails, the user's request is directly rejected, and the reason for the failure is explained, asking the user to modify the YAML file and try again.

[0085] Optionally, methods for performing user permission checks can be found in [link to relevant documentation]. Figure 2 Specifically, users need to create a custom resource's CRD using YAML. After resource creation, PaaSblade uses the operator's webhook mechanism to validate the resource's validity and sets finalizers. The validation steps include: determining the fault injection location based on the user-created resource and verifying whether the fault injection location meets the validation criteria; if not, an error message is sent to the user; if it does, namespace scope validation is performed. The namespace scope validation is verified to meet the validation criteria; if it does, the validation passes; otherwise, an error message is sent to the user.

[0086] Optionally, for a method to obtain ChaosBlade based on PaaSBlade, please refer to [link / reference]. Figure 3Specifically, PaaSBlade's processing flow is a reconcile operation. When a monitored resource is added, deleted, or modified, the controller receives information about the monitored resource and performs further processing. The specific steps are as follows: 1. When the trigger condition occurs, obtain a custom resource object of PaaSBladeoperator based on the namespace name and resource name; 2. Check if the acquisition was successful; 3. If unsuccessful, skip to step 1; 4. If successful, check if it is a deletion operation; 5. If it is a deletion operation, first delete other resources created by this resource, such as custom resources of the ChaosBlade tool, then update the state of the PaaSBlade custom resource object, and skip to step 1; 6. If it is not a deletion operation, obtain a custom resource object of ChaosBlade based on the namespace name and resource name; 7. If successful, skip to step 9; 8. If unsuccessful, create a custom resource of the ChaosBlade tool; 9. Update the state of the PaaSBlade custom resource object; 10. Return to the beginning of the reconcile loop and wait for the next trigger.

[0087] Example 2

[0088] Figure 4 This is a schematic diagram of a chaos testing device provided in Embodiment 3 of the present invention. Figure 4 As shown, the device includes: a platform service resource acquisition module 210, a chaos test resource acquisition module 220, and a chaos test module 230; wherein,

[0089] The platform service resource acquisition module 210 is used to acquire platform service resources based on the test information of the test user when it is determined that the test user has test permissions.

[0090] The chaos test resource acquisition module 220 is used to determine chaos test resources based on the platform service resources when a change in the resource status of the platform service resources is detected.

[0091] The chaos testing module 230 is used to generate test cases for the cluster service platform based on the chaos testing resources and the test information, and to test the cluster service platform based on the test cases.

[0092] Optionally, based on the above embodiments, the apparatus further includes:

[0093] The test information acquisition module is used to acquire the test information of the test user when a test instruction is received from the test user.

[0094] The test permission verification module is used to obtain a preset permission verification mechanism, and perform test permission verification on the test information based on the permission verification mechanism to determine whether the test user has passed the test permission verification.

[0095] Based on the above embodiments, optionally, the test information includes the test location and the test namespace scope;

[0096] The test permission verification module includes:

[0097] The permission verification unit is used to sequentially verify the permissions of the test location and the test namespace scope based on the permission verification mechanism.

[0098] The permission verification result acquisition unit is used to indicate that the test user has passed the test permission verification if both the test location and the test namespace scope pass the verification.

[0099] Optionally, based on the above embodiments, the apparatus further includes:

[0100] The first test prompt information generation module is used to generate a first test prompt information based on a preset test location threshold if the test location fails to pass the verification, so that the test user can generate a test location that meets the test location threshold.

[0101] The second test prompt information generation module is used to generate a second test prompt information based on a preset test namespace scope threshold if the test namespace scope fails the verification, so that the test user can generate a test namespace scope that meets the test namespace scope threshold.

[0102] Based on the above embodiments, optionally, the device includes:

[0103] The resource monitoring module is used to obtain a preset monitoring mechanism and monitor the platform service resources in the cluster service platform based on the monitoring mechanism.

[0104] The resource status determination module is used to determine whether the resource status of the platform service resources has changed based on the monitoring results.

[0105] Based on the above embodiments, optionally, the chaos test resource acquisition module 220 includes:

[0106] The chaos test resource acquisition unit is used to acquire event operations corresponding to resource state changes, and perform corresponding operations on the platform service resources based on the event operations to obtain chaos test resources.

[0107] Based on the above embodiments, optionally, the chaos testing module 230 includes:

[0108] The test fault injection unit is used to determine multiple test locations of the cluster service platform based on test information, and inject test faults into each of the test locations based on the chaotic test resources.

[0109] The testing unit is used to generate test cases for the cluster service platform based on each of the test faults, and to test the cluster service platform based on the test cases.

[0110] The chaos testing device provided in the embodiments of the present invention can execute the chaos testing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0111] Example 3

[0112] Figure 5 A schematic diagram of an electronic device 10, which can be used to implement embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0113] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or loaded from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0114] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0115] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as chaos testing methods.

[0116] In some embodiments, the chaos testing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the chaos testing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the chaos testing method by any other suitable means (e.g., by means of firmware).

[0117] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0118] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0119] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0120] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0121] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0122] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0123] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0124] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A chaotic test method, characterized by, Applied to cluster service platforms, including: If it is confirmed that the test user has passed the test permission verification, the platform service resources are obtained based on the test user's test information. When a change in the resource status of the platform service resources is detected, chaos test resources are determined based on the platform service resources; Test cases for the cluster service platform are generated based on the chaos test resources and the test information, and the cluster service platform is tested based on the test cases. The method further includes: Upon receiving a test instruction from a test user, obtain the test information of the test user; Obtain a preset permission verification mechanism, and perform test permission verification on the test information based on the permission verification mechanism to determine whether the test user has passed the test permission verification; The test information includes the test location and the test namespace scope; wherein, the test location includes the level corresponding to the test location of the injected test fault in the cluster service platform; the cluster service platform includes nodes, pods and containers sorted in descending order of level; The step of verifying test permissions for the test information based on the permission verification mechanism to determine whether the test user has test permissions includes: Based on the permission verification mechanism, the permission verification is performed sequentially on the test location and the scope of the test namespace. If both the test location and the test namespace scope pass the verification, it means that the test user has passed the test permission verification. The method further includes: If the test location fails verification, a first test prompt message is generated based on a preset test location threshold, so that the test user can generate a test location that meets the test location threshold. If the test namespace scope fails validation, a second test prompt message is generated based on a preset test namespace scope threshold, so that the test user can generate a test namespace scope that meets the test namespace scope threshold. If the test location fails verification, a first test prompt message is generated based on a preset test location threshold to enable the test user to generate a test location that meets the test location threshold, including: When the test user receives the first test prompt information, the test user modifies its test position based on the test position threshold in the first test prompt information to generate a test position within the range of the test position threshold, and verifies the test position; or, the test user regenerates a test position within the range of the test position threshold, and performs subsequent chaos tests based on the test position. If the test namespace scope fails validation, a second test prompt message is generated based on a preset test namespace scope threshold, so that the test user can generate a test namespace scope that meets the test namespace scope threshold, including: When the test user receives the second test prompt information, they modify the test namespace scope based on the test namespace scope threshold in the second test prompt information to generate a test namespace scope within the range of the test namespace scope threshold, and verify it through the test namespace scope; or, the test user regenerates the test namespace scope within the range of the test namespace scope threshold, and performs subsequent chaos tests based on the test namespace scope.

2. The method of claim 1, wherein, The method further includes: Obtain a preset monitoring mechanism, and monitor the platform service resources in the cluster service platform based on the monitoring mechanism; Based on the monitoring results, determine whether the resource status of the platform service resources has changed.

3. The method of claim 1, wherein, The determination of chaos test resources based on the platform service resources includes: Obtain the event operations corresponding to the resource state changes, and perform corresponding operations on the platform service resources based on the event operations to obtain the chaos test resources.

4. The method of claim 1, wherein, The process of generating test cases for the cluster service platform based on the chaos test resources and the test information, and testing the cluster service platform based on the test cases, includes: Based on the test location, multiple test locations of the cluster service platform are determined, and test faults are injected into each of the test locations based on the chaotic test resources. Test cases for the cluster service platform are generated based on the test faults, and the cluster service platform is tested based on the test cases.

5. A chaotic test apparatus, characterized by, include: The platform service resource acquisition module is used to acquire platform service resources based on the test information of the test user, provided that the test user has test permissions. The chaos test resource acquisition module is used to determine chaos test resources based on the platform service resources when a change in the resource status of the platform service resources is detected. The chaos testing module is used to generate test cases for the cluster service platform based on the chaos testing resources and the test information, and to test the cluster service platform based on the test cases. The device further includes: The test information acquisition module is used to acquire the test information of the test user when a test instruction is received from the test user. The test permission verification module is used to obtain a preset permission verification mechanism, and perform test permission verification on the test information based on the permission verification mechanism to determine whether the test user has passed the test permission verification. The test information includes the test location and the test namespace scope; wherein, the test location includes the level corresponding to the test location of the injected test fault in the cluster service platform; the cluster service platform includes nodes, pods and containers sorted in descending order of level; The test permission verification module specifically includes: The permission verification unit is used to sequentially verify the permissions of the test location and the test namespace scope based on the permission verification mechanism. The permission verification result acquisition unit is used to indicate that the test user has passed the test permission verification if both the test location and the test namespace scope pass the verification. The device further includes: The first test prompt information generation module is used to generate a first test prompt information based on a preset test location threshold if the test location fails to pass the verification, so that the test user can generate a test location that meets the test location threshold. The second test prompt information generation module is used to generate a second test prompt information based on a preset test namespace scope threshold if the test namespace scope fails the verification, so that the test user can generate a test namespace scope that meets the test namespace scope threshold. If the test location fails verification, a first test prompt message is generated based on a preset test location threshold to enable the test user to generate a test location that meets the test location threshold, including: When the test user receives the first test prompt information, the test user modifies its test position based on the test position threshold in the first test prompt information to generate a test position within the range of the test position threshold, and verifies the test position; or, the test user regenerates a test position within the range of the test position threshold, and performs subsequent chaos tests based on the test position. If the test namespace scope fails validation, a second test prompt message is generated based on a preset test namespace scope threshold, so that the test user can generate a test namespace scope that meets the test namespace scope threshold, including: When the test user receives the second test prompt information, they modify the test namespace scope based on the test namespace scope threshold in the second test prompt information to generate a test namespace scope within the range of the test namespace scope threshold, and verify it through the test namespace scope; or, the test user regenerates the test namespace scope within the range of the test namespace scope threshold, and performs subsequent chaos tests based on the test namespace scope.

6. An electronic device, comprising: The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the chaos testing method according to any one of claims 1-4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the chaos testing method according to any one of claims 1-4.