public async Task SiloInstanceTable_Op_CleanDeadSiloInstance()
        {
            // Register a silo entry
            await manager.TryCreateTableVersionEntryAsync();

            this.generation = 0;
            RegisterSiloInstance();
            // and mark it as dead
            await manager.UnregisterSiloInstance(myEntry);

            // Create new active entries
            for (int i = 1; i < 5; i++)
            {
                this.generation  = i;
                this.siloAddress = SiloAddressUtils.NewLocalSiloAddress(generation);
                var instance = RegisterSiloInstance();
                await manager.ActivateSiloInstance(instance);
            }

            await Task.Delay(TimeSpan.FromSeconds(3));

            await manager.CleanupDefunctSiloEntries(DateTime.Now - TimeSpan.FromSeconds(1));

            var entries = await manager.FindAllSiloEntries();

            Assert.Equal(5, entries.Count);
            Assert.All(entries, e => Assert.NotEqual(SiloInstanceTableTestConstants.INSTANCE_STATUS_DEAD, e.Item1.Status));
        }
Exemplo n.º 2
0
 public Task CleanupDefunctSiloEntries(DateTimeOffset beforeDate)
 {
     return(tableManager.CleanupDefunctSiloEntries(beforeDate));
 }