fix: fix wait test
[skip ci]
This commit is contained in:
parent
ece6ee8f28
commit
292d5af7a2
2 changed files with 28 additions and 7 deletions
|
|
@ -4,6 +4,7 @@ package postgresflexalpha
|
|||
|
||||
import (
|
||||
"context"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
|
|
@ -23,6 +24,7 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
|
|||
wantErr bool
|
||||
wantRes *v3alpha1api.GetInstanceResponse
|
||||
timeout time.Duration
|
||||
onlyOnLong bool
|
||||
}{
|
||||
{
|
||||
desc: "create_succeeded",
|
||||
|
|
@ -47,6 +49,7 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
onlyOnLong: true,
|
||||
desc: "create_failed",
|
||||
instanceGetFails: false,
|
||||
instanceState: InstanceStateFailed,
|
||||
|
|
@ -67,7 +70,8 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
|
|||
RouterAddress: utils.Ptr("10.0.0.1"),
|
||||
},
|
||||
},
|
||||
timeout: 30 * time.Second,
|
||||
// waiter uses random timeouts up to 8 times 30 secs
|
||||
timeout: 300 * time.Second,
|
||||
},
|
||||
{
|
||||
desc: "create_failed_2",
|
||||
|
|
@ -153,6 +157,13 @@ func TestCreateInstanceWaitHandler(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
if tt.onlyOnLong {
|
||||
_, ok := os.LookupEnv("TF_RUN_LONG_TESTS")
|
||||
if !ok {
|
||||
t.Logf("skipping test '%s' because TF_RUN_LONG_TESTS env var is missing", tt.desc)
|
||||
continue
|
||||
}
|
||||
}
|
||||
t.Run(
|
||||
tt.desc, func(t *testing.T) {
|
||||
instanceID := "foo-bar"
|
||||
|
|
@ -220,6 +231,7 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
|
|||
wantErr bool
|
||||
wantRes *v3alpha1api.GetInstanceResponse
|
||||
timeout time.Duration
|
||||
onlyOnLong bool
|
||||
}{
|
||||
{
|
||||
desc: "update_succeeded",
|
||||
|
|
@ -244,6 +256,7 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
|
|||
},
|
||||
},
|
||||
{
|
||||
onlyOnLong: true,
|
||||
desc: "update_failed",
|
||||
instanceGetFails: false,
|
||||
instanceState: InstanceStateFailed,
|
||||
|
|
@ -264,7 +277,7 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
|
|||
RouterAddress: utils.Ptr("10.0.0.1"),
|
||||
},
|
||||
},
|
||||
timeout: 30 * time.Second,
|
||||
timeout: 300 * time.Second,
|
||||
},
|
||||
{
|
||||
desc: "update_failed_2",
|
||||
|
|
@ -300,6 +313,14 @@ func TestUpdateInstanceWaitHandler(t *testing.T) {
|
|||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
if tt.onlyOnLong {
|
||||
_, ok := os.LookupEnv("TF_RUN_LONG_TESTS")
|
||||
if !ok {
|
||||
t.Logf("skipping test '%s' because TF_RUN_LONG_TESTS env var is missing", tt.desc)
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
t.Run(
|
||||
tt.desc, func(t *testing.T) {
|
||||
instanceID := "foo-bar"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue