Skip to content

Fail RavenDB tests that make a dynamic query create an auto index - #6115

Draft
mauroservienti wants to merge 2 commits into
masterfrom
auto-index-teardown-checks
Draft

mauroservienti wants to merge 2 commits into
masterfrom
auto-index-teardown-checks

Conversation

@mauroservienti

Copy link
Copy Markdown
Member

Before merging

Description

A dynamic query makes RavenDB create an auto index. An auto index has no per-index search engine setting, so the search engine custom check keeps reporting it after all static indexes use Lucene. #6100 added a check after each test that fails it when the error database has an auto index, but only in ServiceControl.Persistence.Tests.RavenDB. The queries made by the API, the background services, and the custom checks run in the acceptance tests, and the audit database was not checked anywhere.

Changes

  • TestHelper.AutoIndexes: lists the Auto/ indexes of the given databases, and treats a database that does not exist as having none. AssertNone fails the test with the database and index names.
  • After each test, the auto indexes are collected, the test databases are deleted, and then the test fails if any were found, so a failure does not leave databases behind.
Test project Databases checked
ServiceControl.Persistence.Tests.RavenDB error and throughput (was error only)
ServiceControl.Audit.Persistence.Tests.RavenDB audit
ServiceControl.AcceptanceTests.RavenDB error and throughput
ServiceControl.Audit.AcceptanceTests.RavenDB audit
ServiceControl.MultiInstance.AcceptanceTests the primary, throughput, and audit databases

Indexing.DisableQueryOptimizerGeneratedIndexes would make a dynamic query throw where it runs, but the background services and custom checks catch and log exceptions, so a test would still pass. Checking for the auto indexes after the test catches every query that ran.

What it finds

On master:

  • Audit persistence (85), audit acceptance (75), and multi-instance acceptance (23): no auto indexes.
  • Primary acceptance: 4 licensing and usage report tests create auto indexes in the throughput database, for example Auto/EndpointDocuments/ByEndpointId.ThroughputSource.
  • Primary persistence: 11 licensing tests create auto indexes in the throughput database.

With #6099 merged, all of these pass. The remaining local failures are the known setup failures with a refused connection to the shared embedded server on port 33334.

The check after each test covered only the error database in the persistence tests. It now also runs in the audit persistence tests and in the primary, audit, and multi-instance acceptance tests, for every database they use.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant