plugin_test: error on missing checksum file

The mockPluginGetter would always succeed in returning a file from the
list of suggested releases, which does not let us test what happens when
a release is not yet complete, and a checksum file fails to be fetched
from the source.

This commit changes this behaviour so that we get an error when a
checksum does not exist, mirrorring what happens in real conditions.
pull/12108/head
Lucas Bajolet 3 years ago committed by Wilken Rivera
parent 113bc5eea4
commit 0224d6e0de

@ -676,7 +676,11 @@ func (g *mockPluginGetter) Get(what string, options GetOptions) (io.ReadCloser,
case "releases":
toEncode = g.Releases
case "sha256":
toEncode = g.ChecksumFileEntries[options.version.String()]
enc, ok := g.ChecksumFileEntries[options.version.String()]
if !ok {
return nil, fmt.Errorf("No checksum available for version %q", options.version.String())
}
toEncode = enc
case "zip":
acc := options.PluginRequirement.Identifier.Hostname + "/" +
options.PluginRequirement.Identifier.RealRelativePath() + "/" +

Loading…
Cancel
Save