MCPcopy
hub / github.com/olric-data/olric / TestProtocol_ParsePutCommand_PX

Function TestProtocol_ParsePutCommand_PX

internal/protocol/dmap_test.go:57–69  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

55}
56
57func TestProtocol_ParsePutCommand_PX(t *testing.T) {
58 putCmd := NewPut("my-dmap", "my-key", []byte("my-value"))
59 putCmd.SetPX((100 * time.Millisecond).Milliseconds())
60
61 cmd := stringToCommand(putCmd.Command(context.Background()).String())
62 parsed, err := ParsePutCommand(cmd)
63 require.NoError(t, err)
64
65 require.Equal(t, "my-dmap", parsed.DMap)
66 require.Equal(t, "my-key", parsed.Key)
67 require.Equal(t, []byte("my-value"), parsed.Value)
68 require.Equal(t, int64(100), parsed.PX)
69}
70
71func TestProtocol_ParsePutCommand_NX(t *testing.T) {
72 putCmd := NewPut("my-dmap", "my-key", []byte("my-value"))

Callers

nothing calls this directly

Calls 6

SetPXMethod · 0.95
CommandMethod · 0.95
NewPutFunction · 0.85
stringToCommandFunction · 0.85
ParsePutCommandFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected