From e3c231a9d3f0d3344f44c0195c13c497ff1fa627 Mon Sep 17 00:00:00 2001 From: Anton Berezhnyi Date: Sun, 15 Oct 2023 16:58:19 +0300 Subject: [PATCH] Add test for metrics init --- app_test.go | 4 ++++ go.mod | 4 ++-- go.sum | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app_test.go b/app_test.go index 1da96c1..c00ace6 100644 --- a/app_test.go +++ b/app_test.go @@ -3,6 +3,7 @@ package main import ( "bytes" "errors" + victoriaMetricsInit "github.com/kneu-messenger-pigeon/victoria-metrics-init" "github.com/stretchr/testify/assert" "net/http" "os" @@ -30,6 +31,9 @@ func TestRunApp(t *testing.T) { assert.NoError(t, err, "Expected for TooManyError, got %s", err) assert.Equal(t, expectedConfig.listenAddress, actualListen) + + assert.Equal(t, "authorizer", victoriaMetricsInit.LastInstance) + }) t.Run("Run with wrong env file", func(t *testing.T) { diff --git a/go.mod b/go.mod index b857b63..f0e727f 100644 --- a/go.mod +++ b/go.mod @@ -3,18 +3,18 @@ module authorizer go 1.19 require ( + github.com/VictoriaMetrics/metrics v1.24.0 github.com/berejant/go-kneu v0.1.7 github.com/gin-gonic/gin v1.8.2 github.com/golang-jwt/jwt/v5 v5.0.0-rc.1 github.com/joho/godotenv v1.4.0 github.com/kneu-messenger-pigeon/events v0.1.41 - github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.1 + github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.2 github.com/segmentio/kafka-go v0.4.38 github.com/stretchr/testify v1.8.4 ) require ( - github.com/VictoriaMetrics/metrics v1.24.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.0 // indirect diff --git a/go.sum b/go.sum index 6bfe92f..1777d32 100644 --- a/go.sum +++ b/go.sum @@ -36,8 +36,8 @@ github.com/klauspost/compress v1.15.9 h1:wKRjX6JRtDdrE9qwa4b/Cip7ACOshUI4smpCQan github.com/klauspost/compress v1.15.9/go.mod h1:PhcZ0MbTNciWF3rruxRgKxI5NkcHHrHUDtV4Yw2GlzU= github.com/kneu-messenger-pigeon/events v0.1.41 h1:Yzzp7oyVArzKzzI93HmLX+k3lUn8E3dKUk9uNF3le+8= github.com/kneu-messenger-pigeon/events v0.1.41/go.mod h1:Q6X8B9gKZpKbby9gisLumvGT1xCWBM7bAFnviYi6MBQ= -github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.1 h1:ndU8DvMAnaMZIZ+hLKaQCTNGcRBBQpvRZ/7CtE/UXu0= -github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.1/go.mod h1:HxDZwQUrMLgZNdLFT1llblZ7Zj6EBpBk7+9tcU4NZCk= +github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.2 h1:jtKQpIefoZBJzgniS4+wM/HU+IgAPkhdOZa4B52RZA0= +github.com/kneu-messenger-pigeon/victoria-metrics-init v0.1.2/go.mod h1:HxDZwQUrMLgZNdLFT1llblZ7Zj6EBpBk7+9tcU4NZCk= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=