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

MGMT-15015 Provider IsHostSupported panic if platform is not found #5306

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/provider/registry/registry.go
Expand Up @@ -103,7 +103,7 @@ func (r *registry) IsHostSupported(p models.PlatformType, host *models.Host) (bo
currentProvider, err := r.Get(string(p))
if err != nil {
return false, fmt.Errorf("error while checking if hosts are supported by platform %s, error %w",
currentProvider.Name(), err)
string(p), err)
}
return currentProvider.IsHostSupported(host)
}
Expand Down
9 changes: 9 additions & 0 deletions internal/provider/registry/registry_test.go
Expand Up @@ -142,6 +142,15 @@ var _ = Describe("Test GetSupportedProvidersByHosts", func() {
})
})

var _ = Describe("IsHostSupported", func() {
It("platform not found", func() {
providerRegistry = InitProviderRegistry(common.GetTestLog())
found, err := providerRegistry.IsHostSupported("none-existing-platform-type", &models.Host{})
Expect(err).NotTo(Succeed())
Expect(found).To(BeFalse())
})
})

var _ = Describe("Test AddPlatformToInstallConfig", func() {
BeforeEach(func() {
providerRegistry = InitProviderRegistry(common.GetTestLog())
Expand Down