From d5d9eed0e387ebd6fb82ff99acefb5a166a8b189 Mon Sep 17 00:00:00 2001 From: shubhamrasal Date: Tue, 12 May 2026 16:16:38 +0530 Subject: [PATCH] test(sdk): drop DisableUpdateCheck() from new lib/config_test.go DisableUpdateCheck() mutates DefaultConfig process-globally. config_test.go files run alphabetically before sdk_test.go, so my tests were disabling the update-check globally and TestContextCancelNucleiEngine (which depends on template auto-install) was hitting an empty template store on first run. Drop the option from the seven test sites. First test in the binary now triggers template install (sync.Once gated; subsequent tests free). --- lib/config_test.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/lib/config_test.go b/lib/config_test.go index ac509915a..5b2c11922 100644 --- a/lib/config_test.go +++ b/lib/config_test.go @@ -29,7 +29,6 @@ rate-limit: 99 ne, err := NewNucleiEngine( WithConfigFile(cfgPath), - DisableUpdateCheck(), ) require.NoError(t, err) defer ne.Close() @@ -55,7 +54,6 @@ func TestWithConfigBytes(t *testing.T) { ne, err := NewNucleiEngine( WithConfigBytes(cfg), - DisableUpdateCheck(), ) require.NoError(t, err) defer ne.Close() @@ -74,7 +72,6 @@ func TestWithConfigFile_PreservesDefaults(t *testing.T) { ne, err := NewNucleiEngine( WithConfigFile(cfgPath), - DisableUpdateCheck(), ) require.NoError(t, err) defer ne.Close() @@ -94,7 +91,6 @@ func TestWithConfigFile_DoesNotClobberPriorOptions(t *testing.T) { ne, err := NewNucleiEngine( WithGlobalRateLimit(99, time.Second), WithConfigFile(cfgPath), - DisableUpdateCheck(), ) require.NoError(t, err) defer ne.Close() @@ -118,7 +114,6 @@ func TestWithReportingConfigFile(t *testing.T) { ne, err := NewNucleiEngine( WithReportingConfigFile(rcPath), - DisableUpdateCheck(), ) require.NoError(t, err) defer ne.Close() @@ -139,7 +134,6 @@ func TestWithReportingConfigBytes(t *testing.T) { `) ne, err := NewNucleiEngine( WithReportingConfigBytes(rc), - DisableUpdateCheck(), ) require.NoError(t, err) defer ne.Close() @@ -155,7 +149,6 @@ func TestWithReportingConfigBytes_InvalidYAML(t *testing.T) { rc := []byte("this: is: not: valid: yaml: ::::\n") _, err := NewNucleiEngine( WithReportingConfigBytes(rc), - DisableUpdateCheck(), ) require.Error(t, err) } @@ -163,7 +156,7 @@ func TestWithReportingConfigBytes_InvalidYAML(t *testing.T) { // ExecuteNucleiWithOpts must reject With* options gated on e.mode == threadSafe; // tmpEngine is built with mode=threadSafe in multi.go. func TestPerScanOptions_RejectIncompatibleOptions(t *testing.T) { - ne, err := NewThreadSafeNucleiEngineCtx(context.Background(), DisableUpdateCheck()) + ne, err := NewThreadSafeNucleiEngineCtx(context.Background()) require.NoError(t, err) defer ne.Close()