11//
22// DISCLAIMER
33//
4- // Copyright 2024 ArangoDB GmbH, Cologne, Germany
4+ // Copyright 2024-2025 ArangoDB GmbH, Cologne, Germany
55//
66// Licensed under the Apache License, Version 2.0 (the "License");
77// you may not use this file except in compliance with the License.
@@ -34,11 +34,12 @@ import (
3434 pbSharedV1 "github.com/arangodb/kube-arangodb/integrations/shared/v1/definition"
3535 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/helm"
3636 "github.com/arangodb/kube-arangodb/pkg/util/k8sutil/kerrors"
37+ "github.com/arangodb/kube-arangodb/pkg/util/kclient"
3738 "github.com/arangodb/kube-arangodb/pkg/util/tests"
3839 "github.com/arangodb/kube-arangodb/pkg/util/tests/suite"
3940)
4041
41- func cleanup (t * testing.T , c helm.Client ) func () {
42+ func cleanup (t * testing.T , client kclient. Client , c helm.Client ) func () {
4243 t .Run ("Cleanup Pre" , func (t * testing.T ) {
4344 items , err := c .List (context .Background (), func (in * action.List ) {
4445 in .All = true
@@ -54,14 +55,14 @@ func cleanup(t *testing.T, c helm.Client) func() {
5455 }
5556
5657 t .Run ("Remove NS" , func (t * testing.T ) {
57- if err := c . Client () .Kubernetes ().CoreV1 ().Namespaces ().Delete (context .Background (), tests .FakeNamespace , meta.DeleteOptions {}); ! kerrors .IsNotFound (err ) {
58+ if err := client .Kubernetes ().CoreV1 ().Namespaces ().Delete (context .Background (), tests .FakeNamespace , meta.DeleteOptions {}); ! kerrors .IsNotFound (err ) {
5859 require .NoError (t , err )
5960 }
6061
6162 for {
6263 time .Sleep (time .Second )
6364
64- if _ , err := c . Client () .Kubernetes ().CoreV1 ().Namespaces ().Get (context .Background (), tests .FakeNamespace , meta.GetOptions {}); ! kerrors .IsNotFound (err ) {
65+ if _ , err := client .Kubernetes ().CoreV1 ().Namespaces ().Get (context .Background (), tests .FakeNamespace , meta.GetOptions {}); ! kerrors .IsNotFound (err ) {
6566 require .NoError (t , err )
6667 continue
6768 }
@@ -71,7 +72,7 @@ func cleanup(t *testing.T, c helm.Client) func() {
7172 })
7273
7374 t .Run ("Create NS" , func (t * testing.T ) {
74- _ , err = c . Client () .Kubernetes ().CoreV1 ().Namespaces ().Create (context .Background (), & core.Namespace {
75+ _ , err = client .Kubernetes ().CoreV1 ().Namespaces ().Create (context .Background (), & core.Namespace {
7576 ObjectMeta : meta.ObjectMeta {
7677 Name : tests .FakeNamespace ,
7778 },
@@ -96,14 +97,14 @@ func cleanup(t *testing.T, c helm.Client) func() {
9697 }
9798
9899 t .Run ("Remove NS" , func (t * testing.T ) {
99- if err := c . Client () .Kubernetes ().CoreV1 ().Namespaces ().Delete (context .Background (), tests .FakeNamespace , meta.DeleteOptions {}); ! kerrors .IsNotFound (err ) {
100+ if err := client .Kubernetes ().CoreV1 ().Namespaces ().Delete (context .Background (), tests .FakeNamespace , meta.DeleteOptions {}); ! kerrors .IsNotFound (err ) {
100101 require .NoError (t , err )
101102 }
102103
103104 for {
104105 time .Sleep (time .Second )
105106
106- if _ , err := c . Client () .Kubernetes ().CoreV1 ().Namespaces ().Get (context .Background (), tests .FakeNamespace , meta.GetOptions {}); ! kerrors .IsNotFound (err ) {
107+ if _ , err := client .Kubernetes ().CoreV1 ().Namespaces ().Get (context .Background (), tests .FakeNamespace , meta.GetOptions {}); ! kerrors .IsNotFound (err ) {
107108 require .NoError (t , err )
108109 continue
109110 }
@@ -119,7 +120,7 @@ func Test_Implementation(t *testing.T) {
119120 ctx , c := context .WithCancel (context .Background ())
120121 defer c ()
121122
122- scheduler , h := ExternalClient (t , ctx , func (c Configuration ) Configuration {
123+ scheduler , kc , h := ExternalClient (t , ctx , func (c Configuration ) Configuration {
123124 c .Namespace = tests .FakeNamespace
124125 c .Deployment = tests .FakeNamespace
125126 return c
@@ -130,7 +131,7 @@ func Test_Implementation(t *testing.T) {
130131 })
131132 require .NoError (t , err )
132133
133- defer cleanup (t , h )()
134+ defer cleanup (t , kc , h )()
134135
135136 t .Run ("Alive" , func (t * testing.T ) {
136137 _ , err := scheduler .Alive (context .Background (), & pbSharedV1.Empty {})
0 commit comments