CROSS-REFERENCE TO RELATED APPLICATION

This application claims priority to Chinese Patent Application No. 202010479965.9, filed on May 29, 2020, which is hereby incorporated by reference in its entirety.

TECHNICAL FIELD

The application relates to the technical field of computers, in particular to the field of cloud computing.

BACKGROUND

With the development of micro-service technology, the robustness and fault tolerance of the system are greatly improved, and more and more users can be carried. However, according to incomplete statistics, the fault tolerance of the program itself and the faults caused by unexpected code defects account for more than50% of all faults.

SUMMARY

A fault injection method and apparatus, an electronic device and a storage medium are provided according to embodiments of the application.

In one aspect, a fault injection method is provided according to an embodiment of the application, the method including:

acquiring a fault injection task, which includes at least one target service identification and a fault scenario corresponding to the target service identification;

determining a target service according to each target service identification, and acquiring a state of the target service; and

injecting the fault scenario corresponding to the target service identification into the target service in a case that the state of the target service is a normal state.

In another aspect, a fault injection apparatus is provided according to an embodiment of the application, the apparatus including:

a first acquisition module configured for acquiring a fault injection task, which includes at least one target service identification and a fault scenario corresponding to the target service identification;

a second acquisition module configured for determining a target service according to each target service identification, and acquiring a state of the target service; and

an injection module configured for injecting the fault scenario corresponding to the target service identification into the target service in a case that the state of the target service is a normal state.

It is to be understood that the description in this section is not intended to identify key or critical features of the embodiments of the present application, nor is it intended to limit the scope of the application. Other features of the present application will become readily apparent from the following description.

