diff --git a/tests/e2e/const.go b/tests/e2e/const.go index 542e63fde..b4b74b703 100644 --- a/tests/e2e/const.go +++ b/tests/e2e/const.go @@ -53,7 +53,7 @@ const ( defaultTopicCreationWaitTime = 10 * time.Second defaultUserCreationWaitTime = 10 * time.Second - kafkaClusterCreateTimeout = 600 * time.Second // Increased from 600 to 700 for multiple kind + kafkaClusterCreateTimeout = 600 * time.Second kafkaClusterResourceCleanupTimeout = 120 * time.Second kcatDeleetionTimeout = 40 * time.Second zookeeperClusterCreateTimeout = 7 * time.Minute // Increased from 4 to 7 for multiple kind diff --git a/tests/e2e/koperator_suite_test.go b/tests/e2e/koperator_suite_test.go index ea6d20790..34f82141b 100644 --- a/tests/e2e/koperator_suite_test.go +++ b/tests/e2e/koperator_suite_test.go @@ -100,19 +100,21 @@ func runGinkgoTests(t *testing.T) error { if err != nil { return fmt.Errorf("could not parse MaxTimeout into time.Duration: %w", err) } - // Protection against too long test suites - if testSuiteDuration > maxTimeout { - return fmt.Errorf("tests estimated duration: '%s' bigger then maxTimeout: '%s'", testSuiteDuration.String(), maxTimeout.String()) - } // Calculated timeout can be overran with the specified time length allowedOverrun, err := time.ParseDuration(viper.GetString(config.Tests.AllowedOverrunDuration)) if err != nil { return fmt.Errorf("could not parse AllowedOverrunDuration into time.Duration: %w", err) } + // Set TestSuite timeout based on the generated tests suiteConfig.Timeout = testSuiteDuration + allowedOverrun + // Protection against too long test suites + if suiteConfig.Timeout > maxTimeout { + return fmt.Errorf("tests estimated duration: '%s' longer then maxTimeout: '%s'", suiteConfig.Timeout.String(), maxTimeout.String()) + } + if viper.GetBool(config.Tests.CreateTestReportFile) { if err := createTestReportFile(); err != nil { return err diff --git a/tests/e2e/pkg/tests/tests.go b/tests/e2e/pkg/tests/tests.go index 87125be3d..7bb7b3f3f 100644 --- a/tests/e2e/pkg/tests/tests.go +++ b/tests/e2e/pkg/tests/tests.go @@ -49,8 +49,8 @@ func (tests TestPool) Equal(other TestPool) bool { return false } - tests.Sort() - other.Sort() + tests.sort() + other.sort() for i := range tests { if !tests[i].equal(other[i]) { @@ -100,7 +100,7 @@ func (tests TestPool) BuildParallelByK8sCluster() { } } -func (tests TestPool) Sort() { +func (tests TestPool) sort() { sort.SliceStable(tests, func(i, j int) bool { return tests[i].less(tests[j]) }) @@ -110,7 +110,7 @@ func (tests TestPool) getSortedTestsByClusterID() map[string][]Test { testsByClusterID := make(map[string][]Test) // Need to be sorted to achieve test specs tree consistency between processes // otherwise it can happen that specs order will be different for each process - tests.Sort() + tests.sort() for _, test := range tests { testsByClusterID[test.k8sCluster.clusterInfo.clusterID] = append(testsByClusterID[test.k8sCluster.clusterInfo.clusterID], test)