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

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

Conversation

modular-magician
Copy link
Collaborator

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
  1. 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:

  • Searched through the issue tracker for an open issue that this either resolves or contributes to, commented on it to claim it, and written "fixes {url}" or "part of {url}" in this PR description. If there were no relevant open issues, I opened one and commented that I would like to work on it (not necessary for very small changes).
  • Ensured that all new fields I added that can be set by a user appear in at least one example (for generated resources) or third_party test (for handwritten resources or update tests).
  • Generated Terraform providers, and ran make test and make lint in the generated providers to ensure it passes unit and linter tests.
  • Ran relevant acceptance tests using my own Google Cloud project and credentials (If the acceptance tests do not yet pass or you are unable to run them, please let your reviewer know).
  • Read the Release Notes Guide before writing my release note below.

Release Note Template for Downstream PRs (will be copied)

sql: fixed acceptance tests TestAccSqlDatabaseInstance_replica and TestAccSQLDatabaseInstance_sqlPostgresDataCacheConfig.

Derived from GoogleCloudPlatform/magic-modules#12366

…Instance_sqlPostgresDataCacheConfig acceptance tests for Cloud SQL (hashicorp#12366)

Co-authored-by: Sarthak Tandon <[email protected]>

[upstream:2ce9af1ef67b1b027781c9f22c73f982a25c425b]

Signed-off-by: Modular Magician <[email protected]>
@modular-magician modular-magician requested a review from a team as a code owner November 21, 2024 21:41
@modular-magician modular-magician merged commit 5c0aafd into hashicorp:main Nov 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant