mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-22 19:31:44 +00:00
etcd3/store: update creation test to use storage client
There is no functional difference between checking for an empty key using the database client and doing so with the storage interface. Using the latter allows this test to be more portable. Signed-off-by: Steve Kuznetsov <skuznets@redhat.com>
This commit is contained in:
parent
543893cbb0
commit
f894f8196d
@ -115,16 +115,11 @@ func TestCreate(t *testing.T) {
|
||||
obj := &example.Pod{ObjectMeta: metav1.ObjectMeta{Name: "foo", SelfLink: "testlink"}}
|
||||
|
||||
// verify that kv pair is empty before set
|
||||
getResp, err := etcdClient.KV.Get(ctx, key)
|
||||
if err != nil {
|
||||
t.Fatalf("etcdClient.KV.Get failed: %v", err)
|
||||
}
|
||||
if len(getResp.Kvs) != 0 {
|
||||
t.Fatalf("expecting empty result on key: %s", key)
|
||||
if err := store.Get(ctx, key, storage.GetOptions{}, out); !storage.IsNotFound(err) {
|
||||
t.Fatalf("expecting empty result on key %s, got %v", key, err)
|
||||
}
|
||||
|
||||
err = store.Create(ctx, key, obj, out, 0)
|
||||
if err != nil {
|
||||
if err := store.Create(ctx, key, obj, out, 0); err != nil {
|
||||
t.Fatalf("Set failed: %v", err)
|
||||
}
|
||||
// basic tests of the output
|
||||
|
Loading…
Reference in New Issue
Block a user