@@ -17,17 +17,52 @@ limitations under the License.
1717package support
1818
1919import (
20+ "fmt"
21+ "os"
2022 "time"
2123
24+ "github.com/onsi/gomega"
25+ "github.com/onsi/gomega/format"
26+
2227 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2328)
2429
25- const (
30+ var (
2631 TestTimeoutShort = 1 * time .Minute
2732 TestTimeoutMedium = 2 * time .Minute
2833 TestTimeoutLong = 5 * time .Minute
29- )
3034
31- var (
3235 ApplyOptions = metav1.ApplyOptions {FieldManager : "codeflare-test" , Force : true }
3336)
37+
38+ func init () {
39+ if value , ok := os .LookupEnv ("CODEFLARE_TEST_TIMEOUT_SHORT" ); ok {
40+ if duration , err := time .ParseDuration (value ); err == nil {
41+ TestTimeoutShort = duration
42+ } else {
43+ fmt .Printf ("Error parsing CODEFLARE_TEST_TIMEOUT_SHORT. Using default value: %s" , TestTimeoutShort )
44+ }
45+ }
46+ if value , ok := os .LookupEnv ("CODEFLARE_TEST_TIMEOUT_MEDIUM" ); ok {
47+ if duration , err := time .ParseDuration (value ); err == nil {
48+ TestTimeoutMedium = duration
49+ } else {
50+ fmt .Printf ("Error parsing CODEFLARE_TEST_TIMEOUT_MEDIUM. Using default value: %s" , TestTimeoutMedium )
51+ }
52+ }
53+ if value , ok := os .LookupEnv ("CODEFLARE_TEST_TIMEOUT_LONG" ); ok {
54+ if duration , err := time .ParseDuration (value ); err == nil {
55+ TestTimeoutLong = duration
56+ } else {
57+ fmt .Printf ("Error parsing CODEFLARE_TEST_TIMEOUT_LONG. Using default value: %s" , TestTimeoutLong )
58+ }
59+ }
60+
61+ // Gomega settings
62+ gomega .SetDefaultEventuallyTimeout (TestTimeoutShort )
63+ gomega .SetDefaultEventuallyPollingInterval (1 * time .Second )
64+ gomega .SetDefaultConsistentlyDuration (30 * time .Second )
65+ gomega .SetDefaultConsistentlyPollingInterval (1 * time .Second )
66+ // Disable object truncation on test results
67+ format .MaxLength = 0
68+ }
0 commit comments