MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestKVSetConditionUnmetReturnsFalse

Function TestKVSetConditionUnmetReturnsFalse

internal/home/client_test.go:238–253  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

236}
237
238func TestKVSetConditionUnmetReturnsFalse(t *testing.T) {
239 client, _ := newRedisCommandTestClient(t, func(args []string) string {
240 if len(args) > 0 && strings.EqualFold(args[0], "SET") {
241 return "$-1\r\n"
242 }
243 return "-ERR unexpected command\r\n"
244 })
245
246 written, errSet := client.KVSet(context.Background(), "key", []byte("value"), KVSetOptions{NX: true})
247 if errSet != nil {
248 t.Fatalf("KVSet() error = %v", errSet)
249 }
250 if written {
251 t.Fatalf("KVSet() written = true, want false")
252 }
253}
254
255func TestKVMSetUsesStableKeyOrder(t *testing.T) {
256 client, commands := newRedisCommandTestClient(t, func(args []string) string {

Callers

nothing calls this directly

Calls 2

KVSetMethod · 0.65

Tested by

no test coverage detected