// These test cases are relying on behaviors of the fake provider
// registry server implemented in client_test.go.
{
"example.com/awesomesauce/happycloud",
[]string{"1.0.0","1.2.0"},
``,
},
{
"example.com/weaksauce/no-versions",
nil,
``,// having no versions is not an error, it's just odd
},
{
"example.com/nonexist/nonexist",
nil,
`provider registry example.com does not have a provider named example.com/nonexist/nonexist`,
},
{
"not.example.com/foo/bar",
nil,
`host not.example.com does not offer a Terraform provider registry`,
},
{
"too-new.example.com/foo/bar",
nil,
`host too-new.example.com does not support the provider registry protocol required by this Terraform version, but may be compatible with a different Terraform version`,
},
{
"fails.example.com/foo/bar",
nil,
`could not query provider registry for fails.example.com/foo/bar: Get http://placeholder-origin/fails-immediately/foo/bar/versions: EOF`,
},
}
// Sometimes error messages contain specific HTTP endpoint URLs, but
// since our test server is on a random port we'd not be able to
// consistently match those. Instead, we'll normalize the URLs.
urlPattern:=regexp.MustCompile(`http://[^/]+/`)
for_,test:=rangetests{
t.Run(test.provider,func(t*testing.T){
// TEMP: We don't yet have a function for parsing provider
// source addresses so we'll just fake it in here for now.
SHA256Sum:[32]uint8{30:0xf0,31:0x0d},// fake registry uses a memorable sum
},
``,
},
{
"example.com/awesomesauce/happycloud",
"1.2.0",
"nonexist","amd64",
PackageMeta{},
`provider example.com/awesomesauce/happycloud 1.2.0 is not available for nonexist_amd64`,
},
{
"not.example.com/awesomesauce/happycloud",
"1.2.0",
"linux","amd64",
PackageMeta{},
`host not.example.com does not offer a Terraform provider registry`,
},
{
"too-new.example.com/awesomesauce/happycloud",
"1.2.0",
"linux","amd64",
PackageMeta{},
`host too-new.example.com does not support the provider registry protocol required by this Terraform version, but may be compatible with a different Terraform version`,
},
{
"fails.example.com/awesomesauce/happycloud",
"1.2.0",
"linux","amd64",
PackageMeta{},
`could not query provider registry for fails.example.com/awesomesauce/happycloud: Get http://placeholder-origin/fails-immediately/awesomesauce/happycloud/1.2.0/download/linux/amd64: EOF`,
},
}
// Sometimes error messages contain specific HTTP endpoint URLs, but
// since our test server is on a random port we'd not be able to
// consistently match those. Instead, we'll normalize the URLs.
urlPattern:=regexp.MustCompile(`http://[^/]+/`)
cmpOpts:=cmp.Comparer(Version.Same)
for_,test:=rangetests{
t.Run(fmt.Sprintf("%s for %s_%s",test.provider,test.os,test.arch),func(t*testing.T){
// TEMP: We don't yet have a function for parsing provider
// source addresses so we'll just fake it in here for now.