-
Notifications
You must be signed in to change notification settings - Fork 499
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
feat: Test connection using dedicated endpoint #17993
Conversation
cli/go.mod
Outdated
|
||
replace github.com/cloudquery/plugin-sdk/v4 => github.com/disq/plugin-sdk/v4 v4.0.0-20240516151118-4958828f53c9 | ||
|
||
replace github.com/cloudquery/plugin-pb-go => github.com/cloudquery/plugin-pb-go v1.19.13-0.20240516105108-3fdf6ac15ea2 |
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.
To be removed before merge when plugin-sdk
and plugin-pb-go
are released.
Can you share the specs you used to test? How can the test connection fail for the test plugin ( |
# testsrc.yml
kind: source
spec:
name: test
version: v4.1.0
path: cloudquery/test
tables: ["*"]
destinations: ["pg"]
spec:
num_clients: 1
num_rows: 10
num_sub_rows: 20000
num_sub_cols: 200 # gandi.yml
kind: source
spec:
name: gandi
path: cloudquery/gandi
registry: cloudquery
version: "v3.2.1"
tables:
- "*"
destinations:
- pg
spec:
api_key: my-valid-key
endpoint_url: https://api.sandbox.gandi.net/
---
kind: destination
spec:
name: "pg"
path: "cloudquery/postgresql"
registry: "github"
version: "v7.0.1"
write_mode: "overwrite-delete-stale"
spec:
connection_string: "postgresql://postgres:pass@localhost:15432/cq" # singlepg.yml
kind: destination
spec:
name: "pg"
path: "cloudquery/postgresql"
registry: "github"
version: "v7.0.1"
write_mode: "overwrite-delete-stale"
spec:
connection_string: "postgresql://postgres:pass@localhost:15432/cq" $ ./cli test-connection ./singlepg.yml
Loading spec(s) from ./singlepg.yml
Test Connection Results
destination pg@github (cloudquery/postgresql@v7.0.1) Success
(exit code 0) $ |
@erezrokah The "failed to test source test" issue was fixed in 4477eb2 and the next cleanup commit. I just updated the PR description to reflect. It can still generate |
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.
A few more comments
} | ||
|
||
func (*testConnectionFailures) Error() string { | ||
// The errs are already shown in the console, so we don't need to show them again here |
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.
Are the errors shown when you do --log-console
too?
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.
Yes, now better, with proper plugin_ref
etc.
2024-05-17T14:33:56Z INF Loading spec(s) args=["./pgrpc.yml"] invocation-id=dafde1e3-5e32-4fad-8fb5-c7ad7a885284 module=cli
2024-05-17T14:33:56Z INF Testing destination destination="pg (grpc@localhost:7778)" invocation-id=dafde1e3-5e32-4fad-8fb5-c7ad7a885284 module=cli
2024-05-17T14:33:56Z INF Test connection completed invocation-id=dafde1e3-5e32-4fad-8fb5-c7ad7a885284 module=cli testresults=[{"failure_code":"OTHER","failure_description":"rpc error: code = Internal desc = failed to init plugin: failed to initialize client: failed to get current database: failed to connect to `host=localhost user=postgres database=cq`: dial error (dial tcp 127.0.0.1:15432: connect: connection refused)","plugin_kind":"destination","plugin_ref":"pg (grpc@localhost:7778)","success":false}]
Error: at least one test connection failed
2024-05-17T14:33:56Z ERR exiting with error error="at least one test connection failed" invocation-id=dafde1e3-5e32-4fad-8fb5-c7ad7a885284 module=cli
// | ||
// The function returns any failed test results, or nil if all tests passed. The hackernews plugin is excluded from the | ||
// failed test results since it was previously used as a test case for the test connection command. | ||
func filterFailedTestResults(results []testConnectionResult) (*testConnectionResult, error) { |
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.
Wait what's the reason we need to filter these plugins? I don't think their connection test can ever fail
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.
Those should be there until we update the cloud side to use the new cli.
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.
Ah because with existing Cloud the new CLI will report failures for them?
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 don't think it matters much this feature is only enabled for the cloudquery
team
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.
If we want the cloud api side to work, this filtering needs to be there at least for now.
🤖 I have created a release *beep* *boop* --- ## [5.20.0](cli-v5.19.0...cli-v5.20.0) (2024-05-20) ### Features * Test connection using dedicated endpoint ([#17993](#17993)) ([0baae95](0baae95)) ### Bug Fixes * **deps:** Update module github.com/cloudquery/cloudquery-api-go to v1.11.2 ([#17995](#17995)) ([9bc2353](9bc2353)) * **deps:** Update module github.com/cloudquery/plugin-pb-go to v1.19.13 ([#18001](#18001)) ([042f3b8](042f3b8)) * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.42.2 ([#18000](#18000)) ([5fc0f46](5fc0f46)) * **deps:** Update module github.com/cloudquery/plugin-sdk/v4 to v4.43.0 ([#18014](#18014)) ([20592c8](20592c8)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Opening for comments.
A run with 2 plugin test connections (one success and one fail) and one plugin failure (not related to TestConnection)
(The postgresql plugin is an older public release with TestConnection not implemented, falling back on Init)
With postgres implementing the test connector and a configuration with
host=badhost