-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9376ec2
commit 9b6320e
Showing
2 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
...d_party/terraform/services/cloudaicompanion/resource_gemini_code_repository_index_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package gemini_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
|
||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
) | ||
|
||
func TestAccGeminiCodeRepositoryIndex_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"project_id": os.Getenv("GOOGLE_PROJECT"), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccGeminiCodeRepositoryIndex_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_gemini_code_repository_index.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"code_repository_index_id", "labels", "location", "terraform_labels"}, | ||
}, | ||
{ | ||
Config: testAccGeminiCodeRepositoryIndex_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_gemini_code_repository_index.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"code_repository_index_id", "labels", "location", "terraform_labels"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccGeminiCodeRepositoryIndex_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gemini_code_repository_index" "example" { | ||
kms_key = "projects/%{project_id}/locations/us-central1/keyRings/keyRingExample/cryptoKeys/cryptoKeyExample" | ||
labels = {"label1": "value1"} | ||
location = "us-central1" | ||
code_repository_index_id = "test-cri-index-example" | ||
} | ||
`, context) | ||
} | ||
func testAccGeminiCodeRepositoryIndex_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gemini_code_repository_index" "example" { | ||
kms_key = "projects/%{project_id}/locations/us-central1/keyRings/keyRingExample/cryptoKeys/cryptoKeyUpdateExample" | ||
location = "us-central1" | ||
labels = {"label1": "value1", "label2": "value2"} | ||
code_repository_index_id = "test-update-cri-index-example" | ||
} | ||
`, context) | ||
} |
86 changes: 86 additions & 0 deletions
86
.../third_party/terraform/services/cloudaicompanion/resource_gemini_repository_group_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package gemini_test | ||
|
||
import ( | ||
"os" | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
|
||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
) | ||
|
||
func TestAccGeminiRepositoryGroup_update(t *testing.T) { | ||
t.Parallel() | ||
|
||
context := map[string]interface{}{ | ||
"project_id": os.Getenv("GOOGLE_PROJECT"), | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
Config: testAccGeminiRepositoryGroup_basic(context), | ||
}, | ||
{ | ||
ResourceName: "google_gemini_repository_group.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"coderepositoryindex", "labels", "location", "repository_group_id", "terraform_labels"}, | ||
}, | ||
{ | ||
Config: testAccGeminiRepositoryGroup_update(context), | ||
}, | ||
{ | ||
ResourceName: "google_gemini_repository_group.example", | ||
ImportState: true, | ||
ImportStateVerify: true, | ||
ImportStateVerifyIgnore: []string{"coderepositoryindex", "labels", "location", "repository_group_id", "terraform_labels"}, | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccGeminiRepositoryGroup_basic(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gemini_repository_group" "example" { | ||
location = "us-central1" | ||
coderepositoryindex = google_gemini_code_repository_index.example_cri.code_repository_index_id | ||
repository_group_id = "test-repository-group-id" | ||
repositories { | ||
resource = "projects/%{project_id}/locations/us-central1/repositories/test-repository-1" | ||
branch_pattern = "main" | ||
} | ||
labels = {"label1": "value1"} | ||
} | ||
resource "google_gemini_code_repository_index" "example_cri" { | ||
kms_key = "projects/%{project_id}/locations/locationExample/keyRings/keyRingExample/cryptoKeys/cryptoKeyExample" | ||
labels = {"label1": "value1"} | ||
location = "us-central1" | ||
code_repository_index_id = "test-cri-index-example" | ||
} | ||
`, context) | ||
} | ||
func testAccGeminiRepositoryGroup_update(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_gemini_repository_group" "example" { | ||
location = "us-central1" | ||
coderepositoryindex = google_gemini_code_repository_index.example_cri.code_repository_index_id | ||
repository_group_id = "test-repository-group-update-id" | ||
repositories { | ||
resource = "projects/%{project_id}/locations/us-central1/repositories/test-repository-update-1" | ||
branch_pattern = "main" | ||
} | ||
labels = {"label1": "value1", "label2": "value2"} | ||
} | ||
resource "google_gemini_code_repository_index" "example_cri" { | ||
kms_key = "projects/%{project_id}/locations/locationExample/keyRings/keyRingExample/cryptoKeys/cryptoKeyUpdateExample" | ||
location = "us-central1" | ||
labels = {"label1": "value1", "label2": "value2"} | ||
code_repository_index_id = "test-update-cri-index-example" | ||
} | ||
`, context) | ||
} |