Add support for protocol 6 providers during init. (#29153)
Update the version constraints for what providers will be downloaded from the registry, allowing protocol 6 providers to be downloaded from the registry.
This commit is contained in:
parent
cb683b1dc1
commit
8bdea502ab
|
@ -55,7 +55,7 @@ func init() {
|
||||||
configureRequestTimeout()
|
configureRequestTimeout()
|
||||||
}
|
}
|
||||||
|
|
||||||
var SupportedPluginProtocols = MustParseVersionConstraints("~> 5")
|
var SupportedPluginProtocols = MustParseVersionConstraints(">= 5, <7")
|
||||||
|
|
||||||
// registryClient is a client for the provider registry protocol that is
|
// registryClient is a client for the provider registry protocol that is
|
||||||
// specialized only for the needs of this package. It's not intended as a
|
// specialized only for the needs of this package. It's not intended as a
|
||||||
|
|
|
@ -218,6 +218,10 @@ func fakeRegistryHandler(resp http.ResponseWriter, req *http.Request) {
|
||||||
resp.Header().Set("Content-Type", "application/json")
|
resp.Header().Set("Content-Type", "application/json")
|
||||||
resp.WriteHeader(200)
|
resp.WriteHeader(200)
|
||||||
resp.Write([]byte(`{"versions":[{"version":"1.0.0","protocols":["0.1"]}]}`))
|
resp.Write([]byte(`{"versions":[{"version":"1.0.0","protocols":["0.1"]}]}`))
|
||||||
|
case "weaksauce/protocol-six":
|
||||||
|
resp.Header().Set("Content-Type", "application/json")
|
||||||
|
resp.WriteHeader(200)
|
||||||
|
resp.Write([]byte(`{"versions":[{"version":"1.0.0","protocols":["6.0"]}]}`))
|
||||||
case "weaksauce/no-versions":
|
case "weaksauce/no-versions":
|
||||||
resp.Header().Set("Content-Type", "application/json")
|
resp.Header().Set("Content-Type", "application/json")
|
||||||
resp.WriteHeader(200)
|
resp.WriteHeader(200)
|
||||||
|
@ -412,6 +416,12 @@ func TestFindClosestProtocolCompatibleVersion(t *testing.T) {
|
||||||
versions.Unspecified,
|
versions.Unspecified,
|
||||||
``,
|
``,
|
||||||
},
|
},
|
||||||
|
"provider protocol six": {
|
||||||
|
addrs.MustParseProviderSourceString("example.com/weaksauce/protocol-six"),
|
||||||
|
MustParseVersion("1.0.0"),
|
||||||
|
MustParseVersion("1.0.0"),
|
||||||
|
``,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
for name, test := range tests {
|
for name, test := range tests {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Run(name, func(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue