Skip to content

Commit 66f924a

Browse files
authored
chore: Follow-up changes for PR 3140 (#3154)
* document isKnown * simplify checkBlocks * final period
1 parent fab968b commit 66f924a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

internal/service/advancedcluster/resource_advanced_cluster_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,11 +1387,11 @@ func TestAccMockableAdvancedCluster_removeBlocksFromConfig(t *testing.T) {
13871387
Steps: []resource.TestStep{
13881388
{
13891389
Config: configBlocks(t, projectID, clusterName, true),
1390-
Check: checkBlocks(projectID, clusterName, true),
1390+
Check: checkBlocks(true),
13911391
},
13921392
{
13931393
Config: configBlocks(t, projectID, clusterName, false),
1394-
Check: checkBlocks(projectID, clusterName, false),
1394+
Check: checkBlocks(false),
13951395
},
13961396
acc.TestStepImportCluster(resourceName),
13971397
},
@@ -1567,7 +1567,7 @@ func configBlocks(t *testing.T, projectID, clusterName string, firstStep bool) s
15671567
`, projectID, clusterName, instanceSize1, extraConfig0, extraConfig1))
15681568
}
15691569

1570-
func checkBlocks(projectID, clusterName string, firstStep bool) resource.TestCheckFunc {
1570+
func checkBlocks(firstStep bool) resource.TestCheckFunc {
15711571
checksMap := map[string]string{
15721572
"replication_specs.0.region_configs.0.electable_specs.0.instance_size": "M10",
15731573
"replication_specs.0.region_configs.0.electable_specs.0.node_count": "5",

internal/service/advancedclustertpf/plan_modifier.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,7 @@ func copyAttrIfDestNotKnown[T attr.Value](src, dest *T) {
271271
}
272272
}
273273

274+
// isKnown returns true if the attribute is known (not null or unknown). Note that !isKnown is not the same as IsUnknown because null is !isKnown but not IsUnknown.
274275
func isKnown(attribute attr.Value) bool {
275276
return !attribute.IsNull() && !attribute.IsUnknown()
276277
}

0 commit comments

Comments
 (0)