From af86411d7ac4cf378ab3d15ce1d674aea2ce750b Mon Sep 17 00:00:00 2001 From: Rick Brouwer Date: Sat, 19 Oct 2024 17:56:42 +0200 Subject: [PATCH] Update Signed-off-by: Rick Brouwer --- .../scalers/elasticsearch/elasticsearch_test.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tests/scalers/elasticsearch/elasticsearch_test.go b/tests/scalers/elasticsearch/elasticsearch_test.go index a72a2f84c47..bbe55eb00fa 100644 --- a/tests/scalers/elasticsearch/elasticsearch_test.go +++ b/tests/scalers/elasticsearch/elasticsearch_test.go @@ -256,7 +256,21 @@ spec: query: | { "query": { - "match_all": {} + "bool": { + "must": [ + { + "range": { + "@timestamp": { + "gte": "now-1m", + "lte": "now" + } + } + }, + { + "match_all": {} + } + ] + } } } valueLocation: "hits.total.value" @@ -401,6 +415,7 @@ func addElements(t *testing.T, count int) { _, err = ExecuteCommand(fmt.Sprintf("%s -XPOST http://localhost:9200/%s/_doc -d '%s'", kubectlElasticExecCmd, indexName, result)) assert.NoErrorf(t, err, "cannot execute command - %s", err) } + time.Sleep(10 * time.Second) } func getElasticsearchDoc() (interface{}, error) {