Files
zzet--gortex/internal/indexer/external_call_synthesis_test.go
wehub-resource-sync a06f331eb8
CI / benchmark (push) Has been skipped
install-script / posix-syntax (push) Successful in 6m1s
CI / build-onnx (push) Failing after 6m43s
init-smoke / dry-run (push) Failing after 15m57s
security / govulncheck (push) Has been cancelled
security / trivy-fs (push) Has been cancelled
CI / test (1.26, ubuntu-latest) (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
CI / test (1.26, macos-latest) (push) Has been cancelled
CI / build-windows (push) Has been cancelled
CI / lint (push) Has been cancelled
install-script / powershell-syntax (push) Has been cancelled
install-script / install (macos-14) (push) Has been cancelled
install-script / install (ubuntu-latest) (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:33:42 +08:00

34 lines
962 B
Go

package indexer
import (
"testing"
"github.com/stretchr/testify/require"
"github.com/zzet/gortex/internal/graph"
)
func TestExternalCallSynthesisEnabled_EnvOverride(t *testing.T) {
g := graph.New()
idx := newTestIndexer(g)
bptr := func(b bool) *bool { return &b }
// Default-on: key unset (nil) resolves to enabled.
require.True(t, idx.externalCallSynthesisEnabled())
// Explicit opt-out via config.
idx.config.SynthesizeExternalCalls = bptr(false)
require.False(t, idx.externalCallSynthesisEnabled())
// Explicit opt-in via config.
idx.config.SynthesizeExternalCalls = bptr(true)
require.True(t, idx.externalCallSynthesisEnabled())
t.Setenv("GORTEX_SYNTH_EXTERNAL_CALLS", "0")
require.False(t, idx.externalCallSynthesisEnabled()) // env overrides config-on
t.Setenv("GORTEX_SYNTH_EXTERNAL_CALLS", "1")
idx.config.SynthesizeExternalCalls = bptr(false)
require.True(t, idx.externalCallSynthesisEnabled()) // env overrides config-off
}