Esempio n. 1
0
 protected MiniNode <TLogFormat, TStreamId> CreateNode()
 {
     _projectionsSubsystem     = new ProjectionsSubsystem(new ProjectionSubsystemOptions(1, ProjectionType.All, false, TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault), Opts.FaultOutOfOrderProjectionsDefault, 500, 250));
     _systemProjectionsCreated = SystemProjections.Created(_projectionsSubsystem.LeaderMainBus);
     return(new MiniNode <TLogFormat, TStreamId>(
                PathName, inMemDb: true,
                subsystems: new ISubsystem[] { _projectionsSubsystem }));
 }
Esempio n. 2
0
        public override async Task TestFixtureSetUp()
        {
            await base.TestFixtureSetUp();

#if (!DEBUG)
            Assert.Ignore("These tests require DEBUG conditional");
#else
            var projectionWorkerThreadCount = GivenWorkerThreadCount();
            _projections = new ProjectionsSubsystem(projectionWorkerThreadCount, runProjections: ProjectionType.All,
                                                    startStandardProjections: false,
                                                    projectionQueryExpiry: TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault),
                                                    faultOutOfOrderProjections: Opts.FaultOutOfOrderProjectionsDefault);
            _node = new MiniNode <TLogFormat, TStreamId>(
                PathName, inMemDb: true,
                subsystems: new ISubsystem[] { _projections });
            _projectionsCreated = SystemProjections.Created(_projections.LeaderMainBus);

            await _node.Start();

            _conn = EventStoreConnection.Create(new ConnectionSettingsBuilder()
                                                .DisableServerCertificateValidation()
                                                .Build(), _node.TcpEndPoint);
            await _conn.ConnectAsync();

            _manager = new ProjectionsManager(
                new ConsoleLogger(),
                _node.HttpEndPoint,
                TimeSpan.FromMilliseconds(20000),
                _node.HttpMessageHandler);

            _queryManager = new QueryManager(
                new ConsoleLogger(),
                _node.HttpEndPoint,
                TimeSpan.FromMilliseconds(20000),
                TimeSpan.FromMilliseconds(20000),
                _node.HttpMessageHandler);

            WaitIdle();

            if (GivenStandardProjectionsRunning())
            {
                await EnableStandardProjections();
            }

            WaitIdle();
            try {
                await Given().WithTimeout(TimeSpan.FromSeconds(10));
            } catch (Exception ex) {
                throw new Exception("Given Failed", ex);
            }

            try {
                await When().WithTimeout(TimeSpan.FromSeconds(10));
            } catch (Exception ex) {
                throw new Exception("When Failed", ex);
            }
#endif
        }
Esempio n. 3
0
 protected MiniNode CreateNode()
 {
     _projectionsSubsystem = new ProjectionsSubsystem(1, runProjections: ProjectionType.All,
                                                      startStandardProjections: false,
                                                      projectionQueryExpiry: TimeSpan.FromMinutes(Opts.ProjectionsQueryExpiryDefault),
                                                      faultOutOfOrderProjections: Opts.FaultOutOfOrderProjectionsDefault);
     _systemProjectionsCreated = SystemProjections.Created(_projectionsSubsystem.LeaderMainBus);
     return(new MiniNode(
                PathName, inMemDb: true, skipInitializeStandardUsersCheck: false,
                subsystems: new ISubsystem[] { _projectionsSubsystem }));
 }
Esempio n. 4
0
        public override async Task TestFixtureSetUp()
        {
            await base.TestFixtureSetUp();

#if (!DEBUG)
            Assert.Ignore("These tests require DEBUG conditional");
#else
            _nodeEndpoints[0] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));
            _nodeEndpoints[1] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));
            _nodeEndpoints[2] = new Endpoints(
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback),
                PortsHelper.GetAvailablePort(IPAddress.Loopback), PortsHelper.GetAvailablePort(IPAddress.Loopback));

            _nodes[0] = CreateNode(0,
                                   _nodeEndpoints[0], new[] { _nodeEndpoints[1].InternalHttp, _nodeEndpoints[2].InternalHttp });
            _nodes[1] = CreateNode(1,
                                   _nodeEndpoints[1], new[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[2].InternalHttp });
            _nodes[2] = CreateNode(2,
                                   _nodeEndpoints[2], new[] { _nodeEndpoints[0].InternalHttp, _nodeEndpoints[1].InternalHttp });
            WaitIdle();

            var projectionsStarted = _projections.Select(p => SystemProjections.Created(p.LeaderMainBus)).ToArray();

            foreach (var node in _nodes)
            {
                node.Start();
                node.WaitIdle();
            }

            await Task.WhenAll(_nodes.Select(x => x.Started)).WithTimeout(TimeSpan.FromSeconds(30));

            _conn = EventStoreConnection.Create(_nodes[0].ExternalTcpEndPoint);
            await _conn.ConnectAsync().WithTimeout();

            _manager = new ProjectionsManager(
                new ConsoleLogger(),
                _nodes.Single(x => x.NodeState == VNodeState.Leader).ExternalHttpEndPoint,
                TimeSpan.FromMilliseconds(10000));

            if (GivenStandardProjectionsRunning())
            {
                await Task.WhenAny(projectionsStarted).WithTimeout(TimeSpan.FromSeconds(10));
                await EnableStandardProjections().WithTimeout(TimeSpan.FromMinutes(2));
            }

            WaitIdle();

            try {
                await Given().WithTimeout();
            } catch (Exception ex) {
                throw new Exception("Given Failed", ex);
            }

            try {
                await When().WithTimeout();
            } catch (Exception ex) {
                throw new Exception("When Failed", ex);
            }
#endif
        }