Skip to content

Commit

Permalink
Add PreApply to RepositoryGroup and CodeRepositoryIndex update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JumiDeluxe committed Nov 13, 2024
1 parent 40bc461 commit 8dc3c36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mmv1/products/cloudaicompanion/RepositoryGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ examples:
- name: "gemini_repository_group_basic"
min_version: 'beta'
primary_resource_id: "example"
primary_resource_name: '"cri-1", fmt.Sprintf("tf-test-my-repo-group%s", context["random_suffix"])'
primary_resource_name: 'acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-example", "us-central1", "", ""), "test-rg-repository-group-id"'
vars:
repository_group_id: "example-repository-group-id"
git_repository_link_id: 'example-git-repository-link-id'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
resource "google_gemini_repository_group" "example" {
provider = google-beta
location = "us-central1"
coderepositoryindex = "{{index $.Vars "cri_id"}}"
coderepositoryindex = acctest.BootstrapSharedCodeRepositoryIndex(t, "basic-rg-example", "us-central1", "", ""),
repository_group_id = "{{index $.Vars "repository_group_id"}}"
repositories {
resource = "{{index $.Vars "repository_resource"}}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"testing"

"github.com/hashicorp/terraform-plugin-testing/helper/resource"
"github.com/hashicorp/terraform-plugin-testing/plancheck"

"github.com/hashicorp/terraform-provider-google/google/acctest"
)
Expand All @@ -31,6 +32,11 @@ func TestAccGeminiCodeRepositoryIndex_update(t *testing.T) {
},
{
Config: testAccGeminiCodeRepositoryIndex_update(context),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_gemini_code_repository_index.example", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_gemini_code_repository_index.example",
Expand All @@ -53,6 +59,7 @@ resource "google_gemini_code_repository_index" "example" {
}
`, context)
}

func testAccGeminiCodeRepositoryIndex_update(context map[string]interface{}) string {
return acctest.Nprintf(`
resource "google_gemini_code_repository_index" "example" {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func TestAccGeminiRepositoryGroup_update(t *testing.T) {
},
{
Config: testAccGeminiRepositoryGroup_update(context),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("google_gemini_repository_group.example", plancheck.ResourceActionUpdate),
},
},
},
{
ResourceName: "google_gemini_repository_group.example",
Expand Down

0 comments on commit 8dc3c36

Please sign in to comment.