Example #1
0
        public async Task CanWaitForActivation()
        {
            var activator = GetFakeActivator();
            var timeout   = CancellationTokens.WithTimeout(15 * 1000);
            var identity  = new ClusterIdentity {
                Kind = "thing", Identity = NextId().ToString()
            };
            var spawnLock = await _storage.TryAcquireLock(identity, timeout);

            var pid = Activate(activator, identity);

            _ = SafeTask.Run(async() => {
                await Task.Delay(500, timeout);
                await _storage.StoreActivation(activator.Id, spawnLock !, pid, timeout);
            }, timeout
                             );
            var activation = await _storage.WaitForActivation(identity, timeout);

            activation.Should().NotBeNull();
            activation !.MemberId.Should().Be(activator.Id);
            activation !.Pid.Should().BeEquivalentTo(pid);
        }