Skip to content

Commit 18c6128

Browse files
committed
Add workaround for audit tests to avoid race conditions in service implementation of Get/UpdateConfiguration
1 parent c6abfe1 commit 18c6128

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

oci/audit_configuration_resource.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package provider
44

55
import (
66
"context"
7+
"time"
78

89
"github.com/hashicorp/terraform/helper/schema"
910

@@ -117,6 +118,10 @@ func (s *ConfigurationResourceCrud) Update() error {
117118
return err
118119
}
119120

121+
// Workaround: Sleep for some time before polling the configuration. Because update happens asynchronously, polling too
122+
// soon may result in service returning stale configuration values.
123+
time.Sleep(time.Second * 5)
124+
120125
// Requests to update the retention policy may succeed instantly but may not see the actual update take effect
121126
// until minutes later. Add polling here to return only when the change has taken effect.
122127
retentionPolicyFunc := func() bool { return *s.Res.RetentionPeriodDays == *request.RetentionPeriodDays }

0 commit comments

Comments
 (0)