Skip to content
This repository has been archived by the owner on Aug 12, 2022. It is now read-only.

Commit

Permalink
fix(testing): Don't add ignored diagnostics to errors validation (#283)
Browse files Browse the repository at this point in the history
🎉 Thank you for making CloudQuery awesome by submitting a PR 🎉

#### Summary

Related to cloudquery/cq-provider-gcp#267.
The tests on cloudquery/cq-provider-gcp#267 are failing since we validate ignored errors.
Relevant SDK code is https://github.com/cloudquery/cq-provider-sdk/blob/849cad30f6c3b335981822f19fdf275f6091df03/provider/execution/execution.go#L412

---

Use the following steps to ensure your PR is ready to be reviewed

- [x] Read the [contribution guidelines](../blob/main/.github/CONTRIBUTING.md) 🧑‍🎓
- [x] Run `go fmt` to format your code 🖊
- [x] Lint your changes via `golangci-lint run --new-from-rev main` 🚨 (install golangci-lint [here](https://golangci-lint.run/usage/install/#local-installation))
- [x] Update or add tests 🧪
- [x] Ensure the status checks below are successful ✅
  • Loading branch information
erezrokah authored May 25, 2022
1 parent ef2033d commit 370da1e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions provider/testing/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sync"
"testing"

"github.com/cloudquery/cq-provider-sdk/provider/diag"
"github.com/cloudquery/cq-provider-sdk/provider/execution"

sq "github.com/Masterminds/squirrel"
Expand Down Expand Up @@ -236,8 +237,10 @@ func (f *testResourceSender) Send(r *cqproto.FetchResourcesResponse) error {
fmt.Printf(r.Error)
f.Errors = append(f.Errors, r.Error)
}
for _, diag := range r.Summary.Diagnostics {
f.Errors = append(f.Errors, fmt.Sprintf("resource: %s. summary: %s, details %s", diag.Description().Resource, diag.Description().Summary, diag.Description().Detail))
for _, d := range r.Summary.Diagnostics {
if d.Severity() != diag.IGNORE {
f.Errors = append(f.Errors, fmt.Sprintf("resource: %s. summary: %s, details %s", d.Description().Resource, d.Description().Summary, d.Description().Detail))
}
}
return nil
}
Expand Down

0 comments on commit 370da1e

Please sign in to comment.