Skip to content

Commit

Permalink
fix David suggestions 1
Browse files Browse the repository at this point in the history
  • Loading branch information
bartam1 committed Aug 3, 2023
1 parent b678b17 commit 400c0ff
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 6 additions & 4 deletions tests/e2e/koperator_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/pkg/tests/tests.go
Original file line number Diff line number Diff line change
Expand Up @@ -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]) {
Expand Down Expand Up @@ -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])
})
Expand All @@ -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)
Expand Down

0 comments on commit 400c0ff

Please sign in to comment.