-
Notifications
You must be signed in to change notification settings - Fork 38
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
Add Chaos Engineering to inject random crashes into calls #114
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello @fernandobianchini, I've added some comments to the PR for your consideration.
Thank you for your contribution!!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think of the "IChaosStrategy" name? It sounds better to me.
|
||
var bodyBytes = Encoding.UTF8.GetBytes($"Error {httpResponse.StatusCode}: {HttpStatusCode.ServiceUnavailable}"); | ||
|
||
await httpResponse.Body.WriteAsync(bodyBytes, 0, bodyBytes.Length, default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The await is not necessary here, you can directly return the task
|
||
var bodyBytes = Encoding.UTF8.GetBytes($"Error {httpResponse.StatusCode}: {HttpStatusCode.InternalServerError}"); | ||
|
||
await httpResponse.Body.WriteAsync(bodyBytes, 0, bodyBytes.Length, default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The await is not necessary here, you can directly return the task
{ | ||
var responseDelay = new Random().Next(_options.Value.MinimumLatencyTime, _options.Value.MaximumLatencyTime); | ||
_logger.LogInformation($"Chaos Latency (ms): {responseDelay}"); | ||
await Task.Delay(responseDelay); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The await is not necessary here, you can directly return the task
|
||
var bodyBytes = Encoding.UTF8.GetBytes($"Error {httpResponse.StatusCode}: {HttpStatusCode.BadRequest}"); | ||
|
||
await httpResponse.Body.WriteAsync(bodyBytes, 0, bodyBytes.Length, default); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The await is not necessary here, you can directly return the task
|
||
} | ||
|
||
await _next(httpContext); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The await is not necessary here, you can directly return the task :)
|
||
public async Task Invoke(HttpContext httpContext) | ||
{ | ||
if (_options.Value.Enabled) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inverting this if would reduce the nesting
"profiles": { | ||
"Mockaco": { | ||
"commandName": "Project", | ||
"launchBrowser": true, | ||
"launchUrl": "hello/fernando", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this specific launch settings
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove this
This PR has been stalled and I'm closing it in favor of #136 |
No description provided.