diff --git a/README.md b/README.md index 98c2c9e7bf..04b5de3eb8 100644 --- a/README.md +++ b/README.md @@ -54,7 +54,7 @@ Install-Package AspNetCore.HealthChecks.EventStore Install-Package AspNetCore.HealthChecks.AzureStorage Install-Package AspNetCore.HealthChecks.AzureServiceBus Install-Package AspNetCore.HealthChecks.AzureKeyVault -Install-Package AspNetCore.HealthChecks.AzureIoTHub +Install-Package AspNetCore.HealthChecks.Azure.IoTHub Install-Package AspNetCore.HealthChecks.MySql Install-Package AspNetCore.HealthChecks.DocumentDb Install-Package AspNetCore.HealthChecks.SqLite diff --git a/build/dependencies.props b/build/dependencies.props index 9206f210f6..2ead1a2db8 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -85,7 +85,7 @@ 3.0.0 3.0.0 3.0.0 - 3.0.2 + 3.0.3 3.0.0 3.0.0 3.0.0 diff --git a/src/HealthChecks.RabbitMQ/RabbitMQHealthCheck.cs b/src/HealthChecks.RabbitMQ/RabbitMQHealthCheck.cs index 2e30bf05fb..eca5c73890 100755 --- a/src/HealthChecks.RabbitMQ/RabbitMQHealthCheck.cs +++ b/src/HealthChecks.RabbitMQ/RabbitMQHealthCheck.cs @@ -19,7 +19,7 @@ public RabbitMQHealthCheck(string rabbitMqConnectionString, SslOption sslOption _lazyConnectionFactory = new Lazy(() => new ConnectionFactory() { Uri = new Uri(rabbitMqConnectionString), - Ssl = sslOption + Ssl = sslOption ?? new SslOption() }); } diff --git a/src/HealthChecks.UI/package-lock.json b/src/HealthChecks.UI/package-lock.json index 9020576535..2b7b9e2957 100644 --- a/src/HealthChecks.UI/package-lock.json +++ b/src/HealthChecks.UI/package-lock.json @@ -1679,8 +1679,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -1701,14 +1700,12 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -1723,20 +1720,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -1853,8 +1847,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -1866,7 +1859,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -1881,7 +1873,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -1889,14 +1880,12 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, - "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -1915,7 +1904,6 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } @@ -1996,8 +1984,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -2009,7 +1996,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -2095,8 +2081,7 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -2132,7 +2117,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -2152,7 +2136,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -2196,14 +2179,12 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, diff --git a/test/FunctionalTests/HealthChecks.RabbitMQ/RabbitMQHealthCheckTests.cs b/test/FunctionalTests/HealthChecks.RabbitMQ/RabbitMQHealthCheckTests.cs index 00412c4a14..a7a951f907 100644 --- a/test/FunctionalTests/HealthChecks.RabbitMQ/RabbitMQHealthCheckTests.cs +++ b/test/FunctionalTests/HealthChecks.RabbitMQ/RabbitMQHealthCheckTests.cs @@ -33,7 +33,9 @@ public async Task be_healthy_if_rabbitmq_is_available() .ConfigureServices(services => { services.AddHealthChecks() - .AddRabbitMQ(connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(rabbitMQConnectionString: connectionString, tags: new string[] { "rabbitmq" }); + //services.AddHealthChecks() + // .AddRabbitMQ(connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: new string[] { "rabbitmq" }); }) .Configure(app => { @@ -89,7 +91,7 @@ public async Task be_healthy_if_rabbitmq_is_available_using_iconnectionfactory() { Uri = new Uri(connectionString), AutomaticRecoveryEnabled = true, - Ssl= new SslOption(serverName: "localhost", enabled: false) + Ssl = new SslOption(serverName: "localhost", enabled: false) }; var webHostBuilder = new WebHostBuilder() @@ -98,7 +100,7 @@ public async Task be_healthy_if_rabbitmq_is_available_using_iconnectionfactory() { services .AddHealthChecks() - .AddRabbitMQ(sp=>factory, tags: new string[] { "rabbitmq" }); + .AddRabbitMQ(sp => factory, tags: new string[] { "rabbitmq" }); }) .Configure(app => { @@ -156,5 +158,34 @@ public async Task be_healthy_if_rabbitmq_is_available_using_iconnection() response.StatusCode .Should().Be(HttpStatusCode.OK); } + + [SkipOnAppVeyor] + public async Task be_healthy_if_rabbitmq_is_available_and_specify_default_ssloption() + { + var connectionString = @"amqp://localhost:5672"; + + var webHostBuilder = new WebHostBuilder() + .UseStartup() + .ConfigureServices(services => + { + services.AddHealthChecks() + .AddRabbitMQ(connectionString, sslOption: new SslOption(serverName: "localhost", enabled: false), tags: new string[] { "rabbitmq" }); + }) + .Configure(app => + { + app.UseHealthChecks("/health", new HealthCheckOptions() + { + Predicate = r => r.Tags.Contains("rabbitmq") + }); + }); + + var server = new TestServer(webHostBuilder); + + var response = await server.CreateRequest($"/health") + .GetAsync(); + + response.StatusCode + .Should().Be(HttpStatusCode.OK); + } } }