Skip to content

Commit b540611

Browse files
fix
Signed-off-by: Yaroslav Borbat <[email protected]>
1 parent 29d69e5 commit b540611

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

tests/e2e/framework/client.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ package framework
1818

1919
import (
2020
apiruntime "k8s.io/apimachinery/pkg/runtime"
21+
"k8s.io/client-go/dynamic"
2122
"k8s.io/client-go/kubernetes"
2223
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
2324
virtv1 "kubevirt.io/api/core/v1"
@@ -43,6 +44,7 @@ type Clients struct {
4344
kubectl kubectl.Kubectl
4445
d8virtualization d8.D8Virtualization
4546
client client.Client
47+
dynamic dynamic.Interface
4648
}
4749

4850
func (c Clients) VirtClient() kubeclient.Client {
@@ -57,6 +59,10 @@ func (c Clients) GenericClient() client.Client {
5759
return c.client
5860
}
5961

62+
func (c Clients) DynamicClient() dynamic.Interface {
63+
return c.dynamic
64+
}
65+
6066
func (c Clients) Kubectl() kubectl.Kubectl {
6167
return c.kubectl
6268
}
@@ -82,6 +88,10 @@ func init() {
8288
if err != nil {
8389
panic(err)
8490
}
91+
clients.dynamic, err = dynamic.NewForConfig(restConfig)
92+
if err != nil {
93+
panic(err)
94+
}
8595
clients.kubectl, err = kubectl.NewKubectl(kubectl.KubectlConf(conf.ClusterTransport))
8696
if err != nil {
8797
panic(err)

tests/e2e/tests_suite_test.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,9 @@ import (
2929
. "github.com/onsi/gomega"
3030
"golang.org/x/sync/errgroup"
3131
corev1 "k8s.io/api/core/v1"
32-
storagev1 "k8s.io/api/storage/v1"
3332
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
34-
"k8s.io/apimachinery/pkg/runtime"
35-
"k8s.io/cli-runtime/pkg/genericclioptions"
3633
"k8s.io/client-go/dynamic"
3734
"k8s.io/client-go/kubernetes"
38-
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
39-
"k8s.io/client-go/rest"
4035
"sigs.k8s.io/controller-runtime/pkg/client"
4136

4237
"github.com/deckhouse/virtualization/api/client/kubeclient"
@@ -111,9 +106,7 @@ func init() {
111106
virtClient = clients.VirtClient()
112107
kubeClient = clients.KubeClient()
113108
crClient = clients.GenericClient()
114-
if dynamicClient, err = dynamic.NewForConfig(restConfig); err != nil {
115-
log.Fatal(err)
116-
}
109+
dynamicClient = clients.DynamicClient()
117110

118111
if git, err = gt.NewGit(); err != nil {
119112
log.Fatal(err)

0 commit comments

Comments
 (0)