MCPcopy
hub / github.com/redis/go-redis / fakeScripter

Struct fakeScripter

script_server_sha_unit_test.go:14–30  ·  view source on GitHub ↗

fakeScripter simulates enough of Scripter for unit testing Script behavior. It records which redis commands were invoked and can simulate NOSCRIPT.

Source from the content-addressed store, hash-verified

12// fakeScripter simulates enough of Scripter for unit testing Script behavior.
13// It records which redis commands were invoked and can simulate NOSCRIPT.
14type fakeScripter struct {
15 mu sync.Mutex
16
17 // call counters
18 scriptLoadCalls int
19 evalCalls int
20 evalShaCalls int
21 evalROCalls int
22 evalShaROCalls int
23
24 // behavior controls
25 hashToReturn string
26
27 // If set, the first EvalSha/EvalShaRO returns a NOSCRIPT error.
28 failFirstEvalShaWithNoScr bool
29 failFirstEvalShaROWithNoScr bool
30}
31
32func (f *fakeScripter) ScriptLoad(ctx context.Context, script string) *StringCmd {
33 f.mu.Lock()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected