public async Task Rem_Azure_GT_Basic()
        {
            log.Info(TestContext.TestName);
            IReminderTestGrain2    g1 = GrainClient.GrainFactory.GetGrain <IReminderTestGrain2>(Guid.NewGuid());
            IReminderTestCopyGrain g2 = GrainClient.GrainFactory.GetGrain <IReminderTestCopyGrain>(Guid.NewGuid());
            TimeSpan period           = await g1.GetReminderPeriod(DR); // using same period

            await g1.StartReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            await g2.StartReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            long last1 = await g1.GetCounter(DR);

            Assert.AreEqual(4, last1, string.Format("{0} Grain fault", Time()));
            long last2 = await g2.GetCounter(DR);

            Assert.AreEqual(2, last2, string.Format("{0} CopyGrain fault", Time()));

            await g1.StopReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            await g2.StopReminder(DR);

            long curr1 = await g1.GetCounter(DR);

            Assert.AreEqual(last1, curr1, string.Format("{0} Grain fault", Time()));
            long curr2 = await g2.GetCounter(DR);

            Assert.AreEqual(4, curr2, string.Format("{0} CopyGrain fault", Time()));
        }
Beispiel #2
0
        public async Task Rem_Azure_GT_Basic()
        {
            IReminderTestGrain2    g1 = this.GrainFactory.GetGrain <IReminderTestGrain2>(Guid.NewGuid());
            IReminderTestCopyGrain g2 = this.GrainFactory.GetGrain <IReminderTestCopyGrain>(Guid.NewGuid());
            TimeSpan period           = await g1.GetReminderPeriod(DR); // using same period

            await g1.StartReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            await g2.StartReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            long last1 = await g1.GetCounter(DR);

            Assert.Equal(4, last1);
            long last2 = await g2.GetCounter(DR);

            Assert.Equal(2, last2); // CopyGrain fault

            await g1.StopReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            await g2.StopReminder(DR);

            long curr1 = await g1.GetCounter(DR);

            Assert.Equal(last1, curr1);
            long curr2 = await g2.GetCounter(DR);

            Assert.Equal(4, curr2); // CopyGrain fault
        }
Beispiel #3
0
        protected async Task <bool> PerCopyGrainFailureTest(IReminderTestCopyGrain grain)
        {
            TimeSpan period = await grain.GetReminderPeriod(DR);

            await grain.StartReminder(DR);

            Thread.Sleep(period.Multiply(failCheckAfter) + LEEWAY); // giving some leeway
            long last = await grain.GetCounter(DR);

            Assert.AreEqual(failCheckAfter, last);  // "{0} CopyGrain {1} Reminder {2}" // Time(), grain.GetPrimaryKey(), DR);

            await grain.StopReminder(DR);

            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            long curr = await grain.GetCounter(DR);

            Assert.AreEqual(last, curr); // "{0} CopyGrain {1} Reminder {2}", Time(), grain.GetPrimaryKey(), DR);

            return(true);
        }
Beispiel #4
0
        protected async Task <bool> PerCopyGrainFailureTest(IReminderTestCopyGrain grain)
        {
            TimeSpan period = await grain.GetReminderPeriod(DR);

            this.log.LogInformation("PerCopyGrainFailureTest Period={Period} Grain={Grain}", period, grain);

            await grain.StartReminder(DR);

            await Task.Delay(period.Multiply(failCheckAfter) + LEEWAY); // giving some leeway

            long last = await grain.GetCounter(DR);

            Assert.Equal(failCheckAfter, last);    // "{0} CopyGrain {1} Reminder {2}" // Time(), grain.GetPrimaryKey(), DR);

            await grain.StopReminder(DR);

            await Task.Delay(period.Multiply(2) + LEEWAY); // giving some leeway

            long curr = await grain.GetCounter(DR);

            Assert.Equal(last, curr);  // "{0} CopyGrain {1} Reminder {2}", Time(), grain.GetPrimaryKey(), DR);

            return(true);
        }
Beispiel #5
0
        protected async Task<bool> PerCopyGrainFailureTest(IReminderTestCopyGrain grain)
        {
            TimeSpan period = await grain.GetReminderPeriod(DR);

            logger.Info("PerCopyGrainFailureTest Period={0} Grain={1}", period, grain);

            await grain.StartReminder(DR);
            Thread.Sleep(period.Multiply(failCheckAfter) + LEEWAY); // giving some leeway
            long last = await grain.GetCounter(DR);
            Assert.AreEqual(failCheckAfter, last, "{0} CopyGrain {1} Reminder {2}", Time(), grain.GetPrimaryKey(), DR);

            await grain.StopReminder(DR);
            Thread.Sleep(period.Multiply(2) + LEEWAY); // giving some leeway
            long curr = await grain.GetCounter(DR);
            Assert.AreEqual(last, curr, "{0} CopyGrain {1} Reminder {2}", Time(), grain.GetPrimaryKey(), DR);

            return true;
        }