hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.36k stars 1.75k forks source link

Fix failing TestAccSqlDatabaseInstance_replica and TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig acceptance tests for Cloud SQL #20436

Closed modular-magician closed 18 hours ago

modular-magician commented 18 hours ago

Reproduction steps:

  1. Set env variables:
    export GOOGLE_PROJECT=my_project
    export GOOGLE_ZONE=zone
    export GOOGLE_REGION=region
    export GOOGLE_USE_DEFAULT_CREDENTIALS=true
  2. Run the acceptance tests
    TF_LOG=TRACE make testacc TEST=./google/services/sql TESTARGS='-run=TestAccSqlDatabaseInstance_replica' > ~/output.log
    TF_LOG=TRACE make testacc TEST=./google/services/sql TESTARGS='-run=TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig' > ~/output.log

These tests are currently failing with a error like:

2024-11-19T21:15:51.401Z [ERROR] sdk.helper_resource: Expected an error with pattern (Error, failed to create instance tf-test-enterprise-l0dc6ekqdk: googleapi: Error 400: Invalid request: Only ENTERPRISE PLUS edition supports data cache.., invalid): test_step_number=3 test_name=TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig test_terraform_path=/usr/local/google/home/sarthaktn/.terraform/bin/terraform test_working_directory=/tmp/plugintest2936426735
  error=
  | Error running apply: exit status 1
  | 
  | Error: Error, failed to create instance tf-test-enterprise-l0dc6ekqdk: googleapi: Error 400: Invalid request: Only ENTERPRISE PLUS edition supports data cache..
  | Details:
  | [
  |   {
  |     "@type": "type.googleapis.com/google.rpc.DebugInfo",
  |     "detail": "[ORIGINAL ERROR] boss::8: Only ENTERPRISE PLUS edition supports data cache. [gdata.Errors] { error { domain: \"gdata.CoreErrorDomain\" code: \"INVALID_VALUE\" argument: \"Only ENTERPRISE PLUS edition supports data cache.\" location_type: PATH location: \"\" debug_info: \"BossException (INVALID_REQUEST): Only ENTERPRISE PLUS edition supports data cache.. {domain: gdata.CoreErrorDomain, code: INVALID_VALUE, arguments, [Only ENTERPRISE PLUS edition supports data cache.]}\\n\\tat com.google.storage.speckle.boss.util.exception.BossException.invalidExternalApiRequest(BossException.java:770)\\n\\tat com.google.storage.speckle.boss.admin.protoconverters.backendtoapiary.ProtoConverter.applyDataCacheConfig(ProtoConverter.java:1703)\\n\\tat com.google.storage.speckle.boss.admin.protoconverters.backendtoapiary.ProtoConverter.toNewInstance(ProtoConverter.java:989)\\n\\tat com.google.storage.speckle.boss.internal.util.InstanceSettingsResolverUtil.buildNewInstanceProtoForInsert(InstanceSettingsResolverUtil.java:775)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstancesServiceHelper.insertSpeckleInstance(InstancesServiceHelper.java:198)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction.createInstance(InstanceInsertAction.java:313)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction.execute(InstanceInsertAction.java:260)\\n\\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)\\n\\tat java.base/java.lang.reflect.Method.invoke(Unknown Source)\\n\\tat com.google.storage.speckle.boss.admin.logging.interceptors.ActionLogInterceptor.intercept(ActionLogInterceptor.java:53)\\n\\tat com.google.common.bytecode.ProxyMaker$Callback.intercept(ProxyMaker.java:268)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction$ByteBuddy$EmLNsARO.execute(Unknown Source)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction$ByteBuddy$EmLNsARO.execute(Unknown Source)\\n\\tat com.google.storage.speckle.boss.admin.framework.impl.RpcImpl.execute(RpcImpl.java:100)\\n\\tat com.google.storage.speckle.boss.admin.V1beta4InstancesServiceImpl.insert(V1beta4InstancesServiceImpl.java:354)\\n\\tat com.google.cloud.sql.v1beta4.SqlInstancesService$ServiceParameters$52.handleBlockingRequest(SqlInstancesService.java:3948)\\n\\tat com.google.cloud.sql.v1beta4.SqlInstancesService$ServiceParameters$52.handleBlockingRequest(SqlInstancesService.java:3946)\\n\\tat com.google.net.rpc3.impl.server.RpcBlockingApplicationHandler.handleRequest(RpcBlockingApplicationHandler.java:28)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$RpcApplicationHandlerAdaptor.handleRequest(RpcServerInterceptor2Util.java:82)\\n\\tat com.google.net.rpc3.impl.server.AggregatedRpcServerInterceptors.interceptRpc(AggregatedRpcServerInterceptors.java:100)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$InterceptedApplicationHandlerImpl.handleRequest(RpcServerInterceptor2Util.java:67)\\n\\tat com.google.prod.fireaxe.filters.FireaxeRpcServerInterceptorImpl.interceptRpc(FireaxeRpcServerInterceptorImpl.java:68)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$InterceptedApplicationHandlerImpl.handleRequest(RpcServerInterceptor2Util.java:67)\\n\\tat com.google.net.rpc.contrib.rpcinjectz2.RpcInjectz2ServerFaultInterceptor.interceptRpc(RpcInjectz2ServerFaultInterceptor.java:53)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$InterceptedApplicationHandlerImpl.handleRequest(RpcServerInterceptor2Util.java:67)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.runRpcInApplicationWithCancellation(RpcServerInternalContext.java:693)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.lambda$runRpcInApplication$0(RpcServerInternalContext.java:658)\\n\\tat io.grpc.Context.run(Context.java:536)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.runRpcInApplication(RpcServerInternalContext.java:658)\\n\\tat com.google.net.rpc3.impl.server.RpcServerChannel$4.apply(RpcServerChannel.java:1102)\\n\\tat com.google.net.rpc3.impl.server.RpcServerChannel$4.apply(RpcServerChannel.java:1060)\\n\\tat com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:261)\\n\\tat com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:251)\\n\\tat com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:131)\\n\\tat com.google.common.context.ContextRunnable.runInContext(ContextRunnable.java:83)\\n\\tat io.grpc.Context.run(Context.java:536)\\n\\tat com.google.tracing.GenericContextCallback.runInInheritedContext(GenericContextCallback.java:78)\\n\\tat com.google.common.context.ContextRunnable.run(ContextRunnable.java:74)\\n\\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\\n\\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\\n\\tat java.base/java.lang.Thread.run(Unknown Source)\\n\\n\" } }"
  |   }
  | ]
  | , invalid
  | 
  |   with google_sql_database_instance.instance,
  |   on terraform_plugin_test.tf line 3, in resource "google_sql_database_instance" "instance":
  |    3: resource "google_sql_database_instance" "instance" {
  | 

    resource_sql_database_instance_test.go:1781: Step 3/3, expected an error with pattern, no match on: Error running apply: exit status 1

        Error: Error, failed to create instance tf-test-enterprise-l0dc6ekqdk: googleapi: Error 400: Invalid request: Only ENTERPRISE PLUS edition supports data cache..
        Details:
        [
          {
            "@type": "type.googleapis.com/google.rpc.DebugInfo",
            "detail": "[ORIGINAL ERROR] boss::8: Only ENTERPRISE PLUS edition supports data cache. [gdata.Errors] { error { domain: \"gdata.CoreErrorDomain\" code: \"INVALID_VALUE\" argument: \"Only ENTERPRISE PLUS edition supports data cache.\" location_type: PATH location: \"\" debug_info: \"BossException (INVALID_REQUEST): Only ENTERPRISE PLUS edition supports data cache.. {domain: gdata.CoreErrorDomain, code: INVALID_VALUE, arguments, [Only ENTERPRISE PLUS edition supports data cache.]}\\n\\tat com.google.storage.speckle.boss.util.exception.BossException.invalidExternalApiRequest(BossException.java:770)\\n\\tat com.google.storage.speckle.boss.admin.protoconverters.backendtoapiary.ProtoConverter.applyDataCacheConfig(ProtoConverter.java:1703)\\n\\tat com.google.storage.speckle.boss.admin.protoconverters.backendtoapiary.ProtoConverter.toNewInstance(ProtoConverter.java:989)\\n\\tat com.google.storage.speckle.boss.internal.util.InstanceSettingsResolverUtil.buildNewInstanceProtoForInsert(InstanceSettingsResolverUtil.java:775)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstancesServiceHelper.insertSpeckleInstance(InstancesServiceHelper.java:198)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction.createInstance(InstanceInsertAction.java:313)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction.execute(InstanceInsertAction.java:260)\\n\\tat java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(Unknown Source)\\n\\tat java.base/java.lang.reflect.Method.invoke(Unknown Source)\\n\\tat com.google.storage.speckle.boss.admin.logging.interceptors.ActionLogInterceptor.intercept(ActionLogInterceptor.java:53)\\n\\tat com.google.common.bytecode.ProxyMaker$Callback.intercept(ProxyMaker.java:268)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction$ByteBuddy$EmLNsARO.execute(Unknown Source)\\n\\tat com.google.storage.speckle.boss.admin.actions.InstanceInsertAction$ByteBuddy$EmLNsARO.execute(Unknown Source)\\n\\tat com.google.storage.speckle.boss.admin.framework.impl.RpcImpl.execute(RpcImpl.java:100)\\n\\tat com.google.storage.speckle.boss.admin.V1beta4InstancesServiceImpl.insert(V1beta4InstancesServiceImpl.java:354)\\n\\tat com.google.cloud.sql.v1beta4.SqlInstancesService$ServiceParameters$52.handleBlockingRequest(SqlInstancesService.java:3948)\\n\\tat com.google.cloud.sql.v1beta4.SqlInstancesService$ServiceParameters$52.handleBlockingRequest(SqlInstancesService.java:3946)\\n\\tat com.google.net.rpc3.impl.server.RpcBlockingApplicationHandler.handleRequest(RpcBlockingApplicationHandler.java:28)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$RpcApplicationHandlerAdaptor.handleRequest(RpcServerInterceptor2Util.java:82)\\n\\tat com.google.net.rpc3.impl.server.AggregatedRpcServerInterceptors.interceptRpc(AggregatedRpcServerInterceptors.java:100)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$InterceptedApplicationHandlerImpl.handleRequest(RpcServerInterceptor2Util.java:67)\\n\\tat com.google.prod.fireaxe.filters.FireaxeRpcServerInterceptorImpl.interceptRpc(FireaxeRpcServerInterceptorImpl.java:68)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$InterceptedApplicationHandlerImpl.handleRequest(RpcServerInterceptor2Util.java:67)\\n\\tat com.google.net.rpc.contrib.rpcinjectz2.RpcInjectz2ServerFaultInterceptor.interceptRpc(RpcInjectz2ServerFaultInterceptor.java:53)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInterceptor2Util$InterceptedApplicationHandlerImpl.handleRequest(RpcServerInterceptor2Util.java:67)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.runRpcInApplicationWithCancellation(RpcServerInternalContext.java:693)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.lambda$runRpcInApplication$0(RpcServerInternalContext.java:658)\\n\\tat io.grpc.Context.run(Context.java:536)\\n\\tat com.google.net.rpc3.impl.server.RpcServerInternalContext.runRpcInApplication(RpcServerInternalContext.java:658)\\n\\tat com.google.net.rpc3.impl.server.RpcServerChannel$4.apply(RpcServerChannel.java:1102)\\n\\tat com.google.net.rpc3.impl.server.RpcServerChannel$4.apply(RpcServerChannel.java:1060)\\n\\tat com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:261)\\n\\tat com.google.common.util.concurrent.AbstractTransformFuture$TransformFuture.doTransform(AbstractTransformFuture.java:251)\\n\\tat com.google.common.util.concurrent.AbstractTransformFuture.run(AbstractTransformFuture.java:131)\\n\\tat com.google.common.context.ContextRunnable.runInContext(ContextRunnable.java:83)\\n\\tat io.grpc.Context.run(Context.java:536)\\n\\tat com.google.tracing.GenericContextCallback.runInInheritedContext(GenericContextCallback.java:78)\\n\\tat com.google.common.context.ContextRunnable.run(ContextRunnable.java:74)\\n\\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)\\n\\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)\\n\\tat java.base/java.lang.Thread.run(Unknown Source)\\n\\n\" } }"
          }
        ]
        , invalid

          with google_sql_database_instance.instance,
          on terraform_plugin_test.tf line 3, in resource "google_sql_database_instance" "instance":
           3: resource "google_sql_database_instance" "instance" {

I acknowledge that I have:

Release Note Template for Downstream PRs (will be copied)

sql: fixed acceptance tests TestAccSqlDatabaseInstance_replica and TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig.

Derived from https://github.com/GoogleCloudPlatform/magic-modules/pull/12366