cockroachdb / terraform-provider-cockroach

Terraform provider for CockroachDB Cloud
Apache License 2.0
56 stars 10 forks source link

Fix updating ip allowlist state #87

Closed yecs1999 closed 1 year ago

yecs1999 commented 1 year ago

Fixes https://github.com/cockroachdb/terraform-provider-cockroach/issues/86

erademacher commented 1 year ago

Could you add a regression test, please? You can parameterize getTestAllowlistEntryResourceConfig and change the flag and name values in another test step. Take a look at testDatabaseResource for an example of a two-step test.

We don't have many update tests because they tend to be long and flaky, but allowlist entry changes should be pretty quick.

If you don't have time, I can handle it.

yecs1999 commented 1 year ago

@erademacher i'm still getting an error on the integration test after adding a second step

    cluster_resource.go:353: Unexpected call to *mock_client.MockService.GetCluster([context.Background.WithValue(type transport.connectionKey, val <not Stringer>).WithValue(type peer.peerKey, val <not Stringer>).WithCancel.WithValue(type metadata.mdIncomingKey, val <not Stringer>).WithValue(type grpc.streamKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>).WithCancel.WithValue(type tf6serverlogging.ContextKeyDownstreamRequestStartTime, val 2023-03-09 00:02:26.160444699 +0000 UTC m=+5.378243490).WithCancel.WithValue(type logging.loggerKey, val <not Stringer>).WithValue(type logging.loggerKey, val <not Stringer>) 00000000-0000-0000-0000-000000000000]) at /home/runner/work/terraform-provider-cockroach/terraform-provider-cockroach/internal/provider/cluster_resource.go:353 because: 
        expected call at /home/runner/work/terraform-provider-cockroach/terraform-provider-cockroach/internal/provider/networking_resource_test.go:101 has already been called the max number of times
panic: test timed out after 5m0s

I likely won't have much more time to finish this, so if you can finish the tests up that would be great !

yecs1999 commented 1 year ago

Thanks!