2022-11-16 09:55:36 +03:00
|
|
|
package terraform_module_test_helper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/json"
|
2024-08-20 04:09:01 +03:00
|
|
|
"github.com/stretchr/testify/require"
|
2022-11-16 09:55:36 +03:00
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2022-11-22 13:46:00 +03:00
|
|
|
func ReadRetryableErrors(retryableCfg []byte, t *testing.T) map[string]string {
|
2022-11-16 09:55:36 +03:00
|
|
|
cfg := struct {
|
|
|
|
RetryableErrors []string `json:"retryable_errors"`
|
|
|
|
}{}
|
|
|
|
|
2024-08-20 04:09:01 +03:00
|
|
|
require.NoError(t, json.Unmarshal(retryableCfg, &cfg))
|
2022-11-16 09:55:36 +03:00
|
|
|
retryableRegexes := cfg.RetryableErrors
|
|
|
|
retryableErrors := make(map[string]string)
|
|
|
|
for _, r := range retryableRegexes {
|
2022-11-22 13:46:00 +03:00
|
|
|
retryableErrors[r] = "retryable errors set by test"
|
2022-11-16 09:55:36 +03:00
|
|
|
}
|
|
|
|
return retryableErrors
|
|
|
|
}
|