Пример #1
0
        public void OneSingleLocalHostNode()
        {
            var node = _localNodeSource.GetNodes().Single();

            node.Hostname.ShouldBe(Dns.GetHostName());
            node.Port.ShouldBeNull();
        }
Пример #2
0
        public async Task NodeAdded()
        {
            SetServiceVersion(Version);
            AddServiceNode();
            await Init();

            await AssertOneDefaultNode();

            AddServiceNode(Host2);
            await WaitForUpdates();

            var nodes = _nodeSource.GetNodes();

            nodes.Length.ShouldBe(2);
            nodes[1].Hostname.ShouldBe(Host2);
        }
Пример #3
0
        private void SetupSlowNodeSource()
        {
            _waitForSlowSourceCreation = new TaskCompletionSource <bool>();

            _slowNodeSource = Substitute.For <INodeSource>();
            _slowNodeSource.GetNodes().Returns(new Node[0]);

            _slowNodeSourceFactory = Substitute.For <INodeSourceFactory>();
            _slowNodeSourceFactory.Type.Returns(SlowSource);
            _slowNodeSourceFactory.IsServiceDeployed(Arg.Any <DeploymentIdentifier>()).Returns(true);
            _slowNodeSourceFactory.CreateNodeSource(Arg.Any <DeploymentIdentifier>())
            .Returns(async _ =>
            {
                _createdNodeSources.Add(typeof(INodeSource));
                await Task.WhenAny(_waitForSlowSourceCreation.Task, Task.Delay(5000));
                return(_slowNodeSource);
            });
        }
Пример #4
0
 private Node[] GetNodes()
 {
     return(_configNodeSource.GetNodes());
 }