From e8d8ed0d2d0c0e9cf9af875e33758eae877844aa Mon Sep 17 00:00:00 2001 From: lghiur Date: Fri, 11 Jul 2025 15:45:15 +0300 Subject: [PATCH] Revert "[TT-9234] regression fixes for failing mdcb readiness check (#7215)" This reverts commit a564981b4d2eb0940f03313424c51d38572d4d39. --- gateway/health_check.go | 4 ++-- gateway/health_check_test.go | 38 ------------------------------------ 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/gateway/health_check.go b/gateway/health_check.go index 539dbdf6837..5314a8fde39 100644 --- a/gateway/health_check.go +++ b/gateway/health_check.go @@ -301,8 +301,8 @@ func (gw *Gateway) isCriticalFailure(component string) bool { return true } - // Consider RPC critical only if using RPC and gw not in emergency mode - if component == "rpc" && gw.GetConfig().Policies.PolicySource == "rpc" && !rpc.IsEmergencyMode() { + // Consider RPC critical only if using RPC + if component == "rpc" && gw.GetConfig().Policies.PolicySource == "rpc" { return true } diff --git a/gateway/health_check_test.go b/gateway/health_check_test.go index 5bafc36e54b..e1b6ab28642 100644 --- a/gateway/health_check_test.go +++ b/gateway/health_check_test.go @@ -12,7 +12,6 @@ import ( "github.com/TykTechnologies/tyk/apidef" "github.com/TykTechnologies/tyk/config" - "github.com/TykTechnologies/tyk/rpc" "github.com/TykTechnologies/tyk/storage" ) @@ -355,7 +354,6 @@ func TestGateway_isCriticalFailure(t *testing.T) { component string check HealthCheckItem setupConfig func(*config.Config) - setupFunc func(*testing.T) expectedResult bool }{ { @@ -458,36 +456,6 @@ func TestGateway_isCriticalFailure(t *testing.T) { }, expectedResult: true, // Critical based on component and config, not status }, - { - name: "rpc component is NOT critical when PolicySource is rpc but in emergency mode", - component: "rpc", - check: HealthCheckItem{ - Status: Fail, - ComponentType: System, - }, - setupConfig: func(conf *config.Config) { - conf.Policies.PolicySource = "rpc" - }, - setupFunc: func(t *testing.T) { - rpc.SetEmergencyMode(t, true) - }, - expectedResult: false, - }, - { - name: "rpc component is critical when PolicySource is rpc and NOT in emergency mode", - component: "rpc", - check: HealthCheckItem{ - Status: Fail, - ComponentType: System, - }, - setupConfig: func(conf *config.Config) { - conf.Policies.PolicySource = "rpc" - }, - setupFunc: func(t *testing.T) { - rpc.SetEmergencyMode(t, false) - }, - expectedResult: true, - }, } for _, tt := range tests { @@ -495,12 +463,6 @@ func TestGateway_isCriticalFailure(t *testing.T) { // Create a new gateway instance for each test conf := config.Config{} tt.setupConfig(&conf) - - // Setup emergency mode if needed - if tt.setupFunc != nil { - tt.setupFunc(t) - } - gw := NewGateway(conf, nil) // Call the function under test