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
test: Enables simulation of cloud-dev using hoverfly in alert configuration acceptance tests #2057
Conversation
internal/service/alertconfiguration/data_source_alert_configuration_test.go
Show resolved
Hide resolved
internal/service/alertconfiguration/resource_alert_configuration_test.go
Outdated
Show resolved
Hide resolved
settings.ProxyPort = fmt.Sprintf("%d", proxyPort) | ||
hv := hoverfly.NewHoverflyWithConfiguration(settings) | ||
|
||
if err := hv.StartProxy(); err != nil { |
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.
I think no changes needed for this PR. if we ran this in CI in many resources there will be more chances of picking an already-used port so we might want to implement a retry mechanism in the future to try in a different port until it finds one that is free
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.
great job!
just some small comments
knitpit PR title: Enables... |
var ( | ||
projectID = acc.ProjectIDExecution(t) | ||
projectID = replay.ManageProjectID(t, func() string { |
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.
you can do: projectID = replay.ManageProjectID(t, acc.ProjectIDExecution)
if you change ManageProjectID signature:
func ManageProjectID(t *testing.T, projectIDProvider func(testing.TB) string) string {
t.Helper()
if IsInCaptureMode() {
id := projectIDProvider(t)
...
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.
thanks! adjusted
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.
LGTM, just a couple of minor comments
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.
Nice! LGTM
CONTRIBUTING.md
Outdated
|
||
Some resources allow recording and replaying http requests using hoverfly when running tests. This is currently only configured for alert configuration resource acceptance tests. |
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.
I'd update this to say something like "for example, alert configuration..." so that we don't have to worry about updating this later when we add more.
* master: fix: Uses `overwriteBackupPolicies` in `mongodbatlas_backup_compliance_policy` to avoid overwriting non complying backup policies in updates (#2054) test: Enables simulation of cloud-dev using hoverfly in alert configuration acceptance tests (#2057) # Conflicts: # internal/service/backupcompliancepolicy/resource_backup_compliance_policy_test.go
Description
Link to any related issue(s): CLOUDP-237033
How to run replay mode
A new environment variable is defined for both capturing and then simulating interactions with external APIs when running alert configuration acceptance tests.
REPLAY_MODE=capture
As a result of this execution you will be able to see all captured information under
./simulations
folder.REPLAY_MODE=simulate
In this case the test execution will search for the specific files under
./simulations
folder depending on which test is being run, and will fail if no file is available.Implementation consideration
Type of change:
Required Checklist:
Further comments