Skip to content
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

Allow offline providers #436

Merged
merged 5 commits into from
May 9, 2024
Merged

Conversation

malcolmholmes
Copy link
Contributor

#362 added details of which providers were configured. It also prevented unconfigured
providers from being added to the list of available providers.

This has the unfortunate consequence of preventing "offline" commands from working,
e.g. grr show, grr list or grr export.

This PR resolves this by still allowing an unconfigured provider to be used for such
situations. Now, an unconfigured provider will just error out when it attempts to
connect to its backend.

Closes #424.

@malcolmholmes malcolmholmes requested a review from a team as a code owner May 8, 2024 13:49
@julienduchesne
Copy link
Member

I think this needs a few tests. It should be easy to write an integration test that checks that the offline commands work without any configured providers and it should prevent regressions (no one caught it in my PR, and no one probably will, without tests, a year from now)

@malcolmholmes
Copy link
Contributor Author

@julienduchesne integration test added!

Copy link
Member

@julienduchesne julienduchesne left a comment

Choose a reason for hiding this comment

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

Just one nit. LGTM!

cmd/grr/main.go Outdated
Comment on lines 84 to 88
providerInitFuncs := []func() grizzly.Provider{
func() grizzly.Provider { return grafana.NewProvider(&context.Grafana) },
func() grizzly.Provider { return mimir.NewProvider(&context.Mimir) },
func() grizzly.Provider { return syntheticmonitoring.NewProvider(&context.SyntheticMonitoring) },
}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
providerInitFuncs := []func() grizzly.Provider{
func() grizzly.Provider { return grafana.NewProvider(&context.Grafana) },
func() grizzly.Provider { return mimir.NewProvider(&context.Mimir) },
func() grizzly.Provider { return syntheticmonitoring.NewProvider(&context.SyntheticMonitoring) },
}
providers := []grizzly.Provider{
grafana.NewProvider(&context.Grafana),
mimir.NewProvider(&context.Mimir),
syntheticmonitoring.NewProvider(&context.SyntheticMonitoring),
}

Doesn't need to be a func if we're validating in a separate func

@malcolmholmes malcolmholmes merged commit 241cea4 into main May 9, 2024
7 checks passed
@malcolmholmes malcolmholmes deleted the malcolmholmes/allow-offline-providers branch May 9, 2024 19:32
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.

[Bug]: Mandatory provider for offline commands
2 participants