Skip to content

Conversation

stepansergeevitch
Copy link
Collaborator

Allow users to skip engine parameter. Get default engine url in this case.
Added unit and integration tests

@stepansergeevitch stepansergeevitch self-assigned this Mar 30, 2022
@stepansergeevitch stepansergeevitch changed the title Fir 12126 make engine parameter optional feat: Fir 12126 make engine parameter optional Mar 30, 2022
@ptiurin
Copy link
Contributor

ptiurin commented Mar 30, 2022

Lgtm, just wondering if we can use https://api.app.firebolt.io/core/v1/account/engines:getURLByDatabaseName ? Looks like it returns a default engine url, without the extra steps.

@stepansergeevitch
Copy link
Collaborator Author

Lgtm, just wondering if we can use https://api.app.firebolt.io/core/v1/account/engines:getURLByDatabaseName ? Looks like it returns a default engine url, without the extra steps.

Oh, that actually seems to be much better, didn't see that endpoint. Will use this one

Copy link
Contributor

@ptiurin ptiurin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

assert database is not None

if engine_name:
if not engine_name and not engine_url:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change the documentation on L153 to reflect the changes

HTTPStatusError,
KeyError,
) as e:
raise InterfaceError(f"Unable to retrieve default engine endpoint: {e}.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the real error is wrong credentials or expired/incorrect token?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, we could also catch AuthenticationError

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the other side, I think AuthenticationError is pretty representative itself, so I think we should just let it propagate further

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 3 Code Smells

88.5% 88.5% Coverage
0.0% 0.0% Duplication

@stepansergeevitch stepansergeevitch merged commit 6ef4f9a into main Mar 31, 2022
@stepansergeevitch stepansergeevitch deleted the FIR-12126-make-engine-parameter-optional branch March 31, 2022 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants