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).
This commit is contained in:
shubhamrasal
2026-05-12 16:16:38 +05:30
parent 642887e985
commit d5d9eed0e3
+1 -8
View File
@@ -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()