Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redesign JavaScript API implementation #124

Closed
pablochacin opened this issue Mar 22, 2023 · 0 comments · Fixed by #126
Closed

Redesign JavaScript API implementation #124

pablochacin opened this issue Mar 22, 2023 · 0 comments · Fixed by #126
Milestone

Comments

@pablochacin
Copy link
Collaborator

pablochacin commented Mar 22, 2023

The xk6-disruptor API is built around the concept of disruptors that inject faults. Presently, each disruptor implements one method for each type of fault it injects and different disruptors can implement the same method if they are able to inject the same type of fault. For example, ServiceDisruptor and PodDisruptor both implement the InjectHTTPFault method for injecting HttpFaults.

This API is exposed to the JS code by a series of adaprters that validates and convert the objects received from Javascript, delegates the execution to the corresponding disruptor and return the result or raises an error.

Replicating the methods for fault injection in multiple disruptors creates significant duplication in the implementation of the JS API: each adapter must re-implement the methods of the disruptor that it wraps.

Following the example above, the adapters for PodDisruptor and ServiceDisruptor must both implement the method InjectHTTPFault. This duplication will increase as more fault types and disruptors are added. For example, it is to be expected that both the PodDisruptor and a future NodeDisruptor implements an InjectNetworkFaults method for injecting network-level faults.

@pablochacin pablochacin added this to the v0.2.0 milestone Mar 22, 2023
@pablochacin pablochacin changed the title Redesign Fault Injection JavaScript API Redesign Fault Injection JavaScript API implementation Mar 22, 2023
@pablochacin pablochacin changed the title Redesign Fault Injection JavaScript API implementation Redesign JavaScript API implementation Mar 22, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant