From 1aa60a798428f19257e763e75a7d845a83276c31 Mon Sep 17 00:00:00 2001 From: Aryan Mehrotra <44036979+aryanmehrotra@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:11:56 +0530 Subject: [PATCH 1/3] Fix Nil Logger in Migrations (#905) --- pkg/gofr/migration/migration.go | 1 + pkg/gofr/migration/migration_test.go | 3 +++ 2 files changed, 4 insertions(+) diff --git a/pkg/gofr/migration/migration.go b/pkg/gofr/migration/migration.go index bb7f6a09b..aa9e30732 100644 --- a/pkg/gofr/migration/migration.go +++ b/pkg/gofr/migration/migration.go @@ -36,6 +36,7 @@ func Run(migrationsMap map[int64]Migrate, c *container.Container) { sortkeys.Int64s(keys) ds, mg, ok := getMigrator(c) + ds.Logger = c.Logger // Returning with an error log as migration would eventually fail as No databases are initialized. // Pub/Sub is considered as initialized if its configurations are given. diff --git a/pkg/gofr/migration/migration_test.go b/pkg/gofr/migration/migration_test.go index 6115dae87..5a7d3c20c 100644 --- a/pkg/gofr/migration/migration_test.go +++ b/pkg/gofr/migration/migration_test.go @@ -81,6 +81,8 @@ func TestMigrationRunClickhouseSuccess(t *testing.T) { return err } + d.Logger.Infof("Clickhouse Migration Ran Successfully") + return nil }}, } @@ -97,6 +99,7 @@ func TestMigrationRunClickhouseSuccess(t *testing.T) { }) assert.Contains(t, logs, "Migration 1 ran successfully") + assert.Contains(t, logs, "Clickhouse Migration Ran Successfully") } func TestMigrationRunClickhouseMigrationFailure(t *testing.T) { From 894a56a8f0366ce18ca5adb3d5402a6ece688676 Mon Sep 17 00:00:00 2001 From: Srijan Rastogi <44723623+srijan-27@users.noreply.github.com> Date: Tue, 6 Aug 2024 13:51:07 +0530 Subject: [PATCH 2/3] fix config validation for tracer (#901) --- pkg/gofr/gofr.go | 5 +++++ pkg/gofr/gofr_test.go | 1 + 2 files changed, 6 insertions(+) diff --git a/pkg/gofr/gofr.go b/pkg/gofr/gofr.go index 9c1005c93..1c08dfa85 100644 --- a/pkg/gofr/gofr.go +++ b/pkg/gofr/gofr.go @@ -408,6 +408,11 @@ func (a *App) initTracer() { } func isValidConfig(logger logging.Logger, name, url, host, port string) bool { + if url == "" && name == "" { + logger.Debug("tracing is disabled, as configs are not provided") + return false + } + if url != "" && name == "" { logger.Error("missing TRACE_EXPORTER config, should be provided with TRACER_URL to enable tracing") return false diff --git a/pkg/gofr/gofr_test.go b/pkg/gofr/gofr_test.go index 11cf91c04..0fd3e0f75 100644 --- a/pkg/gofr/gofr_test.go +++ b/pkg/gofr/gofr_test.go @@ -350,6 +350,7 @@ func Test_initTracer(t *testing.T) { config config.Config expectedLogMessage string }{ + {"tracing disabled", config.NewMockConfig(nil), "tracing is disabled"}, {"zipkin exporter", mockConfig1, "Exporting traces to zipkin at http://localhost:2005/api/v2/spans"}, {"zipkin exporter with authkey", mockConfig2, "Exporting traces to zipkin at http://localhost:2005/api/v2/spans"}, {"jaeger exporter", mockConfig3, "Exporting traces to jaeger at localhost:4317"}, From d2b903870e9abb3fbfb31a0969637dc0ae73d688 Mon Sep 17 00:00:00 2001 From: srijan-27 Date: Tue, 6 Aug 2024 17:28:49 +0530 Subject: [PATCH 3/3] update framework version --- pkg/gofr/version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/gofr/version/version.go b/pkg/gofr/version/version.go index ba703787c..a40d93fba 100644 --- a/pkg/gofr/version/version.go +++ b/pkg/gofr/version/version.go @@ -1,3 +1,3 @@ package version -const Framework = "v1.16.0" +const Framework = "v1.16.1"