From 294130b3d0a1372d3e3db035bb10131791d291cc Mon Sep 17 00:00:00 2001 From: OZGCloud <ozgcloud@mgm-tp.com> Date: Thu, 24 Oct 2024 16:16:30 +0200 Subject: [PATCH] add go test in jenkinsfile --- Jenkinsfile | 11 +++++++++++ internal/config/config.go | 6 ++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index acac81a..f36238f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -82,6 +82,17 @@ tools { go 'go-1.22.0' } } } } + stage('Test antragraum-proxy') { + steps { + script { + FAILED_STAGE=env.STAGE_NAME + + sh ''' + go test ./internal/* + ''' + } + } + } stage('Build and publish Docker image') { steps { diff --git a/internal/config/config.go b/internal/config/config.go index ad387b0..49ecde6 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -59,7 +59,7 @@ type Config struct { } `yaml:"logging"` } -func LoadConfig() Config { +func LoadConfig(configFilePath ...string) Config { var config Config env := os.Getenv("APP_ENV") @@ -69,7 +69,9 @@ func LoadConfig() Config { fp := fmt.Sprintf("config/config-%s.yml", env) - if testing.Testing() { + if len(configFilePath) > 0 { + fp = configFilePath[0] + } else if testing.Testing() { fp = testFilePath } -- GitLab