Skip to content

Commit

Permalink
Merge pull request #926 from jfrog/GH-925-fix-virtual-helmoci-repo-type
Browse files Browse the repository at this point in the history
Fix incorrect package type of 'helmoci' repo
  • Loading branch information
alexhung authored Apr 8, 2024
2 parents e3f8397 + 03ad061 commit 132e47b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 10.4.4 (Apr 8, 2024)

BUG FIXES:

* resource/artifactory_virtual_helmoci_repository: Fix incorrect package type. Issue: [#925](https://github.com/jfrog/terraform-provider-artifactory/issues/925) PR: [#926](https://github.com/jfrog/terraform-provider-artifactory/pull/926)

## 10.4.3 (Apr 1, 2024)

BUG FIXES:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func ResourceArtifactoryVirtualHelmOciRepository() *schema.Resource {
unpackVirtualRepository := func(data *schema.ResourceData) (interface{}, string, error) {
d := &utilsdk.ResourceData{ResourceData: data}
repo := HelmOciVirtualRepositoryParams{
RepositoryBaseParams: UnpackBaseVirtRepo(data, DockerPackageType),
RepositoryBaseParams: UnpackBaseVirtRepo(data, HelmOciPackageType),
ResolveOCITagsByTimestamp: d.GetBool("resolve_oci_tags_by_timestamp", false),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -767,8 +767,8 @@ func TestAccAllVirtualGradleLikeRepository(t *testing.T) {
}

// if you wish to override any of the default fields, just pass it as "extraFields" as these will overwrite
func mkNewVirtualTestCase(repoType string, t *testing.T, extraFields map[string]interface{}) (*testing.T, resource.TestCase) {
_, fqrn, name := testutil.MkNames("terraform-virtual-test-repo-full-", fmt.Sprintf("artifactory_virtual_%s_repository", repoType))
func mkNewVirtualTestCase(packageType string, t *testing.T, extraFields map[string]interface{}) (*testing.T, resource.TestCase) {
_, fqrn, name := testutil.MkNames("terraform-virtual-test-repo-full-", fmt.Sprintf("artifactory_virtual_%s_repository", packageType))
remoteRepoName := fmt.Sprintf("%s-remote", name)
defaultFields := map[string]interface{}{
"key": name,
Expand All @@ -791,17 +791,19 @@ func mkNewVirtualTestCase(repoType string, t *testing.T, extraFields map[string]
`
extraChecks := testutil.MapToTestChecks(fqrn, extraFields)
defaultChecks := testutil.MapToTestChecks(fqrn, allFields)
defaultChecks = append(defaultChecks, resource.TestCheckResourceAttr(fqrn, "package_type", packageType))

checks := append(defaultChecks, extraChecks...)
config := fmt.Sprintf(virtualRepoFull, repoType, name, remoteRepoName, allFieldsHcl)
config := fmt.Sprintf(virtualRepoFull, packageType, name, remoteRepoName, allFieldsHcl)

updatedFields := utilsdk.MergeMaps(defaultFields, extraFields, map[string]any{
"description": "",
"notes": "",
})
updatedFieldsHcl := utilsdk.FmtMapToHcl(updatedFields)
updatedConfig := fmt.Sprintf(virtualRepoFull, repoType, name, remoteRepoName, updatedFieldsHcl)
updatedConfig := fmt.Sprintf(virtualRepoFull, packageType, name, remoteRepoName, updatedFieldsHcl)
updatedChecks := testutil.MapToTestChecks(fqrn, updatedFields)
updatedChecks = append(updatedChecks, resource.TestCheckResourceAttr(fqrn, "package_type", packageType))

return t, resource.TestCase{
PreCheck: func() { acctest.PreCheck(t) },
Expand Down

0 comments on commit 132e47b

Please sign in to comment.