Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move billing tests that require permissions beyond Billing User to master billing account #7263

Merged
merged 1 commit into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions mmv1/products/billingbudget/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,36 +33,36 @@ overrides: !ruby/object:Overrides::ResourceOverrides
vars:
display_name: 'Example Billing Budget'
test_env_vars:
billing_acct: :BILLING_ACCT
billing_acct: :MASTER_BILLING_ACCT
- !ruby/object:Provider::Terraform::Examples
name: 'billing_budget_lastperiod'
primary_resource_id: 'budget'
vars:
display_name: 'Example Billing Budget'
test_env_vars:
billing_acct: :BILLING_ACCT
billing_acct: :MASTER_BILLING_ACCT
- !ruby/object:Provider::Terraform::Examples
name: 'billing_budget_filter'
primary_resource_id: 'budget'
vars:
display_name: 'Example Billing Budget'
test_env_vars:
billing_acct: :BILLING_ACCT
billing_acct: :MASTER_BILLING_ACCT
- !ruby/object:Provider::Terraform::Examples
name: 'billing_budget_notify'
primary_resource_id: 'budget'
vars:
budget_name: 'Example Billing Budget'
channel_name: 'Example Notification Channel'
test_env_vars:
billing_acct: :BILLING_ACCT
billing_acct: :MASTER_BILLING_ACCT
- !ruby/object:Provider::Terraform::Examples
name: 'billing_budget_customperiod'
primary_resource_id: 'budget'
vars:
display_name: 'Example Billing Budget'
test_env_vars:
billing_acct: :BILLING_ACCT
billing_acct: :MASTER_BILLING_ACCT
- !ruby/object:Provider::Terraform::Examples
name: 'billing_budget_optional'
primary_resource_id: 'budget'
Expand All @@ -71,7 +71,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
display_name: 'Example Billing Budget'
topic_name: "example-topic"
test_env_vars:
billing_acct: :BILLING_ACCT
billing_acct: :MASTER_BILLING_ACCT
properties:
name: !ruby/object:Overrides::Terraform::PropertyOverride
custom_flatten: 'templates/terraform/custom_flatten/name_from_self_link.erb'
Expand Down
2 changes: 2 additions & 0 deletions mmv1/provider/terraform/examples.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ class Examples < Api::Object
# - :ORG_ID
# - :ORG_TARGET
# - :BILLING_ACCT
# - :MASTER_BILLING_ACCT
# - :SERVICE_ACCT
# - :CUST_ID
# - :IDENTITY_USER
Expand Down Expand Up @@ -158,6 +159,7 @@ def config_documentation(pwd)
ORG_DOMAIN: 'example.com',
ORG_TARGET: '123456789',
BILLING_ACCT: '000000-0000000-0000000-000000',
MASTER_BILLING_ACCT: '000000-0000000-0000000-000000',
SERVICE_ACCT: 'emailAddress:my@service-account.com',
CUST_ID: 'A01b123xz',
IDENTITY_USER: 'cloud_identity_user'
Expand Down
2 changes: 2 additions & 0 deletions mmv1/templates/terraform/env_var_context.go.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
"<%= var_name -%>": getTestOrgTargetFromEnv(t),
<% elsif var_type == :BILLING_ACCT -%>
"<%= var_name -%>": getTestBillingAccountFromEnv(t),
<% elsif var_type == :MASTER_BILLING_ACCT -%>
"<%= var_name -%>": getTestMasterBillingAccountFromEnv(t),
<% elsif var_type == :SERVICE_ACCT -%>
"<%= var_name -%>": getTestServiceAccountFromEnv(t),
<% elsif var_type == :PROJECT_NAME -%>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ func TestAccBillingBudget_billingBudgetCurrencycode(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"billing_acct": getTestBillingAccountFromEnv(t),
"billing_acct": getTestMasterBillingAccountFromEnv(t),
"random_suffix": randString(t, 10),
}

Expand Down Expand Up @@ -69,7 +69,7 @@ func TestAccBillingBudget_billingBudgetUpdate(t *testing.T) {
t.Parallel()

context := map[string]interface{}{
"billing_acct": getTestBillingAccountFromEnv(t),
"billing_acct": getTestMasterBillingAccountFromEnv(t),
"random_suffix": randString(t, 10),
}

Expand Down Expand Up @@ -542,7 +542,7 @@ func TestAccBillingBudget_budgetFilterProjectsOrdering(t *testing.T) {

context := map[string]interface{}{
"org": getTestOrgFromEnv(t),
"billing_acct": getTestBillingAccountFromEnv(t),
"billing_acct": getTestMasterBillingAccountFromEnv(t),
"random_suffix_1": randString(t, 10),
"random_suffix_2": randString(t, 10),
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func TestAccBillingAccountIam(t *testing.T) {
skipIfVcr(t)
t.Parallel()

billing := getTestBillingAccountFromEnv(t)
billing := getTestMasterBillingAccountFromEnv(t)
account := fmt.Sprintf("tf-test-%d", randInt(t))
role := "roles/billing.viewer"
vcrTest(t, resource.TestCase{
Expand Down