public QueryTests(ITestOutputHelper output) : base(output) { _dailyRepository = new DailyLogEventRepository(_configuration); _employeeRepository = new EmployeeRepository(_configuration); RemoveDataAsync().GetAwaiter().GetResult(); }
public SearchableRepositoryTests(ITestOutputHelper output) : base(output) { _identityRepository = new IdentityRepository(_configuration); _dailyRepository = new DailyLogEventRepository(_configuration); RemoveDataAsync().GetAwaiter().GetResult(); }
public RepositoryTests(ITestOutputHelper output) : base(output) { _dailyRepository = new DailyLogEventRepository(_configuration); _employeeRepository = new EmployeeRepository(_configuration); _identityRepository = new IdentityRepository(_configuration); _identityRepositoryWithNoCaching = new IdentityWithNoCachingRepository(_configuration); RemoveDataAsync().GetAwaiter().GetResult(); }
public async Task GetByDateBasedIndexAsync() { await _configuration.DailyLogEvents.ConfigureAsync(); // TODO: Fix this once https://github.com/elastic/elasticsearch-net/issues/3829 is fixed in beta2 //var indexes = await _client.GetIndicesPointingToAliasAsync(_configuration.DailyLogEvents.Name); //Assert.Empty(indexes); var alias = await _client.Indices.GetAliasAsync(_configuration.DailyLogEvents.Name); _logger.LogRequest(alias); Assert.False(alias.IsValid); var utcNow = SystemClock.UtcNow; ILogEventRepository repository = new DailyLogEventRepository(_configuration); var logEvent = await repository.AddAsync(LogEventGenerator.Generate(createdUtc: utcNow)); Assert.NotNull(logEvent?.Id); logEvent = await repository.AddAsync(LogEventGenerator.Generate(createdUtc: utcNow.SubtractDays(1)), o => o.ImmediateConsistency()); Assert.NotNull(logEvent?.Id); alias = await _client.Indices.GetAliasAsync(_configuration.DailyLogEvents.Name); _logger.LogRequest(alias); Assert.True(alias.IsValid); Assert.Equal(2, alias.Indices.Count); var indexes = await _client.GetIndicesPointingToAliasAsync(_configuration.DailyLogEvents.Name); Assert.Equal(2, indexes.Count()); await repository.RemoveAllAsync(o => o.ImmediateConsistency()); Assert.Equal(0, await repository.CountAsync()); }
public async Task GetByDateBasedIndexAsync() { await _configuration.DailyLogEvents.ConfigureAsync(); var indexes = await _client.GetIndicesPointingToAliasAsync(_configuration.DailyLogEvents.Name); Assert.Equal(0, indexes.Count()); var alias = await _client.GetAliasAsync(descriptor => descriptor.Name(_configuration.DailyLogEvents.Name)); _logger.Trace(() => alias.GetRequest()); Assert.False(alias.IsValid); var utcNow = SystemClock.UtcNow; var repository = new DailyLogEventRepository(_configuration); var logEvent = await repository.AddAsync(LogEventGenerator.Generate(createdUtc: utcNow)); Assert.NotNull(logEvent?.Id); logEvent = await repository.AddAsync(LogEventGenerator.Generate(createdUtc: utcNow.SubtractDays(1)), o => o.ImmediateConsistency()); Assert.NotNull(logEvent?.Id); alias = await _client.GetAliasAsync(descriptor => descriptor.Name(_configuration.DailyLogEvents.Name)); _logger.Trace(() => alias.GetRequest()); Assert.True(alias.IsValid); Assert.Equal(2, alias.Indices.Count); indexes = await _client.GetIndicesPointingToAliasAsync(_configuration.DailyLogEvents.Name); Assert.Equal(2, indexes.Count()); await repository.RemoveAllAsync(o => o.ImmediateConsistency()); Assert.Equal(0, await repository.CountAsync()); }