From 7968c70df478366c6a9326484c35678c373a9b4a Mon Sep 17 00:00:00 2001 From: Salvatore Campagna <93581129+salvatore-campagna@users.noreply.github.com> Date: Fri, 20 May 2022 19:14:33 +0200 Subject: [PATCH] fix: move refresh just before the match_all query Using the command line provided in #81983 I could not reproduce the issue. Anyway, changing the timeout from 5 seconds to just 1 second I could reproduce the issue. At the end, keeping a timeout of 1 second I could fix the issue moving the refresh operation just before running the match_all query. My understanding is that the timeout is used to give the rollup job enough time to complete the rollup operation. Anyway, other than that, after the rollup job has written data into the rollup index we need to refresh it in order for the subsequent search operation to hit the expected rolledup document. --- .../test/rollup/security_tests.yml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/rollup/security_tests.yml b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/rollup/security_tests.yml index 07f4e2b62a6f9..20b58e3200342 100644 --- a/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/rollup/security_tests.yml +++ b/x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/rollup/security_tests.yml @@ -119,11 +119,6 @@ teardown: id: foo - is_true: started - - do: - headers: { Authorization: "Basic dGVzdF91c2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } # test_user - indices.refresh: - index: rollup - # this is a hacky way to sleep for 5s, since we will never have 10 nodes - do: catch: request_timeout @@ -140,6 +135,11 @@ teardown: - match: jobs.0.stats.documents_processed: 1 + - do: + headers: { Authorization: "Basic dGVzdF91c2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } # test_user + indices.refresh: + index: rollup + - do: headers: { Authorization: "Basic dGVzdF91c2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } # test_user search: @@ -279,11 +279,6 @@ teardown: id: foo - is_true: started - - do: - headers: { Authorization: "Basic dGVzdF91c2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } # test_user - indices.refresh: - index: rollup - # this is a hacky way to sleep for 5s, since we will never have 10 nodes - do: catch: request_timeout @@ -300,6 +295,11 @@ teardown: - match: jobs.0.stats.documents_processed: 1 + - do: + headers: { Authorization: "Basic dGVzdF91c2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } # test_user + indices.refresh: + index: rollup + - do: headers: { Authorization: "Basic dGVzdF91c2VyOngtcGFjay10ZXN0LXBhc3N3b3Jk" } # test_user search: