From ea4d9b1ed9f42f8889b08b59339d255ac44d4e12 Mon Sep 17 00:00:00 2001 From: Khue Doan Date: Sat, 22 Oct 2022 12:18:58 +0700 Subject: [PATCH] test(tools): add more version checks https://github.com/khuedoan/homelab/pull/88 --- test/go.mod | 3 +++ test/go.sum | 4 ++-- test/tools_test.go | 21 +++++++++++---------- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/test/go.mod b/test/go.mod index 1708da26..e31abaf0 100644 --- a/test/go.mod +++ b/test/go.mod @@ -87,3 +87,6 @@ require ( sigs.k8s.io/structured-merge-diff/v4 v4.0.3 // indirect sigs.k8s.io/yaml v1.2.0 // indirect ) + +// TODO https://github.com/gruntwork-io/terratest/pull/1182 +replace github.com/gruntwork-io/terratest v0.40.18 => github.com/khuedoan/terratest v0.0.0-20220921151310-016fe8e1536b diff --git a/test/go.sum b/test/go.sum index 5e3dea6c..deca07a8 100644 --- a/test/go.sum +++ b/test/go.sum @@ -214,8 +214,6 @@ github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3i github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7/go.mod h1:FecbI9+v66THATjSRHfNgh1IVFe/9kFxbXtjV0ctIMA= github.com/gruntwork-io/go-commons v0.8.0 h1:k/yypwrPqSeYHevLlEDmvmgQzcyTwrlZGRaxEM6G0ro= github.com/gruntwork-io/go-commons v0.8.0/go.mod h1:gtp0yTtIBExIZp7vyIV9I0XQkVwiQZze678hvDXof78= -github.com/gruntwork-io/terratest v0.40.18 h1:xuFaHOf/7kwc5cQN+6FfbmKglneBKesZxPHgISgkUlc= -github.com/gruntwork-io/terratest v0.40.18/go.mod h1:JGeIGgLbxbG9/Oqm06z6YXVr76CfomdmLkV564qov+8= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= @@ -255,6 +253,8 @@ github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1 h1:6QPYqodiu3GuPL+7mfx+NwDdp2eTkp9IfEUpgAwUN0o= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= +github.com/khuedoan/terratest v0.0.0-20220921151310-016fe8e1536b h1:lXY6P/dU40e2GjapTxZrzt6/IZxfsdifXzJyFwGJbFM= +github.com/khuedoan/terratest v0.0.0-20220921151310-016fe8e1536b/go.mod h1:JGeIGgLbxbG9/Oqm06z6YXVr76CfomdmLkV564qov+8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.11.2/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= diff --git a/test/tools_test.go b/test/tools_test.go index ab9e8ffc..ca34a55c 100644 --- a/test/tools_test.go +++ b/test/tools_test.go @@ -15,18 +15,18 @@ func TestToolsVersions(t *testing.T) { var tools = []struct { binaryPath string + versionArg string versionConstraint string }{ - {"ansible", ">= 2.12.6, < 3.0.0"}, - {"docker", ">= 20.10.17, < 21.0.0"}, - {"git", ">= 2.37.1, < 3.0.0"}, - // TODO add more version checks - // {"go", ">= 2.37.1, < 3.0.0"}, - // {"helm", ">= 2.37.1, < 3.0.0"}, - // {"kubectl", ">= 2.37.1, < 3.0.0"}, - // {"kustomize", ">= 2.37.1, < 3.0.0"}, - {"pre-commit", ">= 2.20.0, < 3.0.0"}, - {"terraform", ">= 1.3.1, < 1.4.0"}, + {"ansible", "--version", ">= 2.12.6, < 3.0.0"}, + {"docker", "--version", ">= 20.10.17, < 21.0.0"}, + {"git", "--version", ">= 2.37.1, < 3.0.0"}, + {"go", "version", ">= 1.18.5, < 1.19.0"}, + {"helm", "version", ">= 3.9.4, < 4.0.0"}, + // {"kubectl", "version", ">= 1.23.11, < 1.25.0"}, // https://kubernetes.io/releases/version-skew-policy/#kubectl + {"kustomize", "version", ">= 4.5.4, < 5.0.0"}, + {"pre-commit", "--version", ">= 2.20.0, < 3.0.0"}, + {"terraform", "--version", ">= 1.3.1, < 1.4.0"}, } for _, tool := range tools { @@ -36,6 +36,7 @@ func TestToolsVersions(t *testing.T) { params := version_checker.CheckVersionParams{ BinaryPath: tool.binaryPath, VersionConstraint: tool.versionConstraint, + VersionArg: tool.versionArg, WorkingDir: ".", }