-
Notifications
You must be signed in to change notification settings - Fork 13
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
Chore: improve integration tests output and reduce noise #693
Conversation
@@ -91,7 +94,7 @@ if err != nil { | |||
|
|||
func ResourceGetFailure(resourceName string, d *schema.ResourceData, err error) diag.Diagnostics { | |||
if frerr, ok := err.(*http.FailedResponseError); ok && frerr.NotFound() { | |||
log.Printf("[WARN] Drift Detected: Terraform will remove %s from state", d.Id()) | |||
tflog.Warn(ctx, "Drift Detected: Terraform will remove id from state", map[string]interface{}{"id": d.Id()}) |
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.
this is the only change...
the rest vscode plugin formatting the readme file.
_, err := uuid.Parse(id) | ||
if err == nil { | ||
log.Println("[INFO] Resolving credentials by id: ", id) | ||
tflog.Info(ctx, "Resolving credentials by id", map[string]interface{}{"id": id}) |
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.
Everything is now using tflog.
fmt.Printf has been deprecated.
SetRetryCount(5). | ||
SetRetryWaitTime(time.Second). | ||
SetRetryMaxWaitTime(time.Second * 5). | ||
OnBeforeRequest(func(c *resty.Client, r *resty.Request) error { | ||
tflog.SubsystemInfo(subCtx, "env0_api_client", "Sending request", map[string]interface{}{"method": r.Method, "url": r.URL}) |
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.
some more logs.
@@ -155,26 +155,37 @@ func configureProvider(version string, p *schema.Provider) schema.ConfigureConte | |||
isIntegrationTest = true | |||
} | |||
|
|||
restyClient. | |||
subCtx := tflog.NewSubsystem(ctx, "env0_api_client") |
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.
using a subcontext you can filter api_client logs by grep-ing "env0_api_client"
tflog.SubsystemInfo(subCtx, "env0_api_client", "Received respose", map[string]interface{}{"method": r.Request.Method, "url": r.Request.URL, "status": r.Status()}) | ||
return nil | ||
}). | ||
AddRetryAfterErrorCondition(). |
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.
This may have been needed to retry 4xx and 5xx.
Not sure... but worth checking it out if it helps (documentation isn't very clear).
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.
looking in the code... it's just:
c.AddRetryCondition(func(response *Response, err error) bool {
return response.IsError()
})
return c
}
but we'll try...
Issue & Steps to Reproduce / Feature Request
Solution