Exemple #1
0
        public void WithInMemoryServer_InvalidPort_ServerStartFails()
        {
            var nextFreeTcpPort = TcpPortHelper.NextFreeTcpPort();

            // intentionally block port
            var listener = new TcpListener(IPAddress.Any, nextFreeTcpPort);

            listener.Start();

            var backendAddress = "http://*****:*****@"c:\windows\System32\cmd.exe";
            });

            var server = builder.Create();

            try
            {
                server.Start();
            }
            catch
            {
                // ignored
            }

            Assert.IsNotNull(listener);
            Assert.AreEqual(JobbrState.Error, server.State, "The server should be in error state if a component didn't start");
        }
Exemple #2
0
        public void BackChannel_StartedTwice_RaisesException()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort()
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();
            host.Start();
        }
Exemple #3
0
        public void BackChannel_StartWebHost_StatusUrlIsAvailable()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort()
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();

            var response = new HttpClient().GetAsync(forkedExecutionConfiguration.BackendAddress + "/fex/status").Result;

            Assert.IsTrue(response.IsSuccessStatusCode);
        }
Exemple #4
0
        public void BackChannel_PortInUse_RaisesException()
        {
            var nextFreeTcpPort = TcpPortHelper.NextFreeTcpPort();

            // intentionally block port
            new TcpListener(IPAddress.Any, nextFreeTcpPort).Start();


            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + nextFreeTcpPort
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();
        }
Exemple #5
0
        public void WithInMemoryServer_ServerHasStarted_StatusEndpointIsAvailable()
        {
            var backendAddress = "http://*****:*****@"c:\windows\System32\cmd.exe";
            });

            var server = builder.Create();

            server.Start();

            var statusResponse = new HttpClient().GetAsync(backendAddress + "/fex/status").Result;

            Assert.AreEqual(HttpStatusCode.OK, statusResponse.StatusCode);
        }
Exemple #6
0
        public async Task BackChannel_AfterDisposal_IsNotAvailable()
        {
            var forkedExecutionConfiguration = new ForkedExecutionConfiguration
            {
                BackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort()
            };

            var host = new BackChannelWebHost(new JobbrServiceProviderMock(null, null), forkedExecutionConfiguration);

            host.Start();
            host.Dispose();
            try
            {
                await new HttpClient().GetAsync(forkedExecutionConfiguration.BackendAddress + "/fex/status");
            }
            catch (Exception ex)
            {
                if (ex.InnerException is WebException == false)
                {
                    Assert.Fail("Exception thrown was " + ex.InnerException + ", which is not the expected exception");
                }
            }
        }
 public EndpointTests()
 {
     this.configBackendAddress = "http://localhost:" + TcpPortHelper.NextFreeTcpPort();
 }