Skip to content

Commit b86b1e9

Browse files
committed
change timeout for compute instance
1 parent 0191dec commit b86b1e9

File tree

3 files changed

+25
-3
lines changed

3 files changed

+25
-3
lines changed

oci/core_instance_resource.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ func CoreInstanceResource() *schema.Resource {
3333
State: schema.ImportStatePassthrough,
3434
},
3535
Timeouts: &schema.ResourceTimeout{
36-
Create: getTimeoutDuration("2h"),
37-
Update: getTimeoutDuration("2h"),
38-
Delete: getTimeoutDuration("2h"),
36+
Create: getTimeoutDuration("30m"),
37+
Update: getTimeoutDuration("30m"),
38+
Delete: getTimeoutDuration("30m"),
3939
},
4040
Create: createCoreInstance,
4141
Read: readCoreInstance,

oci/retry.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,9 @@ func getDefaultExpectedRetryDuration(response oci_common.OCIOperationResponse, d
139139
}
140140
defaultRetryTime = longRetryTime
141141
case 500:
142+
if e != nil && (strings.Contains(e.Error(), "Out of host capacity")) {
143+
return defaultRetryTime
144+
}
142145
if configuredRetryDuration != nil {
143146
return *configuredRetryDuration
144147
}

oci/retry_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,25 @@ func TestUnitRetryLoop_configuredRetry(t *testing.T) {
117117
retryLoop(t, &r)
118118
}
119119

120+
func TestUnitRetryLoop_outOfCapacity(t *testing.T) {
121+
if httpreplay.ModeRecordReplay() {
122+
t.Skip("Skip Retry Tests in HttpReplay mode.")
123+
}
124+
shortRetryTime = 15 * time.Second
125+
longRetryTime = 15 * time.Second
126+
tmp := time.Duration(30 * time.Second)
127+
configuredRetryDuration = &tmp
128+
r := retryTestInput{
129+
serviceName: "core",
130+
httpResponseStatusCode: 500,
131+
header: map[string][]string{},
132+
responseError: fmt.Errorf("Out of host capacity"),
133+
expectedRetryTimeSeconds: 15,
134+
jitterMode: true,
135+
}
136+
retryLoop(t, &r)
137+
}
138+
120139
// Even if a retry timeout is configured, it should be ignored for errors that are not 429/500
121140
func TestUnitRetryLoop_configuredRetryWith404(t *testing.T) {
122141
if httpreplay.ModeRecordReplay() {

0 commit comments

Comments
 (0)