Skip to content

Commit

Permalink
Merge branch 'master' into errkit_migration_7_kanctl
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Oct 10, 2024
2 parents 6bcb9ee + 6055b35 commit da3bc2b
Show file tree
Hide file tree
Showing 76 changed files with 2,191 additions and 422 deletions.
1 change: 0 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ issues:
exclude-rules:
- path: '_test.go'
linters:
- unparam # Tests might have unused function parameters.
- lll
- dupl
- nestif
Expand Down
21 changes: 21 additions & 0 deletions build/protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/sh

# Copyright 2024 The Kanister Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -o errexit
set -o nounset

find ./pkg -name "*.proto" | xargs -t -I PROTO_FILE \
protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative PROTO_FILE
3 changes: 2 additions & 1 deletion docker/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ LABEL maintainer="Tom Manville<[email protected]>"

ARG TARGETPLATFORM

RUN apt-get update && apt-get -y install apt-transport-https ca-certificates bash git gnupg2 software-properties-common curl jq wget \
RUN apt-get update && apt-get -y install \
apt-transport-https bash ca-certificates curl git gnupg2 jq protobuff-compiler software-properties-common wget \
&& update-ca-certificates

RUN curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg \
Expand Down
2 changes: 1 addition & 1 deletion docker/postgres-kanister-tools/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
awscli==1.34.29
awscli==1.35.1
pip==24.2
setuptools==75.1.0
wheel==0.44.0
2 changes: 1 addition & 1 deletion docker/postgresql/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
awscli==1.34.29
awscli==1.35.1
wal-e==1.1.1
pip==24.2
setuptools==75.1.0
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ require (
github.com/chmduquesne/rollinghash v4.0.0+incompatible // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/danieljoos/wincred v1.2.1 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
Expand Down Expand Up @@ -204,7 +204,7 @@ require (
go.opentelemetry.io/otel/sdk v1.28.0 // indirect
go.opentelemetry.io/otel/trace v1.29.0 // indirect
go.opentelemetry.io/proto/otlp v1.2.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.starlark.net v0.0.0-20240314022150-ee8ed142361c // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
Expand All @@ -220,8 +220,8 @@ require (
google.golang.org/genproto v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240827150818-7e3bb234dfed // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/grpc v1.67.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
google.golang.org/grpc v1.67.0
google.golang.org/protobuf v1.34.2
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/kothar/go-backblaze.v0 v0.0.0-20210124194846-35409b867216 // indirect
Expand All @@ -231,9 +231,10 @@ require (
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01 // indirect
k8s.io/klog/v2 v2.110.1 // indirect
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1
)

require k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
9 changes: 4 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@ github.com/creack/pty v1.1.18/go.mod h1:MOBLtS5ELjhRRrroQr9kyvTxUAFNvYEK993ew/Vr
github.com/danieljoos/wincred v1.2.1 h1:dl9cBrupW8+r5250DYkYxocLeZ1Y4vB1kxgtjxw8GQs=
github.com/danieljoos/wincred v1.2.1/go.mod h1:uGaFL9fDn3OLTvzCGulzE+SzjEe5NGlh5FdCcyfPwps=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI=
github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ=
Expand Down Expand Up @@ -286,7 +287,6 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
Expand Down Expand Up @@ -580,8 +580,8 @@ go.opentelemetry.io/otel/trace v1.29.0 h1:J/8ZNK4XgR7a21DZUAsbF8pZ5Jcw1VhACmnYt3
go.opentelemetry.io/otel/trace v1.29.0/go.mod h1:eHl3w0sp3paPkYstJOmAimxhiFXPg+MMTlEh3nsQgWQ=
go.opentelemetry.io/proto/otlp v1.2.0 h1:pVeZGk7nXDC9O2hncA6nHldxEjm6LByfA2aN8IOkz94=
go.opentelemetry.io/proto/otlp v1.2.0/go.mod h1:gGpR8txAl5M03pDhMC79G6SdqNV26naRm/KDsgaHD8A=
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca h1:VdD38733bfYv5tUZwEIskMM93VanwNIi5bIKnDrJdEY=
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca/go.mod h1:jxU+3+j+71eXOW14274+SmmuW82qJzl6iZSeqEtTGds=
go.starlark.net v0.0.0-20240314022150-ee8ed142361c h1:roAjH18hZcwI4hHStHbkXjF5b7UUyZ/0SG3hXNN1SjA=
go.starlark.net v0.0.0-20240314022150-ee8ed142361c/go.mod h1:YKMCv9b1WrfWmeqdV5MAuEHWsu5iC+fe6kYl2sQjdI8=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto=
Expand Down Expand Up @@ -688,7 +688,6 @@ golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34=
golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58=
golang.org/x/term v0.24.0 h1:Mh5cbb+Zk2hqqXNO7S1iTjEphVL+jb8ZWaqh/g+JWkM=
Expand Down
54 changes: 27 additions & 27 deletions pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (s *ControllerSuite) TestWatch(c *check.C) {
time.Sleep(5 * time.Second)
}

func (s *ControllerSuite) waitOnActionSetState(c *check.C, as *crv1alpha1.ActionSet, state crv1alpha1.State) error {
func (s *ControllerSuite) waitOnActionSetState(as *crv1alpha1.ActionSet, state crv1alpha1.State) error {
ctx, cancel := context.WithTimeout(context.Background(), 40*time.Second)
defer cancel()
err := poll.Wait(ctx, func(context.Context) (bool, error) {
Expand All @@ -179,7 +179,7 @@ func (s *ControllerSuite) waitOnActionSetState(c *check.C, as *crv1alpha1.Action
return errors.Wrapf(err, "State '%s' never reached", state)
}

func (s *ControllerSuite) waitOnDeferPhaseState(c *check.C, as *crv1alpha1.ActionSet, state crv1alpha1.State) error {
func (s *ControllerSuite) waitOnDeferPhaseState(as *crv1alpha1.ActionSet, state crv1alpha1.State) error {
ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
defer cancel()
err := poll.Wait(ctx, func(ctx context.Context) (bool, error) {
Expand Down Expand Up @@ -474,7 +474,7 @@ func (s *ControllerSuite) TestEmptyActionSetStatus(c *check.C) {
c.Assert(err, check.IsNil)
}()

err = s.waitOnActionSetState(c, as, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)
}

Expand Down Expand Up @@ -502,7 +502,7 @@ func (s *ControllerSuite) TestSynchronousFailure(c *check.C) {
c.Assert(err, check.IsNil)
}()

err = s.waitOnActionSetState(c, as, crv1alpha1.StateFailed)
err = s.waitOnActionSetState(as, crv1alpha1.StateFailed)
c.Assert(err, check.IsNil)
}

Expand Down Expand Up @@ -663,7 +663,7 @@ func (s *ControllerSuite) TestExecActionSet(c *check.C) {
}

if !cancel {
err = s.waitOnActionSetState(c, as, final)
err = s.waitOnActionSetState(as, final)
c.Assert(err, check.IsNil, check.Commentf("Failed case: %s", tc.name))
expectedValue := oldValue + 1
err = waitForMetrics(s.ctrl.metrics.actionSetResolutionCounterVec, []string{tc.metricResolution}, expectedValue, time.Second)
Expand Down Expand Up @@ -774,14 +774,14 @@ func (s *ControllerSuite) TestDeferPhase(c *check.C) {
as := testutil.NewTestActionSet(s.namespace, bp.GetName(), "Deployment", s.deployment.GetName(), s.namespace, kanister.DefaultVersion, "backup")
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)
err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// make sure deferPhase is also run successfully
err = s.waitOnDeferPhaseState(c, as, crv1alpha1.StateComplete)
err = s.waitOnDeferPhaseState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

as, err = s.crCli.ActionSets(s.namespace).Get(ctx, as.Name, metav1.GetOptions{})
Expand All @@ -792,9 +792,9 @@ func (s *ControllerSuite) TestDeferPhase(c *check.C) {
ras := testutil.NewTestRestoreActionSet(s.namespace, bp.GetName(), s.deployment.GetName(), as.Status.Actions[0].Artifacts)
ras, err = s.crCli.ActionSets(s.namespace).Create(ctx, ras, metav1.CreateOptions{})
c.Assert(err, check.IsNil)
err = s.waitOnActionSetState(c, ras, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(ras, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)
err = s.waitOnActionSetState(c, ras, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(ras, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

as, err = s.crCli.ActionSets(s.namespace).Get(ctx, as.Name, metav1.GetOptions{})
Expand Down Expand Up @@ -824,14 +824,14 @@ func (s *ControllerSuite) TestDeferPhaseCoreErr(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// wait for deferPhase to be completed, because actionset status would be set to failed as soon as a main phase fails
err = s.waitOnDeferPhaseState(c, as, crv1alpha1.StateComplete)
err = s.waitOnDeferPhaseState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateFailed)
err = s.waitOnActionSetState(as, crv1alpha1.StateFailed)
c.Assert(err, check.IsNil)

// get the actionset again to have updated status
Expand Down Expand Up @@ -860,14 +860,14 @@ func (s *ControllerSuite) TestDeferPhaseDeferErr(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// wait for deferPhase to fail
err = s.waitOnDeferPhaseState(c, as, crv1alpha1.StateFailed)
err = s.waitOnDeferPhaseState(as, crv1alpha1.StateFailed)
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateFailed)
err = s.waitOnActionSetState(as, crv1alpha1.StateFailed)
c.Assert(err, check.IsNil)

// get the actionset again to have updated status
Expand Down Expand Up @@ -895,13 +895,13 @@ func (s *ControllerSuite) TestPhaseOutputAsArtifact(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// Check if the func returned expected output
c.Assert(testutil.OutputFuncOut(), check.DeepEquals, map[string]interface{}{"key": "myValue"})

err = s.waitOnActionSetState(c, as, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

// Check if the artifacts got updated correctly
Expand Down Expand Up @@ -932,15 +932,15 @@ func (s *ControllerSuite) TestPhaseOutputParallelActions(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// Check if the func returned expected output
c.Assert(testutil.OutputFuncOut(), check.DeepEquals, map[string]interface{}{"key": "myValue"})

testutil.ReleaseWaitFunc()

err = s.waitOnActionSetState(c, as, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

// Check if the artifacts got updated correctly
Expand Down Expand Up @@ -969,13 +969,13 @@ func (s *ControllerSuite) TestPhaseOutputAsKopiaSnapshot(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// Check if the func returned expected output
c.Assert(testutil.OutputFuncOut(), check.DeepEquals, map[string]interface{}{"key": "myValue"})

err = s.waitOnActionSetState(c, as, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

// Check if the artifacts got updated correctly
Expand Down Expand Up @@ -1020,13 +1020,13 @@ func (s *ControllerSuite) TestActionSetExecWithoutProfile(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

// Check if the func returned expected output
c.Assert(testutil.OutputFuncOut(), check.DeepEquals, map[string]interface{}{"key": "myValue"})

err = s.waitOnActionSetState(c, as, crv1alpha1.StateComplete)
err = s.waitOnActionSetState(as, crv1alpha1.StateComplete)
c.Assert(err, check.IsNil)

// Check if the artifacts got updated correctly
Expand All @@ -1051,12 +1051,12 @@ func (s *ControllerSuite) TestRenderArtifactsFailure(c *check.C) {
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

c.Assert(testutil.OutputFuncOut(), check.DeepEquals, map[string]interface{}{"key": "myValue"})

err = s.waitOnActionSetState(c, as, crv1alpha1.StateFailed)
err = s.waitOnActionSetState(as, crv1alpha1.StateFailed)
c.Assert(err, check.IsNil)
}

Expand All @@ -1073,7 +1073,7 @@ func (s *ControllerSuite) TestProgressRunningPhase(c *check.C) {
as := testutil.NewTestActionSet(s.namespace, bp.GetName(), "Deployment", s.deployment.GetName(), s.namespace, kanister.DefaultVersion, "backup")
as, err = s.crCli.ActionSets(s.namespace).Create(ctx, as, metav1.CreateOptions{})
c.Assert(err, check.IsNil)
err = s.waitOnActionSetState(c, as, crv1alpha1.StateRunning)
err = s.waitOnActionSetState(as, crv1alpha1.StateRunning)
c.Assert(err, check.IsNil)

runningPhases := sets.Set[string]{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ func (s *RepoServerControllerSuite) TestRepositoryServerStatusIsServerReady(c *c
err = testutil.CreateTestKopiaRepository(ctx, s.kubeCli, repoServerCRCreated, testutil.GetDefaultS3CompliantStorageLocation())
c.Assert(err, check.IsNil)

_, err = s.waitOnRepositoryServerState(c, repoServerCRCreated.Name)
_, err = s.waitOnRepositoryServerState(repoServerCRCreated.Name)
c.Assert(err, check.IsNil)

err = s.crCli.RepositoryServers(s.repoServerControllerNamespace).Delete(context.Background(), repoServerCRCreated.Name, metav1.DeleteOptions{})
Expand All @@ -294,7 +294,7 @@ func (s *RepoServerControllerSuite) TestRepositoryServerCRStateWithoutSecrets(c
repoServerCRCreated, err := s.crCli.RepositoryServers(s.repoServerControllerNamespace).Create(ctx, &repoServerCR, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

state, err := s.waitOnRepositoryServerState(c, repoServerCRCreated.Name)
state, err := s.waitOnRepositoryServerState(repoServerCRCreated.Name)
c.Assert(err, check.NotNil)
c.Assert(state, check.Equals, crv1alpha1.Failed)

Expand Down Expand Up @@ -348,7 +348,7 @@ func (s *RepoServerControllerSuite) TestInvalidRepositoryPassword(c *check.C) {
repoServerCRCreated, err := s.crCli.RepositoryServers(s.repoServerControllerNamespace).Create(ctx, &repoServerCR, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

state, err := s.waitOnRepositoryServerState(c, repoServerCRCreated.Name)
state, err := s.waitOnRepositoryServerState(repoServerCRCreated.Name)
c.Assert(err, check.NotNil)
c.Assert(state, check.Equals, crv1alpha1.Failed)

Expand All @@ -373,7 +373,7 @@ func (s *RepoServerControllerSuite) TestInvalidStorageLocation(c *check.C) {
repoServerCRCreated, err := s.crCli.RepositoryServers(s.repoServerControllerNamespace).Create(ctx, &repoServerCR, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

state, err := s.waitOnRepositoryServerState(c, repoServerCRCreated.Name)
state, err := s.waitOnRepositoryServerState(repoServerCRCreated.Name)
c.Assert(err, check.NotNil)
c.Assert(state, check.Equals, crv1alpha1.Failed)

Expand All @@ -398,7 +398,7 @@ func (s *RepoServerControllerSuite) TestInvalidStorageLocationCredentials(c *che
repoServerCRCreated, err := s.crCli.RepositoryServers(s.repoServerControllerNamespace).Create(ctx, &repoServerCR, metav1.CreateOptions{})
c.Assert(err, check.IsNil)

state, err := s.waitOnRepositoryServerState(c, repoServerCRCreated.Name)
state, err := s.waitOnRepositoryServerState(repoServerCRCreated.Name)
c.Assert(err, check.NotNil)
c.Assert(state, check.Equals, crv1alpha1.Failed)

Expand Down Expand Up @@ -486,7 +486,7 @@ func (s *RepoServerControllerSuite) waitForRepoServerInfoUpdateInCR(repoServerNa
return err
}

func (s *RepoServerControllerSuite) waitOnRepositoryServerState(c *check.C, reposerverName string) (crv1alpha1.RepositoryServerProgress, error) {
func (s *RepoServerControllerSuite) waitOnRepositoryServerState(reposerverName string) (crv1alpha1.RepositoryServerProgress, error) {
ctxTimeout := 10 * time.Minute
ctx, cancel := context.WithTimeout(context.Background(), ctxTimeout)
defer cancel()
Expand Down
Loading

0 comments on commit da3bc2b

Please sign in to comment.