From 8017f512b33ec04e7dac41835aabc80ddce82d0f Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Wed, 29 May 2024 11:48:02 -0700 Subject: [PATCH 1/3] Fix tests --- pkg/xray/resource/resource_xray_security_policy_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/xray/resource/resource_xray_security_policy_test.go b/pkg/xray/resource/resource_xray_security_policy_test.go index 3ae51ba9..fe846d82 100644 --- a/pkg/xray/resource/resource_xray_security_policy_test.go +++ b/pkg/xray/resource/resource_xray_security_policy_test.go @@ -779,7 +779,7 @@ func TestAccSecurityPolicy_Packages(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, - CheckDestroy: acctest.VerifyDeleted(fqrn, acctest.CheckPolicy), + CheckDestroy: acctest.VerifyDeleted(fqrn, "", acctest.CheckPolicy), ProtoV6ProviderFactories: acctest.ProtoV6MuxProviderFactories, Steps: []resource.TestStep{ { @@ -813,7 +813,7 @@ func TestAccSecurityPolicy_PackagesIncorrectVersionRangeFails(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, - CheckDestroy: acctest.VerifyDeleted(fqrn, acctest.CheckPolicy), + CheckDestroy: acctest.VerifyDeleted(fqrn, "", acctest.CheckPolicy), ProtoV6ProviderFactories: acctest.ProtoV6MuxProviderFactories, Steps: []resource.TestStep{ { @@ -841,7 +841,7 @@ func TestAccSecurityPolicy_createPackagesFail(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acctest.PreCheck(t) }, - CheckDestroy: acctest.VerifyDeleted(fqrn, acctest.CheckPolicy), + CheckDestroy: acctest.VerifyDeleted(fqrn, "", acctest.CheckPolicy), ProtoV6ProviderFactories: acctest.ProtoV6MuxProviderFactories, Steps: []resource.TestStep{ { From 0786697a56815d298c7f32ac999cbda079a295b2 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Wed, 29 May 2024 12:22:31 -0700 Subject: [PATCH 2/3] Upgrade testing module Fix tests for the same Clean up unused test func args --- go.mod | 4 ++-- go.sum | 8 ++++---- .../resource_xray_binary_manager_builds_test.go | 10 +++++----- .../resource_xray_binary_manager_repos_test.go | 4 ++-- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 7cc2b46c..4edb1540 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/hashicorp/terraform-plugin-log v0.9.0 github.com/hashicorp/terraform-plugin-mux v0.16.0 github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 - github.com/hashicorp/terraform-plugin-testing v1.5.1 + github.com/hashicorp/terraform-plugin-testing v1.8.0 github.com/jfrog/terraform-provider-shared v1.25.3 github.com/samber/lo v1.39.0 golang.org/x/exp v0.0.0-20230809150735-7b3493d9a819 @@ -43,7 +43,7 @@ require ( github.com/hashicorp/go-checkpoint v0.5.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 // indirect - github.com/hashicorp/go-hclog v1.6.2 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect github.com/hashicorp/go-plugin v1.6.0 // indirect github.com/hashicorp/go-uuid v1.0.3 // indirect diff --git a/go.sum b/go.sum index 1685e434..d90e63cc 100644 --- a/go.sum +++ b/go.sum @@ -79,8 +79,8 @@ github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9n github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320 h1:1/D3zfFHttUKaCaGKZ/dR2roBXv0vKbSCnssIldfQdI= github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320/go.mod h1:EiZBMaudVLy8fmjf9Npq1dq9RalhveqZG5w/yz3mHWs= -github.com/hashicorp/go-hclog v1.6.2 h1:NOtoftovWkDheyUM/8JW3QMiXyxJK3uHRK7wV04nD2I= -github.com/hashicorp/go-hclog v1.6.2/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= @@ -115,8 +115,8 @@ github.com/hashicorp/terraform-plugin-mux v0.16.0 h1:RCzXHGDYwUwwqfYYWJKBFaS3fQs github.com/hashicorp/terraform-plugin-mux v0.16.0/go.mod h1:PF79mAsPc8CpusXPfEVa4X8PtkB+ngWoiUClMrNZlYo= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0 h1:kJiWGx2kiQVo97Y5IOGR4EMcZ8DtMswHhUuFibsCQQE= github.com/hashicorp/terraform-plugin-sdk/v2 v2.34.0/go.mod h1:sl/UoabMc37HA6ICVMmGO+/0wofkVIRxf+BMb/dnoIg= -github.com/hashicorp/terraform-plugin-testing v1.5.1 h1:T4aQh9JAhmWo4+t1A7x+rnxAJHCDIYW9kXyo4sVO92c= -github.com/hashicorp/terraform-plugin-testing v1.5.1/go.mod h1:dg8clO6K59rZ8w9EshBmDp1CxTIPu3yA4iaDpX1h5u0= +github.com/hashicorp/terraform-plugin-testing v1.8.0 h1:wdYIgwDk4iO933gC4S8KbKdnMQShu6BXuZQPScmHvpk= +github.com/hashicorp/terraform-plugin-testing v1.8.0/go.mod h1:o2kOgf18ADUaZGhtOl0YCkfIxg01MAiMATT2EtIHlZk= github.com/hashicorp/terraform-registry-address v0.2.3 h1:2TAiKJ1A3MAkZlH1YI/aTVcLZRu7JseiXNRHbOAyoTI= github.com/hashicorp/terraform-registry-address v0.2.3/go.mod h1:lFHA76T8jfQteVfT7caREqguFrW3c4MFSPhZB7HHgUM= github.com/hashicorp/terraform-svchost v0.1.1 h1:EZZimZ1GxdqFRinZ1tpJwVxxt49xc/S52uzrw4x0jKQ= diff --git a/pkg/xray/resource/resource_xray_binary_manager_builds_test.go b/pkg/xray/resource/resource_xray_binary_manager_builds_test.go index 0083a819..c7d01e12 100644 --- a/pkg/xray/resource/resource_xray_binary_manager_builds_test.go +++ b/pkg/xray/resource/resource_xray_binary_manager_builds_test.go @@ -51,7 +51,7 @@ func uploadBuild(t *testing.T, name, number, projectKey string) error { return nil } -func deleteBuild(t *testing.T, name, number, projectKey string) error { +func deleteBuild(t *testing.T, name, projectKey string) error { type Build struct { Name string `json:"buildName"` BuildRepo string `json:"buildRepo"` @@ -137,11 +137,11 @@ func TestAccBinaryManagerBuilds_full(t *testing.T) { }, }, CheckDestroy: func(*terraform.State) error { - if err := deleteBuild(t, build1Name, "1", ""); err != nil { + if err := deleteBuild(t, build1Name, ""); err != nil { return err } - if err := deleteBuild(t, build2Name, "1", ""); err != nil { + if err := deleteBuild(t, build2Name, ""); err != nil { return nil } @@ -238,11 +238,11 @@ func TestAccBinaryManagerBuilds_project_full(t *testing.T) { }, }, CheckDestroy: func(*terraform.State) error { - if err := deleteBuild(t, build1Name, "1", projectKey); err != nil { + if err := deleteBuild(t, build1Name, projectKey); err != nil { return err } - if err := deleteBuild(t, build2Name, "1", projectKey); err != nil { + if err := deleteBuild(t, build2Name, projectKey); err != nil { return nil } diff --git a/pkg/xray/resource/resource_xray_binary_manager_repos_test.go b/pkg/xray/resource/resource_xray_binary_manager_repos_test.go index db6f1b51..34e7fc69 100644 --- a/pkg/xray/resource/resource_xray_binary_manager_repos_test.go +++ b/pkg/xray/resource/resource_xray_binary_manager_repos_test.go @@ -122,7 +122,7 @@ func TestAccBinaryManagerRepos_full(t *testing.T) { "package_type": "Docker", }), ), - ConfigPlanChecks: testutil.ConfigPlanChecks(""), + ConfigPlanChecks: testutil.ConfigPlanChecks("xray_binary_manager_repos"), }, { ResourceName: fqrn, @@ -321,7 +321,7 @@ func TestAccBinaryManagerRepos_project_full(t *testing.T) { "package_type": "Docker", }), ), - ConfigPlanChecks: testutil.ConfigPlanChecks(""), + ConfigPlanChecks: testutil.ConfigPlanChecks("xray_binary_manager_repos"), }, { ResourceName: fqrn, From 5128c5a760add8245506f3dd450a23f5345c8c34 Mon Sep 17 00:00:00 2001 From: Alex Hung Date: Wed, 29 May 2024 12:24:07 -0700 Subject: [PATCH 3/3] Update CHANGELOG --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 931b933e..ea462b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 2.8.0 (May 30, 2024) + +IMPROVEMENTS: + +* resource/xray_security_policy: Add `package_name`, `package_type`, and `package_versions` attributes to support package security policy. PR: [#189](https://github.com/jfrog/terraform-provider-xray/pull/189) + ## 2.7.1 (May 29, 2024). Tested on Artifactory 7.84.12 and Xray 3.96.1 IMPROVEMENTS: