Beispiel #1
0
        public async Task UserVerification_SiloDown_UserRegisteredWhenRestarted()
        {
            /*
             * Enable Verification service
             * Disable verification service
             * Send Registration
             * Assert that the state is pending
             * Switch on verification service
             * Assert that the state is verified
             */

            // Arrange
            await _registrationCluster.WaitForLivenessToStabilizeAsync();

            await _registrationStatusCluster.WaitForLivenessToStabilizeAsync();

            _verificationCluster = _testHelper.GenerateTestCluster <UserVerificationGrain>();
            await _verificationCluster.WaitForLivenessToStabilizeAsync();

            var userRegistrationGrain =
                _registrationCluster.Client.GetGrain <IUserRegistrationGrain>(_faker.Internet.Email());
            var userRegistrationKey =
                await userRegistrationGrain.RegisterAsync(_faker.Random.String2(5), _faker.Random.String2(5));

            await AssertRegistrationState(userRegistrationKey, UserRegistrationStatusEnum.Verified);

            await _verificationCluster.StopSiloAsync(_verificationCluster.Primary);

            var userRegistrationGrain1 =
                _registrationCluster.Client.GetGrain <IUserRegistrationGrain>(_faker.Internet.Email());
            var userRegistrationKey1 =
                await userRegistrationGrain1.RegisterAsync(_faker.Random.String2(5), _faker.Random.String2(5));

            await AssertRegistrationState(userRegistrationKey1, UserRegistrationStatusEnum.Pending);

            // Act
            // Build Verification Service
            await _verificationCluster.StartAdditionalSiloAsync();

            await _verificationCluster.WaitForLivenessToStabilizeAsync();

            // Assert
            await AssertRegistrationState(userRegistrationKey1, UserRegistrationStatusEnum.Verified);

            await _registrationCluster.StopAllSilosAsync();

            await _registrationStatusCluster.StopAllSilosAsync();

            await _verificationCluster.StopAllSilosAsync();
        }
        public async Task Should_not_send_message_to_dead_member()
        {
            await _cluster.StopSiloAsync(_cluster.Silos[1]);

            await PublishAsync(2, _key);
        }