-
Notifications
You must be signed in to change notification settings - Fork 71
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
allow to skip cert validation for internal test situations #565
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,6 +195,9 @@ pub struct GooseConfiguration { | |
/// Follows base_url redirect with subsequent requests | ||
#[options(no_short)] | ||
pub sticky_follow: bool, | ||
/// Allows to test internally when https validation is not required | ||
#[options(no_short)] | ||
pub accept_invalid_certs: bool, | ||
} | ||
|
||
/// Optionally defines a subset of active Scenarios to run during a load test. | ||
|
@@ -332,6 +335,8 @@ pub(crate) struct GooseDefaults { | |
pub websocket_host: Option<String>, | ||
/// An optional default for port WebSocket Controller listens on. | ||
pub websocket_port: Option<u16>, | ||
/// Allow for internal testing when no certificates are available but still using https | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use the same format as the above: |
||
pub accept_invalid_certs: Option<bool>, | ||
} | ||
|
||
/// Defines all [`GooseConfiguration`] options that can be programmatically configured with | ||
|
@@ -432,6 +437,7 @@ pub enum GooseDefault { | |
WebSocketHost, | ||
/// An optional default for port WebSocket Controller listens on. | ||
WebSocketPort, | ||
AcceptInvalidCerts, | ||
jeremyandrews marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
/// Most run-time options can be programmatically configured with custom defaults. | ||
|
@@ -610,7 +616,8 @@ impl GooseDefaultType<&str> for GooseAttack { | |
| GooseDefault::NoGzip | ||
| GooseDefault::NoStatusCodes | ||
| GooseDefault::StickyFollow | ||
| GooseDefault::NoGranularData => { | ||
| GooseDefault::NoGranularData | ||
| GooseDefault::AcceptInvalidCerts => { | ||
return Err(GooseError::InvalidOption { | ||
option: format!("GooseDefault::{:?}", key), | ||
value: value.to_string(), | ||
|
@@ -701,7 +708,8 @@ impl GooseDefaultType<usize> for GooseAttack { | |
| GooseDefault::NoGzip | ||
| GooseDefault::NoStatusCodes | ||
| GooseDefault::StickyFollow | ||
| GooseDefault::NoGranularData => { | ||
| GooseDefault::NoGranularData | ||
| GooseDefault::AcceptInvalidCerts => { | ||
return Err(GooseError::InvalidOption { | ||
option: format!("GooseDefault::{:?}", key), | ||
value: format!("{}", value), | ||
|
@@ -757,6 +765,7 @@ impl GooseDefaultType<bool> for GooseAttack { | |
GooseDefault::NoWebSocket => self.defaults.no_websocket = Some(value), | ||
GooseDefault::NoAutoStart => self.defaults.no_autostart = Some(value), | ||
GooseDefault::NoGzip => self.defaults.no_gzip = Some(value), | ||
GooseDefault::AcceptInvalidCerts => self.defaults.accept_invalid_certs = Some(value), | ||
GooseDefault::NoStatusCodes => self.defaults.no_status_codes = Some(value), | ||
GooseDefault::StickyFollow => self.defaults.sticky_follow = Some(value), | ||
GooseDefault::NoGranularData => self.defaults.no_granular_report = Some(value), | ||
|
@@ -856,7 +865,8 @@ impl GooseDefaultType<GooseCoordinatedOmissionMitigation> for GooseAttack { | |
| GooseDefault::NoGzip | ||
| GooseDefault::NoStatusCodes | ||
| GooseDefault::StickyFollow | ||
| GooseDefault::NoGranularData => { | ||
| GooseDefault::NoGranularData | ||
| GooseDefault::AcceptInvalidCerts => { | ||
return Err(GooseError::InvalidOption { | ||
option: format!("GooseDefault::{:?}", key), | ||
value: format!("{:?}", value), | ||
|
@@ -956,7 +966,8 @@ impl GooseDefaultType<GooseLogFormat> for GooseAttack { | |
| GooseDefault::NoGzip | ||
| GooseDefault::NoStatusCodes | ||
| GooseDefault::StickyFollow | ||
| GooseDefault::NoGranularData => { | ||
| GooseDefault::NoGranularData | ||
| GooseDefault::AcceptInvalidCerts => { | ||
return Err(GooseError::InvalidOption { | ||
option: format!("GooseDefault::{:?}", key), | ||
value: format!("{:?}", value), | ||
|
@@ -1731,6 +1742,24 @@ impl GooseConfiguration { | |
]) | ||
.unwrap_or(false); | ||
|
||
// Configure `accept_invalid_certs` | ||
self.accept_invalid_certs = self | ||
.get_value(vec![ | ||
// Use --accept-invalid-certs if set. | ||
GooseValue { | ||
value: Some(self.accept_invalid_certs), | ||
filter: !self.accept_invalid_certs, | ||
message: "accept_invalid_certs", | ||
}, | ||
// Use GooseDefault if not already set and not Worker. | ||
GooseValue { | ||
value: defaults.accept_invalid_certs, | ||
filter: defaults.accept_invalid_certs.is_none(), | ||
message: "accept_invalid_certs", | ||
}, | ||
]) | ||
.unwrap_or(false); | ||
|
||
self.co_mitigation = self.get_value(vec![ | ||
// Use --co-mitigation if set. | ||
GooseValue { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2318,6 +2318,7 @@ pub(crate) fn create_reqwest_client( | |
.timeout(Duration::from_millis(timeout)) | ||
// Enable gzip unless `--no-gzip` flag is enabled. | ||
.gzip(!configuration.no_gzip) | ||
.danger_accept_invalid_certs(configuration.accept_invalid_certs) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please include a comment, for example:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Whoops, sorry, I think that's actually There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
.build() | ||
} | ||
|
||
|
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.
How about documenting this as:
Disables validation of https certificates
We can better document in the goose book (and it can happen in a followup PR).