Skip to content

Commit

Permalink
Remove tests/go.mod (kubevirt#2988)
Browse files Browse the repository at this point in the history
* AAQ e2e: replace kv client with k8s client

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* CLI DL: replace kv client with k8s client

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* evictionStrategy: replace kv client with k8s client

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* consolePlugin: replace kv client with k8s client

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* fix client config

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* common client creation func

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* move more e2e test to use k8s client

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

* remove tests/go.mod

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>

---------

Signed-off-by: Nahshon Unna-Tsameret <nunnatsa@redhat.com>
  • Loading branch information
nunnatsa authored Jun 10, 2024
1 parent c70bb07 commit 4e8265f
Show file tree
Hide file tree
Showing 5,237 changed files with 5,153 additions and 1,678,108 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
11 changes: 2 additions & 9 deletions .github/workflows/pr-sanity.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,18 @@ jobs:
name: linter Checks
# The type of runner that the job will run on
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
working-directory:
- "."
- tests

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v5
with:
go-version-file: ${{matrix.working-directory}}/go.mod
go-version-file: go.mod

- name: Run golangci-lint
uses: golangci/golangci-lint-action@v5
with:
version: v1.57.0
version: v1.59.0
skip-pkg-cache: true
args: --timeout=5m --out-${NO_FUTURE}format line-number
working-directory: ${{matrix.working-directory}}
1 change: 0 additions & 1 deletion .snyk
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@ exclude:
global:
- vendor/**
- tools/digester/vendor/**
- tests/vendor/**
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ sanity: generate generate-doc validate-no-offensive-lang goimport lint-metrics l
go mod tidy -v
go mod vendor
./hack/build-manifests.sh
(cd tests && go mod tidy -v && go mod vendor)
git add -N vendor
git difftool -y --trust-exit-code --extcmd=./hack/diff-csv.sh

Expand Down
3 changes: 0 additions & 3 deletions automation/release-bumper/release-bumper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,9 @@ function main {

echo INFO: Executing "go mod tidy"
go mod tidy -v
(cd tests && go mod tidy -v)

echo INFO: Executing "go mod vendor"
go mod vendor
(cd tests && go mod vendor)

echo INFO: Executing "build-manifests.sh"...
./hack/build-manifests.sh
Expand Down Expand Up @@ -257,7 +255,6 @@ function update_go_mod() {
for MODULE_PATH in $(echo "${MODULE_PATH_LIST}" | tr "," "\n")
do
sed -E -i "s|(${MODULE_PATH}.*)v.+|\1${UPDATED_VERSION}|" go.mod
sed -E -i "s|(${MODULE_PATH}.*)v.+|\1${UPDATED_VERSION}|" tests/go.mod
done
else
echo "No need to update go.mod for ${UPDATED_COMPONENT}"
Expand Down
14 changes: 10 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ require (
dario.cat/mergo v1.0.0
github.com/blang/semver/v4 v4.0.0
github.com/evanphx/json-patch/v5 v5.9.0
github.com/gertd/go-pluralize v0.2.1
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32
github.com/go-logr/logr v1.4.1
github.com/google/uuid v1.6.0
Expand All @@ -21,15 +22,19 @@ require (
github.com/operator-framework/operator-lib v0.13.0
github.com/pkg/errors v0.9.1
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.73.2
github.com/prometheus/client_golang v1.19.0
github.com/prometheus/client_model v0.6.1
github.com/prometheus/common v0.53.0
github.com/samber/lo v1.39.0
github.com/spf13/pflag v1.0.5
golang.org/x/sync v0.7.0
golang.org/x/tools v0.21.0
gomodules.xyz/jsonpatch/v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.30.0
k8s.io/apiextensions-apiserver v0.30.0
k8s.io/apimachinery v0.30.0
k8s.io/apiserver v0.30.0
k8s.io/client-go v12.0.0+incompatible
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f
k8s.io/utils v0.0.0-20240502163921-fe8a2dddb1d0
Expand Down Expand Up @@ -63,16 +68,19 @@ require (
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20240430035430-e4905b036c4e // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd // indirect
github.com/imdario/mergo v0.3.16 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/jpillora/backoff v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/moby/spdystream v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/common v0.53.0 // indirect
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/prometheus/procfs v0.14.0 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/sirupsen/logrus v1.9.3 // indirect
Expand All @@ -89,8 +97,6 @@ require (
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiserver v0.30.0 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk=
github.com/NYTimes/gziphandler v0.0.0-20170623195520-56545f4a5d46/go.mod h1:3wb06e3pkSAbeQ52E9H9iFoQsEEwGN64994WTCIhntQ=
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -35,6 +36,8 @@ github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4
github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA=
github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM=
github.com/fxamacker/cbor/v2 v2.6.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/gertd/go-pluralize v0.2.1 h1:M3uASbVjMnTsPb0PNqg+E/24Vwigyo/tvyMTtAlLgiA=
github.com/gertd/go-pluralize v0.2.1/go.mod h1:rbYaKDbsXxmRfr8uygAEKhOWsjyrrqrkHVpZvoOp8zk=
github.com/getkin/kin-openapi v0.76.0/go.mod h1:660oXbgy5JFMKreazJaQTw7o+X00qeSyhcnluiMv+Xg=
github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04=
github.com/ghodss/yaml v1.0.1-0.20190212211648-25d852aebe32 h1:Mn26/9ZMNWSw9C9ERFA1PUxfmGpolnw2v0bKOREu5ew=
Expand Down Expand Up @@ -112,6 +115,7 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/gnostic v0.5.1/go.mod h1:6U4PtQXGIEt/Z3h5MAT7FNofLnw9vXk2cUuW7uA/OeU=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd h1:PpuIBO5P3e9hpqBD0O/HjhShYuM6XE0i/lbE6J94kww=
github.com/grafana/regexp v0.0.0-20221122212121-6b5c0a4cb7fd/go.mod h1:M5qHK+eWfAv8VR/265dIuEpL3fNfeC21tXXp9itM24A=
Expand All @@ -121,6 +125,8 @@ github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4=
github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y=
github.com/jpillora/backoff v1.0.0 h1:uvFg412JmmHBHw7iwprIxkPMI+sGQ4kzOWsMeHnm2EA=
github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
Expand All @@ -147,6 +153,7 @@ github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJ
github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0=
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8=
github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
Expand All @@ -157,6 +164,9 @@ github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjY
github.com/munnerz/goautoneg v0.0.0-20120707110453-a547fc61f48d/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA=
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU=
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus=
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw=
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
Expand Down
5 changes: 3 additions & 2 deletions hack/build-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ if [ "${JOB_TYPE}" == "travis" ]; then
ginkgo -cover -output-dir=./coverprofiles -coverprofile=cover.coverprofile -r ${PKG_PACKAGE_PATH} -r ${CONTROLLERS_PACKAGE_PATH}
else
test_path="tests/func-tests"
(cd $test_path; GOFLAGS='' go install github.com/onsi/ginkgo/v2/ginkgo@$(grep github.com/onsi/ginkgo ../go.mod | cut -d " " -f2))
(cd $test_path; go mod tidy; go mod vendor)
GOFLAGS='' go install github.com/onsi/ginkgo/v2/ginkgo@$(grep github.com/onsi/ginkgo go.mod | cut -d " " -f2)
go mod tidy
go mod vendor
test_out_path=${test_path}/_out
mkdir -p ${test_out_path}
(cd $test_path; ginkgo build .)
Expand Down
76 changes: 36 additions & 40 deletions tests/func-tests/aaq_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
conditionsv1 "github.com/openshift/custom-resource-status/conditions/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/client"

aaqv1alpha1 "kubevirt.io/application-aware-quota/staging/src/kubevirt.io/application-aware-quota-api/pkg/apis/core/v1alpha1"
"kubevirt.io/client-go/kubecli"
"kubevirt.io/kubevirt/tests/flags"

hcoutil "github.com/kubevirt/hyperconverged-cluster-operator/pkg/util"

tests "github.com/kubevirt/hyperconverged-cluster-operator/tests/func-tests"
)

Expand All @@ -29,42 +28,41 @@ const (
var _ = Describe("Test AAQ", Label("AAQ"), Serial, Ordered, func() {
tests.FlagParse()
var (
cli kubecli.KubevirtClient
ctx context.Context
k8scli client.Client
ctx context.Context
)

BeforeEach(func() {
var err error

cli, err = kubecli.GetKubevirtClient()
Expect(cli).ToNot(BeNil())
Expect(err).ToNot(HaveOccurred())
k8scli = tests.GetControllerRuntimeClient()

ctx = context.Background()

disableAAQFeatureGate(ctx, cli)
disableAAQFeatureGate(ctx, k8scli)
})

AfterAll(func() {
disableAAQFeatureGate(ctx, cli)
disableAAQFeatureGate(ctx, k8scli)
})

When("set the applicationAwareConfig exists", func() {
It("should create the AAQ CR and all the pods", func() {

enableAAQFeatureGate(ctx, cli)
enableAAQFeatureGate(ctx, k8scli)

By("check the AAQ CR")
Eventually(func(g Gomega) bool {
aaq := getAAQ(ctx, cli, g)
aaq, err := getAAQ(ctx, k8scli)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(aaq.Status.Conditions).ToNot(BeEmpty())
return conditionsv1.IsStatusConditionTrue(aaq.Status.Conditions, conditionsv1.ConditionAvailable)
}).WithTimeout(5 * time.Minute).WithPolling(time.Second).ShouldNot(BeTrue())

By("check AAQ pods")
Eventually(func(g Gomega) {
deps, err := cli.AppsV1().Deployments(flags.KubeVirtInstallNamespace).List(ctx, metav1.ListOptions{LabelSelector: "app.kubernetes.io/managed-by=aaq-operator"})
g.Expect(err).ToNot(HaveOccurred())
deps := &appsv1.DeploymentList{}
Expect(
k8scli.List(ctx, deps, client.MatchingLabels{"app.kubernetes.io/managed-by": "aaq-operator"}),
).To(Succeed())
g.Expect(deps.Items).To(HaveLen(2))

expectedPods := int32(0)
Expand All @@ -73,8 +71,10 @@ var _ = Describe("Test AAQ", Label("AAQ"), Serial, Ordered, func() {
expectedPods += dep.Status.Replicas
}

pods, err := cli.CoreV1().Pods(flags.KubeVirtInstallNamespace).List(ctx, metav1.ListOptions{LabelSelector: "app.kubernetes.io/managed-by=aaq-operator"})
g.Expect(err).ToNot(HaveOccurred())
pods := &corev1.PodList{}
Expect(k8scli.List(
ctx, pods, client.MatchingLabels{"app.kubernetes.io/managed-by": "aaq-operator"}),
).To(Succeed())
g.Expect(pods.Items).To(HaveLen(int(expectedPods)))
}).WithTimeout(5 * time.Minute).
WithPolling(time.Second).
Expand All @@ -83,46 +83,42 @@ var _ = Describe("Test AAQ", Label("AAQ"), Serial, Ordered, func() {
})
})

func getAAQ(ctx context.Context, cli kubecli.KubevirtClient, g Gomega) *aaqv1alpha1.AAQ {
aaq := &aaqv1alpha1.AAQ{}
func getAAQ(ctx context.Context, cli client.Client) (*aaqv1alpha1.AAQ, error) {
aaq := &aaqv1alpha1.AAQ{
ObjectMeta: metav1.ObjectMeta{
Name: "aaq-" + hcoutil.HyperConvergedName,
Namespace: tests.InstallNamespace,
},
}

unstAAQ, err := getAAQResource(ctx, cli)
g.ExpectWithOffset(1, err).ToNot(HaveOccurred())
err = runtime.DefaultUnstructuredConverter.FromUnstructured(unstAAQ.Object, aaq)
g.ExpectWithOffset(1, err).ToNot(HaveOccurred())

return aaq
err := cli.Get(ctx, client.ObjectKeyFromObject(aaq), aaq)
return aaq, err
}

func getAAQResource(ctx context.Context, client kubecli.KubevirtClient) (*unstructured.Unstructured, error) {
aaqGVR := schema.GroupVersionResource{Group: aaqv1alpha1.SchemeGroupVersion.Group, Version: aaqv1alpha1.SchemeGroupVersion.Version, Resource: "aaqs"}

return client.DynamicClient().Resource(aaqGVR).Get(ctx, "aaq-"+hcoutil.HyperConvergedName, metav1.GetOptions{})
}

func enableAAQFeatureGate(ctx context.Context, cli kubecli.KubevirtClient) {
func enableAAQFeatureGate(ctx context.Context, cli client.Client) {
By("enable the AAQ FG")
setAAQFeatureGate(ctx, cli, true)
}

func disableAAQFeatureGate(ctx context.Context, cli kubecli.KubevirtClient) {
func disableAAQFeatureGate(ctx context.Context, cli client.Client) {
By("disable the AAQ FG")
setAAQFeatureGate(ctx, cli, false)

By("make sure the AAQ CR was removed")
Eventually(func() error {
_, err := getAAQResource(ctx, cli)
_, err := getAAQ(ctx, cli)
return err
}).WithTimeout(5 * time.Minute).
WithPolling(100 * time.Millisecond).
WithOffset(1).
Should(MatchError(errors.IsNotFound, "not found error"))
}

func setAAQFeatureGate(ctx context.Context, cli kubecli.KubevirtClient, fgState bool) {
patch := []byte(fmt.Sprintf(setAAQFGPatchTemplate, fgState))
func setAAQFeatureGate(ctx context.Context, cli client.Client, fgState bool) {
patchBytes := []byte(fmt.Sprintf(setAAQFGPatchTemplate, fgState))

Eventually(tests.PatchHCO).
WithArguments(ctx, cli, patch).
WithArguments(ctx, cli, patchBytes).
WithTimeout(10 * time.Second).
WithPolling(100 * time.Millisecond).
WithOffset(2).
Expand Down
Loading

0 comments on commit 4e8265f

Please sign in to comment.