Merge pull request #19704 from hashicorp/svh/f-versions

backend/remote: compare versions without the prerelease
This commit is contained in:
Sander van Harmelen 2018-12-19 20:09:47 +01:00 committed by GitHub
commit 687ba2907d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -370,7 +370,7 @@ func (b *Remote) checkConstraints(c *disco.Constraints) tfdiags.Diagnostics {
} }
// Create the version to check. // Create the version to check.
v, err := version.NewVersion(tfversion.String()) v, err := version.NewVersion(tfversion.Version)
if err != nil { if err != nil {
return diags.Append(checkConstraintsWarning(err)) return diags.Append(checkConstraintsWarning(err))
} }
@ -433,7 +433,7 @@ func (b *Remote) checkConstraints(c *disco.Constraints) tfdiags.Diagnostics {
summary := fmt.Sprintf("Incompatible Terraform version v%s", v.String()) summary := fmt.Sprintf("Incompatible Terraform version v%s", v.String())
details := fmt.Sprintf( details := fmt.Sprintf(
"The configured Terraform Enterprise backend is compatible with Terraform "+ "The configured Terraform Enterprise backend is compatible with Terraform "+
"versions >= %s, < %s%s.", c.Minimum, c.Maximum, excluding, "versions >= %s, <= %s%s.", c.Minimum, c.Maximum, excluding,
) )
if action != "" && toVersion != "" { if action != "" && toVersion != "" {

View File

@ -379,7 +379,7 @@ func TestRemote_checkConstraints(t *testing.T) {
Maximum: "0.11.11", Maximum: "0.11.11",
}, },
version: "0.10.1", version: "0.10.1",
result: "versions >= 0.11.0, < 0.11.11.", result: "versions >= 0.11.0, <= 0.11.11.",
}, },
"list exclusion": { "list exclusion": {
constraints: &disco.Constraints{ constraints: &disco.Constraints{