Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vzayts committed Dec 12, 2023
1 parent 3379e83 commit 362fa95
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 2 additions & 2 deletions metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (md *MetadataService) AwaitDataSourceAvailable(dataSourceName string) error
return err
}
if len(res) >= 1 && res[0].Cnt == 1 {
break
return nil
}
case <-time.After(md.awaitTimeout):
return errors.New("AwaitDataSourceAvailable timeout")
Expand All @@ -106,7 +106,7 @@ func (md *MetadataService) AwaitRecordsCount(dataSourceName string, recordsCount
}

if len(res) >= 1 && res[0].Cnt == recordsCount {
break
return nil
}
case <-time.After(md.awaitTimeout):
return errors.New("AwaitRecordsCount timeout")
Expand Down
4 changes: 3 additions & 1 deletion tasks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func triggerIngestionTask(d *Client, dataSourceName string, entries []testDO) (s
func AwaitTaskCompletion(client *Client, taskID string, awaitTimeout time.Duration, tickerDuration time.Duration) error {
ticker := time.NewTicker(tickerDuration)
defer ticker.Stop()
L:
for {
select {
case <-ticker.C:
Expand All @@ -70,11 +71,12 @@ func AwaitTaskCompletion(client *Client, taskID string, awaitTimeout time.Durati
if res.Status.Status == "RUNNING" {
continue
}
break
break L
case <-time.After(awaitTimeout):
return errors.New("AwaitTaskRunning timeout")
}
}
return nil
}

// AwaitTaskStatus waits for the druid task status for the maximum of awaitTimeout duration, querying druid task API.
Expand Down

0 comments on commit 362fa95

Please sign in to comment.