MCPcopy
hub / github.com/etcd-io/etcd / TestNamespacePutGet

Function TestNamespacePutGet

tests/integration/clientv3/namespace_test.go:30–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

28)
29
30func TestNamespacePutGet(t *testing.T) {
31 integration2.BeforeTest(t)
32
33 clus := integration2.NewCluster(t, &integration2.ClusterConfig{Size: 1})
34 defer clus.Terminate(t)
35
36 c := clus.Client(0)
37 nsKV := namespace.NewKV(c.KV, "foo/")
38
39 _, err := nsKV.Put(context.TODO(), "abc", "bar")
40 require.NoError(t, err)
41 resp, err := nsKV.Get(context.TODO(), "abc")
42 require.NoError(t, err)
43 if string(resp.Kvs[0].Key) != "abc" {
44 t.Errorf("expected key=%q, got key=%q", "abc", resp.Kvs[0].Key)
45 }
46
47 resp, err = c.Get(context.TODO(), "foo/abc")
48 require.NoError(t, err)
49 if string(resp.Kvs[0].Value) != "bar" {
50 t.Errorf("expected value=%q, got value=%q", "bar", resp.Kvs[0].Value)
51 }
52}
53
54func TestNamespaceWatch(t *testing.T) {
55 integration2.BeforeTest(t)

Callers

nothing calls this directly

Calls 8

TerminateMethod · 0.95
ClientMethod · 0.95
PutMethod · 0.95
GetMethod · 0.95
BeforeTestMethod · 0.65
NewClusterMethod · 0.65
ErrorfMethod · 0.65
GetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…