Skip to content

Commit

Permalink
Remove artifact repository beta URL, fixup handwritten tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rileykarson committed Feb 23, 2023
1 parent dbb7da0 commit 28e753e
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 19 deletions.
3 changes: 0 additions & 3 deletions mmv1/products/artifactregistry/product.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ display_name: Artifact Registry
scopes:
- https://www.googleapis.com/auth/cloud-platform
versions:
- !ruby/object:Api::Product::Version
name: beta
base_url: https://artifactregistry.googleapis.com/v1beta2/
- !ruby/object:Api::Product::Version
name: ga
base_url: https://artifactregistry.googleapis.com/v1/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<% autogen_exception -%>
package google
<% unless version == 'ga' -%>

import (
"fmt"
Expand All @@ -16,7 +15,7 @@ func TestAccArtifactRegistryRepository_update(t *testing.T) {

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProvidersOiCS,
Providers: testAccProviders,
CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t),
Steps: []resource.TestStep{
{
Expand All @@ -39,18 +38,18 @@ func TestAccArtifactRegistryRepository_update(t *testing.T) {
})
}

func TestAccArtifactRegistryRepository_create_mvn_snapshot(t *testing.T) {
func TestAccArtifactRegistryRepository_createMvnSnapshot(t *testing.T) {
t.Parallel()

repositoryID := fmt.Sprintf("tf-test-%d", randInt(t))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProvidersOiCS,
Providers: testAccProviders,
CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccArtifactRegistryRepository_create(repositoryID, "SNAPSHOT"),
Config: testAccArtifactRegistryRepository_createMvnWithVersionPolicy(repositoryID, "SNAPSHOT"),
},
{
ResourceName: "google_artifact_registry_repository.test",
Expand All @@ -61,18 +60,40 @@ func TestAccArtifactRegistryRepository_create_mvn_snapshot(t *testing.T) {
})
}

func TestAccArtifactRegistryRepository_create_mvn_release(t *testing.T) {
func TestAccArtifactRegistryRepository_createMvnRelease(t *testing.T) {
t.Parallel()

repositoryID := fmt.Sprintf("tf-test-%d", randInt(t))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProvidersOiCS,
Providers: testAccProviders,
CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccArtifactRegistryRepository_create(repositoryID, "RELEASE"),
Config: testAccArtifactRegistryRepository_createMvnWithVersionPolicy(repositoryID, "RELEASE"),
},
{
ResourceName: "google_artifact_registry_repository.test",
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccArtifactRegistryRepository_kfp(t *testing.T) {
t.Parallel()

repositoryID := fmt.Sprintf("tf-test-%d", randInt(t))

vcrTest(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckArtifactRegistryRepositoryDestroyProducer(t),
Steps: []resource.TestStep{
{
Config: testAccArtifactRegistryRepository_kfp(repositoryID),
},
{
ResourceName: "google_artifact_registry_repository.test",
Expand All @@ -86,8 +107,6 @@ func TestAccArtifactRegistryRepository_create_mvn_release(t *testing.T) {
func testAccArtifactRegistryRepository_update(repositoryID string) string {
return fmt.Sprintf(`
resource "google_artifact_registry_repository" "test" {
provider = google-beta

repository_id = "%s"
location = "us-central1"
description = "pre-update"
Expand All @@ -104,8 +123,6 @@ resource "google_artifact_registry_repository" "test" {
func testAccArtifactRegistryRepository_update2(repositoryID string) string {
return fmt.Sprintf(`
resource "google_artifact_registry_repository" "test" {
provider = google-beta

repository_id = "%s"
location = "us-central1"
description = "post-update"
Expand All @@ -119,11 +136,9 @@ resource "google_artifact_registry_repository" "test" {
`, repositoryID)
}

func testAccArtifactRegistryRepository_create(repositoryID string, versionPolicy string) string {
func testAccArtifactRegistryRepository_createMvnWithVersionPolicy(repositoryID string, versionPolicy string) string {
return fmt.Sprintf(`
resource "google_artifact_registry_repository" "test" {
provider = google-beta

repository_id = "%s"
location = "us-central1"
description = "post-update"
Expand All @@ -134,4 +149,14 @@ resource "google_artifact_registry_repository" "test" {
}
`, repositoryID, versionPolicy)
}
<% end -%>

func testAccArtifactRegistryRepository_kfp(repositoryID string) string {
return fmt.Sprintf(`
resource "google_artifact_registry_repository" "test" {
repository_id = "%s"
location = "us-central1"
description = "my-kfp-repository""
format = "KFP"
}
`, repositoryID)
}

0 comments on commit 28e753e

Please sign in to comment.