DEV: Disable SearchIndexer after fabrication (#21378)

SearchIndexer is only automatically disabled in `before_all` and `before` blocks which means at the start
of test runs. Enabling the SearchIndexer in one `fab!` block will affect
all other `fab!` blocks which is not ideal as we may be indexing stuff
for search when we don't need to.
This commit is contained in:
Alan Guo Xiang Tan
2023-05-04 09:20:52 +08:00
committed by GitHub
parent 9a3257cb33
commit afc1611be7
6 changed files with 42 additions and 45 deletions

View File

@@ -202,4 +202,11 @@ module Helpers
ips.map { |ip| Addrinfo.new([IPAddr.new(ip).ipv6? ? "AF_INET6" : "AF_INET", 80, nil, ip]) },
)
end
def with_search_indexer_enabled
SearchIndexer.enable
yield
ensure
SearchIndexer.disable
end
end