MCPcopy Index your code
hub / github.com/ContentSquare/chproxy / TestKeyString

Function TestKeyString

cache/key_test.go:8–117  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func TestKeyString(t *testing.T) {
9 testCases := []struct {
10 key *Key
11 expected string
12 }{
13 {
14 key: &Key{
15 Query: []byte("SELECT 1 FROM system.numbers LIMIT 10"),
16 Version: 2,
17 },
18 expected: "4e3e71f4d94f34b6c8cab4888486a116",
19 },
20 {
21 key: &Key{
22 Query: []byte("SELECT 1 FROM system.numbers LIMIT 10"),
23 AcceptEncoding: "gzip",
24 Version: 2,
25 },
26 expected: "ba19aeff43f8cd4440a28f883201f342",
27 },
28 {
29 key: &Key{
30 Query: []byte("SELECT 1 FROM system.numbers LIMIT 10"),
31 AcceptEncoding: "gzip",
32 DefaultFormat: "JSON",
33 Version: 2,
34 },
35 expected: "341b43e5ce0ceafb3f49664d9b124618",
36 },
37 {
38 key: &Key{
39 Query: []byte("SELECT 1 FROM system.numbers LIMIT 10"),
40 AcceptEncoding: "gzip",
41 DefaultFormat: "JSON",
42 Database: "foobar",
43 Version: 2,
44 },
45 expected: "bd864dd1d3dfec711f15830a0601a11e",
46 },
47 {
48 key: &Key{
49 Query: []byte("SELECT 1 FROM system.numbers LIMIT 10"),
50 AcceptEncoding: "gzip",
51 DefaultFormat: "JSON",
52 Database: "foobar",
53 Namespace: "ns123",
54 Version: 2,
55 },
56 expected: "04e932bafebeeb6b4c7c07288b37db3c",
57 },
58 {
59 key: &Key{
60 Query: []byte("SELECT 1 FROM system.numbers LIMIT 10"),
61 AcceptEncoding: "gzip",
62 DefaultFormat: "JSON",
63 Database: "foobar",
64 Compress: "1",
65 Namespace: "ns123",

Callers

nothing calls this directly

Calls 1

StringMethod · 0.45

Tested by

no test coverage detected