|
| 1 | +//go:build e2e |
| 2 | + |
| 3 | +// Copyright 2020-2023 Project Capsule Authors. |
| 4 | +// SPDX-License-Identifier: Apache-2.0 |
| 5 | + |
| 6 | +package e2e |
| 7 | + |
| 8 | +import ( |
| 9 | + "context" |
| 10 | + "time" |
| 11 | + |
| 12 | + "sigs.k8s.io/controller-runtime/pkg/client" |
| 13 | +) |
| 14 | + |
| 15 | +type e2eClient struct { |
| 16 | + client.Client |
| 17 | +} |
| 18 | + |
| 19 | +func (e *e2eClient) Get(ctx context.Context, key client.ObjectKey, obj client.Object, opts ...client.GetOption) error { |
| 20 | + time.Sleep(time.Second) |
| 21 | + |
| 22 | + return e.Client.Get(ctx, key, obj, opts...) |
| 23 | +} |
| 24 | + |
| 25 | +func (e *e2eClient) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) error { |
| 26 | + time.Sleep(time.Second) |
| 27 | + |
| 28 | + return e.Client.List(ctx, list, opts...) |
| 29 | +} |
| 30 | + |
| 31 | +func (e *e2eClient) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error { |
| 32 | + time.Sleep(time.Second) |
| 33 | + |
| 34 | + return e.Client.Create(ctx, obj, opts...) |
| 35 | +} |
| 36 | + |
| 37 | +func (e *e2eClient) Delete(ctx context.Context, obj client.Object, opts ...client.DeleteOption) error { |
| 38 | + time.Sleep(time.Second) |
| 39 | + |
| 40 | + return e.Client.Delete(ctx, obj, opts...) |
| 41 | +} |
| 42 | + |
| 43 | +func (e *e2eClient) Update(ctx context.Context, obj client.Object, opts ...client.UpdateOption) error { |
| 44 | + time.Sleep(time.Second) |
| 45 | + |
| 46 | + return e.Client.Update(ctx, obj, opts...) |
| 47 | +} |
| 48 | + |
| 49 | +func (e *e2eClient) Patch(ctx context.Context, obj client.Object, patch client.Patch, opts ...client.PatchOption) error { |
| 50 | + time.Sleep(time.Second) |
| 51 | + |
| 52 | + return e.Client.Patch(ctx, obj, patch, opts...) |
| 53 | +} |
| 54 | + |
| 55 | +func (e *e2eClient) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error { |
| 56 | + time.Sleep(time.Second) |
| 57 | + |
| 58 | + return e.Client.DeleteAllOf(ctx, obj, opts...) |
| 59 | +} |
0 commit comments