forked from GoogleCloudPlatform/magic-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add missing test for
data.google_firebase_web_app_config
, clean up …
…plugin-framework Firebase code a bit (GoogleCloudPlatform#11927)
- Loading branch information
1 parent
5f10b36
commit e4b7c95
Showing
4 changed files
with
87 additions
and
28 deletions.
There are no files selected for viewing
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
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
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
51 changes: 51 additions & 0 deletions
51
...party/terraform/services/firebase/data_source_google_firebase_web_app_config_test.go.tmpl
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,51 @@ | ||
package firebase_test | ||
{{- if ne $.TargetVersionName "ga" }} | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/hashicorp/terraform-plugin-testing/helper/resource" | ||
"github.com/hashicorp/terraform-provider-google/google/acctest" | ||
"github.com/hashicorp/terraform-provider-google/google/envvar" | ||
) | ||
|
||
func TestAccDataSourceGoogleFirebaseWebAppConfig(t *testing.T) { | ||
// TODO: https://github.com/hashicorp/terraform-provider-google/issues/14158 | ||
acctest.SkipIfVcr(t) | ||
t.Parallel() | ||
context := map[string]interface{}{ | ||
"project_id": envvar.GetTestProjectFromEnv(), | ||
"display_name": "tf_test Display Name WebApp DataSource", | ||
} | ||
|
||
acctest.VcrTest(t, resource.TestCase{ | ||
PreCheck: func() { acctest.AccTestPreCheck(t) }, | ||
CheckDestroy: testAccCheckFirebaseWebAppDestroyProducer(t), | ||
Steps: []resource.TestStep{ | ||
{ | ||
ProtoV5ProviderFactories: acctest.ProtoV5ProviderFactories(t), | ||
Config: testAccDataSourceGoogleFirebaseWebAppConfig(context), | ||
Check: resource.ComposeTestCheckFunc( | ||
resource.TestCheckResourceAttrSet("data.google_firebase_web_app_config.my_app_config", "api_key"), | ||
resource.TestCheckResourceAttrSet("data.google_firebase_web_app_config.my_app_config", "auth_domain"), | ||
resource.TestCheckResourceAttrSet("data.google_firebase_web_app_config.my_app_config", "database_url"), | ||
resource.TestCheckResourceAttrSet("data.google_firebase_web_app_config.my_app_config", "storage_bucket"), | ||
), | ||
}, | ||
}, | ||
}) | ||
} | ||
|
||
func testAccDataSourceGoogleFirebaseWebAppConfig(context map[string]interface{}) string { | ||
return acctest.Nprintf(` | ||
resource "google_firebase_web_app" "my_app" { | ||
project = "%{project_id}" | ||
display_name = "%{display_name}" | ||
} | ||
|
||
data "google_firebase_web_app_config" "my_app_config" { | ||
web_app_id = google_firebase_web_app.my_app.app_id | ||
} | ||
`, context) | ||
} | ||
{{- end }} |