Esempio n. 1
0
        public async Task SiloUngracefulShutdown_OutstandingRequestsBreak()
        {
            var grain      = HostedCluster.GrainFactory.GetGrain <ILongRunningTaskGrain <bool> >(Guid.NewGuid());
            var instanceId = await grain.GetRuntimeInstanceId();

            var target           = HostedCluster.GrainFactory.GetGrain <ILongRunningTaskGrain <bool> >(Guid.NewGuid());
            var targetInstanceId = await target.GetRuntimeInstanceId();

            var isOnSameSilo = instanceId == targetInstanceId;

            Assert.False(isOnSameSilo, "Activations must be placed on different silos");

            var promise = instanceId.Contains(HostedCluster.Primary.Endpoint.ToString()) ?
                          grain.CallOtherLongRunningTask(target, true, TimeSpan.FromSeconds(7))
                : target.CallOtherLongRunningTask(grain, true, TimeSpan.FromSeconds(7));

            await Task.Delay(500);

            HostedCluster.KillSilo(HostedCluster.SecondarySilos[0]);
            try
            {
                await promise;
                Assert.True(false, "The broken promise exception was not thrown");
            }
            catch (Exception ex)
            {
                Assert.Equal(typeof(SiloUnavailableException), ex.GetBaseException().GetType());
            }
        }
Esempio n. 2
0
        public async Task SiloUngracefulShutdown_ClientOutstandingRequestsBreak()
        {
            var grain = HostedCluster.GrainFactory.GetGrain <ILongRunningTaskGrain <bool> >(Guid.NewGuid());
            var task  = grain.LongRunningTask(true, TimeSpan.FromSeconds(7));
            await Task.Delay(500);

            HostedCluster.KillSilo(HostedCluster.SecondarySilos[0]);
            HostedCluster.KillSilo(HostedCluster.Primary);

            await Assert.ThrowsAsync <SiloUnavailableException>(() => task);
        }
Esempio n. 3
0
        public async Task SiloUngracefulShutdown_OutstandingRequestsBreak()
        {
            var grain = await GetGrainOnTargetSilo(HostedCluster.Primary);

            Assert.NotNull(grain);
            var target = await GetGrainOnTargetSilo(HostedCluster.SecondarySilos[0]);

            Assert.NotNull(target);

            var promise = grain.CallOtherLongRunningTask(target, true, TimeSpan.FromSeconds(7));

            await Task.Delay(500);

            HostedCluster.KillSilo(HostedCluster.SecondarySilos[0]);

            await Assert.ThrowsAsync <SiloUnavailableException>(() => promise);
        }
Esempio n. 4
0
        public async Task SiloUngracefulShutdown_ClientOutstandingRequestsBreak()
        {
            var grain = HostedCluster.GrainFactory.GetGrain <ILongRunningTaskGrain <bool> >(Guid.NewGuid());
            var task  = grain.LongRunningTask(true, TimeSpan.FromSeconds(7));
            await Task.Delay(500);

            HostedCluster.KillSilo(HostedCluster.SecondarySilos[0]);
            HostedCluster.KillSilo(HostedCluster.Primary);
            try
            {
                await task;
                Assert.True(false, "The broken promise exception was not thrown");
            }
            catch (Exception ex)
            {
                Assert.Equal(typeof(SiloUnavailableException), ex.GetBaseException().GetType());
            }
        }