From 5f940af8ed762e99177d004df2e594d05a9c8422 Mon Sep 17 00:00:00 2001 From: Bruno Brito Date: Fri, 29 Mar 2019 04:27:44 -0300 Subject: [PATCH] tests step for yaml healthcheck clean --- appveyor.yml | 9 +++++++-- azure-pipelines.yml | 4 ++++ src/Frontend/Jp.UI.SSO/Configuration/DbHealthChecker.cs | 4 ++-- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c053e376..9178b379 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,10 +1,11 @@ -version: 1.0.{build} +version: 1.2.{build} image: Visual Studio 2017 branches: only: - master pull_requests: do_not_increment_build_number: true + init: # Good practice, because Windows line endings are different from Unix/Linux ones - cmd: git config --global core.autocrlf true @@ -13,5 +14,9 @@ before_build: - cmd: dotnet --version # Display minimal restore text - cmd: dotnet restore ./src --verbosity m + build_script: - - cmd: dotnet build ./src \ No newline at end of file + - cmd: dotnet build ./src + +test_script: + - cmd: dotnet test ./src \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index b4b904f9..9c957e4b 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,3 +12,7 @@ variables: steps: - script: dotnet build ./src --configuration $(buildConfiguration) displayName: 'dotnet build $(buildConfiguration)' + +- script: dotnet test ./src + displayName: 'Running tests' + diff --git a/src/Frontend/Jp.UI.SSO/Configuration/DbHealthChecker.cs b/src/Frontend/Jp.UI.SSO/Configuration/DbHealthChecker.cs index dc1fdf1b..f2bf4b56 100644 --- a/src/Frontend/Jp.UI.SSO/Configuration/DbHealthChecker.cs +++ b/src/Frontend/Jp.UI.SSO/Configuration/DbHealthChecker.cs @@ -11,11 +11,11 @@ public bool TestConnection(DbContext context) try { - var testDb = context.Database.GetPendingMigrations(); // Check the database connection + context.Database.GetPendingMigrations(); // Check the database connection return true; } - catch (Exception ex) + catch { return false; }