Add tests for version constraints in workspace terraform-versions

This commit is contained in:
Nick Fagerlund 2021-09-24 17:27:02 -07:00 committed by Chris Arcand
parent b43daeaa8d
commit 9857097b34
1 changed files with 9 additions and 0 deletions

View File

@ -605,6 +605,15 @@ func TestCloud_VerifyWorkspaceTerraformVersion(t *testing.T) {
{"1.2.0", "1.2.99", true, false},
{"1.2.0", "1.3.0", true, true},
{"0.15.0", "latest", true, false},
{"1.1.5", "~> 1.1.1", true, false},
{"1.1.5", "> 1.1.0, < 1.3.0", true, false},
{"1.1.5", "~> 1.0.1", true, true},
// pre-release versions are comparable within their pre-release stage (dev,
// alpha, beta), but not comparable to different stages and not comparable
// to final releases.
{"1.1.0-beta1", "~> 1.1.0-beta", true, false},
{"1.1.0", "~> 1.1.0-beta", true, true},
{"1.1.0-beta1", "~> 1.1.0-dev", true, true},
}
for _, tc := range testCases {
t.Run(fmt.Sprintf("local %s, remote %s", tc.local, tc.remote), func(t *testing.T) {