Skip to content

Commit

Permalink
Bootstrap resource creation in RepositoryGroup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JumiDeluxe committed Nov 8, 2024
1 parent cebf8a6 commit 54e2a4f
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 30 deletions.
2 changes: 1 addition & 1 deletion mmv1/products/cloudaicompanion/CodeRepositoryIndex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ examples:
min_version: 'beta'
primary_resource_id: "example"
vars:
cri_id: "cri-1"
cri_id: "tf-bootstrap-cri-basic"
autogen_async: true
async:
operation:
Expand Down
8 changes: 7 additions & 1 deletion mmv1/products/cloudaicompanion/RepositoryGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,16 @@ examples:
primary_resource_id: "example"
primary_resource_name: '"cri-1", fmt.Sprintf("tf-test-my-repo-group%s", context["random_suffix"])'
vars:
repository_resource: "projects/example-location/locations/us-central1/connections/example-connection/gitRepositoryLinks/example-repo"
repository_group_id: "example-repository-group-id"
git_repository_link_id: 'example-git-repository-link-id'
cri_id: "cri-example"
repository_resource: "projects/example-project/locations/us-central1/connections/example-connection/gitRepositoryLinks/example-repo"
connection_id: "example-connection-id"
test_vars_overrides:
git_repository_link_id: 'acctest.BootstrapGitRepository(t, "basic", "us-central1", "https://github.com/CC-R-github-robot/tf-test.git", acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648))'
cri_id: 'acctest.BootstrapSharedCodeRepositoryIndex(t, "basic", "us-central1", "", "")'
repository_resource: '"projects/"+envvar.GetTestProjectFromEnv()+"/locations/us-central1/connections/"+acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648)+"/gitRepositoryLinks/"+acctest.BootstrapGitRepository(t, "basic", "us-central1", "https://github.com/CC-R-github-robot/tf-test.git", acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648))'
connection_id: 'acctest.BootstrapDeveloperConnection(t, "basic", "us-central1", "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1", 54180648)'
autogen_async: true
async:
operation:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,11 @@
resource "google_gemini_repository_group" "example" {
provider = google-beta
location = "us-central1"
coderepositoryindex = "cri-1"
repository_group_id = "test-repository-group-id1"
coderepositoryindex = "{{index $.Vars "cri_id"}}"
repository_group_id = "{{index $.Vars "repository_group_id"}}"
repositories {
resource = "projects/tf-test-project/locations/us-central1/connections/${google_developer_connect_connection.github_conn.connection_id}/gitRepositoryLinks/${google_developer_connect_git_repository_link.conn.git_repository_link_id}"
resource = "{{index $.Vars "repository_resource"}}"
branch_pattern = "main"
}
labels = {"label1": "value1"}
}

resource "google_developer_connect_git_repository_link" "conn" {
provider = google-beta
git_repository_link_id = "{{index $.Vars "git_repository_link_id"}}"
parent_connection = google_developer_connect_connection.github_conn.connection_id
clone_uri = "https://github.com/CC-R-github-robot/tf-test.git"
location = "us-central1"
annotations = {}
}

resource "google_developer_connect_connection" "github_conn" {
provider = google-beta
location = "us-central1"
connection_id = "{{index $.Vars "connection_id"}}"
disabled = false

github_config {
github_app = "DEVELOPER_CONNECT"
app_installation_id = 54180648

authorizer_credential {
oauth_token_secret_version = "projects/502367051001/secrets/tf-test-cloudaicompanion-github-oauthtoken-c42e5c/versions/1"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ import (
"strings"
"testing"
"time"
{{ if ne $.TargetVersionName `ga` -}}
// For beta tests only
"net/http"
{{- end }}

"github.com/hashicorp/terraform-provider-google/google/envvar"
tpgcompute "github.com/hashicorp/terraform-provider-google/google/services/compute"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package gemini_test
{{- if ne $.TargetVersionName "ga" }}

import (
"fmt"
Expand Down Expand Up @@ -220,3 +221,4 @@ resource "google_gemini_repository_group_iam_binding" "foo" {
}
`, context)
}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package gemini_test
{{- if ne $.TargetVersionName "ga" }}

import (
"os"
Expand Down Expand Up @@ -64,3 +65,4 @@ resource "google_gemini_code_repository_index" "example" {
}
`, context)
}
{{ end }}
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
package gemini_test
{{- if ne $.TargetVersionName "ga" }}

import (
"os"
Expand Down Expand Up @@ -124,3 +125,4 @@ resource "google_developer_connect_connection" "github_conn" {
}
`, context)
}
{{ end }}

0 comments on commit 54e2a4f

Please sign in to comment.