Bump golangci-lint from v1.57.2 to v1.64.5 (#8641)
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>pull/8717/head
parent
3c22de7fe3
commit
6a6a237ba7
|
@ -20,5 +20,5 @@ jobs:
|
|||
- name: Linter check
|
||||
uses: golangci/golangci-lint-action@v6
|
||||
with:
|
||||
version: v1.57.2
|
||||
version: v1.64.5
|
||||
args: --verbose
|
||||
|
|
|
@ -27,7 +27,6 @@ run:
|
|||
# If false (default) - golangci-lint acquires file lock on start.
|
||||
allow-parallel-runners: false
|
||||
|
||||
|
||||
# output configuration options
|
||||
output:
|
||||
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
|
||||
|
@ -41,18 +40,25 @@ output:
|
|||
# print linter name in the end of issue text, default is true
|
||||
print-linter-name: true
|
||||
|
||||
# make issues output unique by line, default is true
|
||||
uniq-by-line: true
|
||||
|
||||
|
||||
# all available settings of specific linters
|
||||
linters-settings:
|
||||
|
||||
depguard:
|
||||
rules:
|
||||
main:
|
||||
deny:
|
||||
# specify an error message to output when a denylisted package is used
|
||||
- pkg: github.com/sirupsen/logrus
|
||||
desc: "logging is allowed only by logutils.Log"
|
||||
|
||||
dogsled:
|
||||
# checks assignments with too many blank identifiers; default is 2
|
||||
max-blank-identifiers: 2
|
||||
|
||||
dupl:
|
||||
# tokens count to trigger issue, 150 by default
|
||||
threshold: 100
|
||||
|
||||
errcheck:
|
||||
# report about not checking of errors in type assertions: `a := b.(MyStruct)`;
|
||||
# default is false: such cases aren't reported by default.
|
||||
|
@ -70,25 +76,31 @@ linters-settings:
|
|||
# path to a file containing a list of functions to exclude from checking
|
||||
# see https://github.com/kisielk/errcheck#excluding-functions for details
|
||||
# exclude: /path/to/file.txt
|
||||
|
||||
exhaustive:
|
||||
# indicates that switch statements are to be considered exhaustive if a
|
||||
# 'default' case is present, even if all enum members aren't listed in the
|
||||
# switch
|
||||
default-signifies-exhaustive: false
|
||||
|
||||
funlen:
|
||||
lines: 60
|
||||
statements: 40
|
||||
|
||||
gocognit:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 10
|
||||
|
||||
nestif:
|
||||
# minimal complexity of if statements to report, 5 by default
|
||||
min-complexity: 4
|
||||
|
||||
goconst:
|
||||
# minimal length of string constant, 3 by default
|
||||
min-len: 3
|
||||
# minimal occurrences count to trigger, 3 by default
|
||||
min-occurrences: 5
|
||||
|
||||
gocritic:
|
||||
# Which checks should be enabled; can't be combined with 'disabled-checks';
|
||||
# See https://go-critic.github.io/overview#checks-overview
|
||||
|
@ -113,12 +125,15 @@ linters-settings:
|
|||
paramsOnly: true
|
||||
# rangeValCopy:
|
||||
# sizeThreshold: 32
|
||||
|
||||
gocyclo:
|
||||
# minimal code complexity to report, 30 by default (but we recommend 10-20)
|
||||
min-complexity: 10
|
||||
|
||||
godot:
|
||||
# check all top-level comments, not only declarations
|
||||
check-all: false
|
||||
|
||||
godox:
|
||||
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
|
||||
# might be left in the code accidentally and should be resolved before merging
|
||||
|
@ -126,13 +141,20 @@ linters-settings:
|
|||
- NOTE
|
||||
- OPTIMIZE # marks code that should be optimized before merging
|
||||
- HACK # marks hack-arounds that should be removed before merging
|
||||
|
||||
gofmt:
|
||||
# simplify code: gofmt with `-s` option, true by default
|
||||
simplify: true
|
||||
|
||||
goimports:
|
||||
# put imports beginning with prefix after 3rd-party packages;
|
||||
# it's a comma-separated list of prefixes
|
||||
local-prefixes: github.com/org/project
|
||||
|
||||
gosec:
|
||||
excludes:
|
||||
- G115
|
||||
|
||||
govet:
|
||||
# report about shadowed variables
|
||||
# check-shadowing: true
|
||||
|
@ -153,12 +175,14 @@ linters-settings:
|
|||
disable:
|
||||
- shadow
|
||||
disable-all: false
|
||||
|
||||
lll:
|
||||
# max line length, lines longer will be reported. Default is 120.
|
||||
# '\t' is counted as 1 character by default, and can be changed with the tab-width option
|
||||
line-length: 120
|
||||
# tab width in spaces. Default to 1.
|
||||
tab-width: 1
|
||||
|
||||
misspell:
|
||||
# Correct spellings using locale preferences for US or UK.
|
||||
# Default is to use a neutral variety of English.
|
||||
|
@ -166,9 +190,11 @@ linters-settings:
|
|||
locale: US
|
||||
ignore-words:
|
||||
- someword
|
||||
|
||||
nakedret:
|
||||
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
|
||||
max-func-lines: 30
|
||||
|
||||
prealloc:
|
||||
# XXX: we don't recommend using this linter before doing performance profiling.
|
||||
# For most programs usage of prealloc will be a premature optimization.
|
||||
|
@ -178,6 +204,7 @@ linters-settings:
|
|||
simple: true
|
||||
range-loops: true # Report preallocation suggestions on range loops, true by default
|
||||
for-loops: false # Report preallocation suggestions on for loops, false by default
|
||||
|
||||
nolintlint:
|
||||
# Enable to ensure that nolint directives are all used. Default is true.
|
||||
allow-unused: false
|
||||
|
@ -187,11 +214,13 @@ linters-settings:
|
|||
require-explanation: true
|
||||
# Enable to require nolint directives to mention the specific linter being suppressed. Default is false.
|
||||
require-specific: true
|
||||
|
||||
perfsprint:
|
||||
strconcat: false
|
||||
sprintf1: false
|
||||
errorf: false
|
||||
int-conversion: true
|
||||
|
||||
revive:
|
||||
rules:
|
||||
- name: blank-imports
|
||||
|
@ -238,10 +267,11 @@ linters-settings:
|
|||
- name: var-declaration
|
||||
- name: var-naming
|
||||
disabled: true
|
||||
|
||||
|
||||
rowserrcheck:
|
||||
packages:
|
||||
- github.com/jmoiron/sqlx
|
||||
|
||||
testifylint:
|
||||
# TODO: enable them all
|
||||
disable:
|
||||
|
@ -249,6 +279,7 @@ linters-settings:
|
|||
- float-compare
|
||||
- require-error
|
||||
enable-all: true
|
||||
|
||||
testpackage:
|
||||
# regexp pattern to skip files
|
||||
skip-regexp: (export|internal)_test\.go
|
||||
|
@ -258,9 +289,11 @@ linters-settings:
|
|||
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
|
||||
# with golangci-lint call it on a directory with the changed file.
|
||||
check-exported: false
|
||||
|
||||
whitespace:
|
||||
multi-if: false # Enforces newlines (or comments) after every multi-line if statement
|
||||
multi-func: false # Enforces newlines (or comments) after every multi-line function signature
|
||||
|
||||
wsl:
|
||||
# If true append is only allowed to be cuddled if appending value is
|
||||
# matching variables, fields or types on line above. Default is true.
|
||||
|
@ -288,11 +321,11 @@ linters:
|
|||
- asciicheck
|
||||
- bidichk
|
||||
- bodyclose
|
||||
- copyloopvar
|
||||
- dogsled
|
||||
- durationcheck
|
||||
- dupword
|
||||
- errcheck
|
||||
- exportloopref
|
||||
- errchkjson
|
||||
- goconst
|
||||
- gofmt
|
||||
|
@ -325,8 +358,16 @@ linters:
|
|||
- whitespace
|
||||
fast: false
|
||||
|
||||
|
||||
issues:
|
||||
# which dirs to skip: issues from them won't be reported;
|
||||
# can use regexp here: generated.*, regexp is applied on full path;
|
||||
# default value is empty list, but default dirs are skipped independently
|
||||
# from this option's value (see skip-dirs-use-default).
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
exclude-dirs:
|
||||
- pkg/plugin/generated/*
|
||||
|
||||
exclude-rules:
|
||||
- linters:
|
||||
- staticcheck
|
||||
|
@ -370,17 +411,8 @@ issues:
|
|||
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
|
||||
max-same-issues: 0
|
||||
|
||||
# Show only new issues created after git revision `REV`
|
||||
# new-from-rev: origin/main
|
||||
|
||||
# which dirs to skip: issues from them won't be reported;
|
||||
# can use regexp here: generated.*, regexp is applied on full path;
|
||||
# default value is empty list, but default dirs are skipped independently
|
||||
# from this option's value (see skip-dirs-use-default).
|
||||
# "/" will be replaced by current OS file path separator to properly work
|
||||
# on Windows.
|
||||
exclude-dirs:
|
||||
- pkg/plugin/generated/*
|
||||
# make issues output unique by line, default is true
|
||||
uniq-by-line: true
|
||||
|
||||
severity:
|
||||
# Default value is empty string.
|
||||
|
|
|
@ -94,7 +94,7 @@ RUN ARCH=$(go env GOARCH) && \
|
|||
chmod +x /usr/bin/goreleaser
|
||||
|
||||
# get golangci-lint
|
||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.57.2
|
||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.5
|
||||
|
||||
# install kubectl
|
||||
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/$(go env GOARCH)/kubectl
|
||||
|
|
|
@ -106,7 +106,7 @@ func (p *Policies) BuildPolicy(resPolicies *ResourcePolicies) error {
|
|||
volP.conditions = append(volP.conditions, &nfsCondition{nfs: con.NFS})
|
||||
volP.conditions = append(volP.conditions, &csiCondition{csi: con.CSI})
|
||||
volP.conditions = append(volP.conditions, &volumeTypeCondition{volumeTypes: con.VolumeTypes})
|
||||
if con.PVCLabels != nil && len(con.PVCLabels) > 0 {
|
||||
if len(con.PVCLabels) > 0 {
|
||||
volP.conditions = append(volP.conditions, &pvcLabelsCondition{labels: con.PVCLabels})
|
||||
}
|
||||
p.volumePolicies = append(p.volumePolicies, volP)
|
||||
|
|
|
@ -150,7 +150,6 @@ func TestParseCapacity(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test // capture range variable
|
||||
t.Run(test.input, func(t *testing.T) {
|
||||
actual, actualErr := parseCapacity(test.input)
|
||||
if test.expected != emptyCapacity {
|
||||
|
@ -181,7 +180,6 @@ func TestCapacityIsInRange(t *testing.T) {
|
|||
}
|
||||
|
||||
for _, test := range tests {
|
||||
test := test // capture range variable
|
||||
t.Run(fmt.Sprintf("%v with %v", test.capacity, test.quantity), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ package storage
|
|||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/pkg/errors"
|
||||
|
@ -98,7 +97,7 @@ func GetDefaultBackupStorageLocations(ctx context.Context, kbClient client.Clien
|
|||
locations := new(velerov1api.BackupStorageLocationList)
|
||||
defaultLocations := new(velerov1api.BackupStorageLocationList)
|
||||
if err := kbClient.List(context.Background(), locations, &client.ListOptions{Namespace: namespace}); err != nil {
|
||||
return defaultLocations, errors.Wrapf(err, fmt.Sprintf("failed to list backup storage locations in namespace %s", namespace))
|
||||
return defaultLocations, errors.Wrapf(err, "failed to list backup storage locations in namespace %s", namespace)
|
||||
}
|
||||
|
||||
for _, location := range locations.Items {
|
||||
|
|
|
@ -152,7 +152,7 @@ func download(
|
|||
if err != nil {
|
||||
if urlErr, ok := err.(*url.Error); ok {
|
||||
if _, ok := urlErr.Err.(x509.UnknownAuthorityError); ok {
|
||||
return fmt.Errorf(err.Error() + "\n\nThe --insecure-skip-tls-verify flag can also be used to accept any TLS certificate for the download, but it is susceptible to man-in-the-middle attacks.")
|
||||
return fmt.Errorf("%s\n\nThe --insecure-skip-tls-verify flag can also be used to accept any TLS certificate for the download, but it is susceptible to man-in-the-middle attacks", err.Error())
|
||||
}
|
||||
}
|
||||
return err
|
||||
|
|
|
@ -555,7 +555,7 @@ func (r *backupDeletionReconciler) deleteMovedSnapshots(ctx context.Context, bac
|
|||
directSnapshots := map[string][]repotypes.SnapshotIdentifier{}
|
||||
for i := range list.Items {
|
||||
cm := list.Items[i]
|
||||
if cm.Data == nil || len(cm.Data) == 0 {
|
||||
if len(cm.Data) == 0 {
|
||||
errs = append(errs, errors.New("no snapshot info in config"))
|
||||
continue
|
||||
}
|
||||
|
|
|
@ -879,7 +879,6 @@ var _ = Describe("Backup Sync Reconciler", func() {
|
|||
},
|
||||
}
|
||||
for _, test := range testCases {
|
||||
test := test
|
||||
It(test.name, func() {
|
||||
logger := velerotest.NewLogger()
|
||||
b := backupSyncReconciler{
|
||||
|
|
|
@ -514,12 +514,12 @@ func TestDataDownloadReconcile(t *testing.T) {
|
|||
}
|
||||
if test.dd.Namespace == velerov1api.DefaultNamespace {
|
||||
if controllerutil.ContainsFinalizer(test.dd, DataUploadDownloadFinalizer) {
|
||||
assert.True(t, true, apierrors.IsNotFound(err))
|
||||
assert.True(t, true, apierrors.IsNotFound(err)) //nolint:testifylint //FIXME
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
}
|
||||
} else {
|
||||
assert.True(t, true, apierrors.IsNotFound(err))
|
||||
assert.True(t, true, apierrors.IsNotFound(err)) //nolint:testifylint //FIXME
|
||||
}
|
||||
|
||||
if !test.needCreateFSBR {
|
||||
|
|
|
@ -408,10 +408,10 @@ func (r *restoreReconciler) validateAndComplete(restore *api.Restore) (backupInf
|
|||
}
|
||||
resourceModifiers, err = resourcemodifiers.GetResourceModifiersFromConfig(ResourceModifierConfigMap)
|
||||
if err != nil {
|
||||
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, errors.Wrapf(err, fmt.Sprintf("Error in parsing resource modifiers provided in configmap %s/%s", restore.Namespace, restore.Spec.ResourceModifier.Name)).Error())
|
||||
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, errors.Wrapf(err, "Error in parsing resource modifiers provided in configmap %s/%s", restore.Namespace, restore.Spec.ResourceModifier.Name).Error())
|
||||
return backupInfo{}, nil
|
||||
} else if err = resourceModifiers.Validate(); err != nil {
|
||||
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, errors.Wrapf(err, fmt.Sprintf("Validation error in resource modifiers provided in configmap %s/%s", restore.Namespace, restore.Spec.ResourceModifier.Name)).Error())
|
||||
restore.Status.ValidationErrors = append(restore.Status.ValidationErrors, errors.Wrapf(err, "Validation error in resource modifiers provided in configmap %s/%s", restore.Namespace, restore.Spec.ResourceModifier.Name).Error())
|
||||
return backupInfo{}, nil
|
||||
}
|
||||
r.logger.Infof("Retrieved Resource modifiers provided in configmap %s/%s", restore.Namespace, restore.Spec.ResourceModifier.Name)
|
||||
|
|
|
@ -89,12 +89,12 @@ func TestResetVolumeSnapshotSpecForRestore(t *testing.T) {
|
|||
resetVolumeSnapshotSpecForRestore(&tc.vs, &tc.vscName)
|
||||
|
||||
assert.Equalf(t, tc.vs.Name, before.Name, "unexpected change to Object.Name, Want: %s; Got %s", before.Name, tc.vs.Name)
|
||||
assert.Equal(t, tc.vs.Namespace, before.Namespace, "unexpected change to Object.Namespace, Want: %s; Got %s", tc.name, before.Namespace, tc.vs.Namespace)
|
||||
assert.Equalf(t, tc.vs.Namespace, before.Namespace, "unexpected change to Object.Namespace, Want: %s; Got %s", before.Namespace, tc.vs.Namespace)
|
||||
assert.NotNil(t, tc.vs.Spec.Source)
|
||||
assert.Nil(t, tc.vs.Spec.Source.PersistentVolumeClaimName)
|
||||
assert.NotNil(t, tc.vs.Spec.Source.VolumeSnapshotContentName)
|
||||
assert.Equal(t, *tc.vs.Spec.Source.VolumeSnapshotContentName, tc.vscName)
|
||||
assert.Equal(t, *tc.vs.Spec.VolumeSnapshotClassName, *before.Spec.VolumeSnapshotClassName, "unexpected value for Spec.VolumeSnapshotClassName, Want: %s, Got: %s",
|
||||
assert.Equalf(t, *tc.vs.Spec.VolumeSnapshotClassName, *before.Spec.VolumeSnapshotClassName, "unexpected value for Spec.VolumeSnapshotClassName, Want: %s, Got: %s",
|
||||
*tc.vs.Spec.VolumeSnapshotClassName, *before.Spec.VolumeSnapshotClassName)
|
||||
assert.Nil(t, tc.vs.Status)
|
||||
})
|
||||
|
|
|
@ -158,7 +158,7 @@ func (di *FakeServerResourcesInterface) ServerPreferredResources() ([]*metav1.AP
|
|||
if di.ReturnError != nil {
|
||||
return di.ResourceList, di.ReturnError
|
||||
}
|
||||
if di.FailedGroups == nil || len(di.FailedGroups) == 0 {
|
||||
if len(di.FailedGroups) == 0 {
|
||||
return di.ResourceList, nil
|
||||
}
|
||||
return di.ResourceList, &discovery.ErrGroupDiscoveryFailed{Groups: di.FailedGroups}
|
||||
|
@ -168,7 +168,7 @@ func (di *FakeServerResourcesInterface) ServerGroupsAndResources() ([]*metav1.AP
|
|||
if di.ReturnError != nil {
|
||||
return di.APIGroup, di.ResourceList, di.ReturnError
|
||||
}
|
||||
if di.FailedGroups == nil || len(di.FailedGroups) == 0 {
|
||||
if len(di.FailedGroups) == 0 {
|
||||
return di.APIGroup, di.ResourceList, nil
|
||||
}
|
||||
return di.APIGroup, di.ResourceList, &discovery.ErrGroupDiscoveryFailed{Groups: di.FailedGroups}
|
||||
|
|
|
@ -8,7 +8,8 @@ import (
|
|||
)
|
||||
|
||||
// Client knows how to perform CRUD operations on Kubernetes objects.
|
||||
// go:generate mockery --name=Client
|
||||
//
|
||||
//go:generate mockery --name=Client
|
||||
type Client interface {
|
||||
client.Reader
|
||||
client.Writer
|
||||
|
|
|
@ -83,7 +83,7 @@ func WaitPVCBound(ctx context.Context, pvcGetter corev1client.CoreV1Interface,
|
|||
err := wait.PollUntilContextTimeout(ctx, waitInternal, timeout, true, func(ctx context.Context) (bool, error) {
|
||||
tmpPVC, err := pvcGetter.PersistentVolumeClaims(namespace).Get(ctx, pvc, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, fmt.Sprintf("error to get pvc %s/%s", namespace, pvc))
|
||||
return false, errors.Wrapf(err, "error to get pvc %s/%s", namespace, pvc)
|
||||
}
|
||||
|
||||
if tmpPVC.Spec.VolumeName == "" {
|
||||
|
@ -318,7 +318,7 @@ func WaitPVBound(ctx context.Context, pvGetter corev1client.CoreV1Interface, pvN
|
|||
err := wait.PollUntilContextTimeout(ctx, waitInternal, timeout, true, func(ctx context.Context) (bool, error) {
|
||||
tmpPV, err := pvGetter.PersistentVolumes().Get(ctx, pvName, metav1.GetOptions{})
|
||||
if err != nil {
|
||||
return false, errors.Wrapf(err, fmt.Sprintf("failed to get pv %s", pvName))
|
||||
return false, errors.Wrapf(err, "failed to get pv %s", pvName)
|
||||
}
|
||||
|
||||
if tmpPV.Spec.ClaimRef == nil {
|
||||
|
|
|
@ -58,7 +58,7 @@ func (c *CSIDataMoverVolumeInfo) Verify() error {
|
|||
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")
|
||||
|
||||
fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
|
||||
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
|
||||
Expect(volumeInfo).ToNot(BeEmpty())
|
||||
Expect(volumeInfo[0].SnapshotDataMovementInfo).NotTo(BeNil())
|
||||
|
||||
return nil
|
||||
|
|
|
@ -57,7 +57,7 @@ func (c *CSISnapshotVolumeInfo) Verify() error {
|
|||
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")
|
||||
|
||||
fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
|
||||
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
|
||||
Expect(volumeInfo).ToNot(BeEmpty())
|
||||
Expect(volumeInfo[0].CSISnapshotInfo).NotTo(BeNil())
|
||||
|
||||
return nil
|
||||
|
|
|
@ -57,7 +57,7 @@ func (f *FilesystemUploadVolumeInfo) Verify() error {
|
|||
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")
|
||||
|
||||
fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
|
||||
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
|
||||
Expect(volumeInfo).ToNot(BeEmpty())
|
||||
Expect(volumeInfo[0].PVBInfo).NotTo(BeNil())
|
||||
|
||||
return nil
|
||||
|
|
|
@ -58,7 +58,7 @@ func (n *NativeSnapshotVolumeInfo) Verify() error {
|
|||
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")
|
||||
|
||||
fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
|
||||
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
|
||||
Expect(volumeInfo).ToNot(BeEmpty())
|
||||
Expect(volumeInfo[0].NativeSnapshotInfo).NotTo(BeNil())
|
||||
|
||||
return nil
|
||||
|
|
|
@ -57,7 +57,7 @@ func (s *SkippedVolumeInfo) Verify() error {
|
|||
Expect(err).ShouldNot(HaveOccurred(), "Fail to get VolumeInfo metadata in the Backup Repository.")
|
||||
|
||||
fmt.Printf("The VolumeInfo metadata content: %+v\n", *volumeInfo[0])
|
||||
Expect(len(volumeInfo) > 0).To(BeIdenticalTo(true))
|
||||
Expect(volumeInfo).ToNot(BeEmpty())
|
||||
Expect(volumeInfo[0].Skipped).To(BeIdenticalTo(true))
|
||||
|
||||
return nil
|
||||
|
|
|
@ -111,7 +111,7 @@ func (e *ExcludeResources) Verify() error {
|
|||
}
|
||||
return errors.Wrap(err, fmt.Sprintf("failed to list secrets in namespace: %q", namespace))
|
||||
} else if len(secretsList.Items) != 0 {
|
||||
return errors.Errorf(fmt.Sprintf("Should no secrets found %s in namespace: %q", secretsList.Items[0].Name, namespace))
|
||||
return errors.Errorf("Should no secrets found %s in namespace: %q", secretsList.Items[0].Name, namespace)
|
||||
}
|
||||
|
||||
//Check configmap
|
||||
|
@ -119,7 +119,7 @@ func (e *ExcludeResources) Verify() error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("failed to list configmap in namespace: %q", namespace))
|
||||
} else if len(configmapList.Items) == 0 {
|
||||
return errors.Errorf(fmt.Sprintf("Should have configmap found in namespace: %q", namespace))
|
||||
return errors.Errorf("Should have configmap found in namespace: %q", namespace)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -107,7 +107,7 @@ func (i *IncludeResources) Verify() error {
|
|||
}
|
||||
return errors.Wrap(err, fmt.Sprintf("failed to list secrets in namespace: %q", namespace))
|
||||
} else if len(secretsList.Items) != 0 {
|
||||
return errors.Errorf(fmt.Sprintf("Should no secrets found %s in namespace: %q", secretsList.Items[0].Name, namespace))
|
||||
return errors.Errorf("Should no secrets found %s in namespace: %q", secretsList.Items[0].Name, namespace)
|
||||
}
|
||||
|
||||
//Check configmap
|
||||
|
@ -115,7 +115,7 @@ func (i *IncludeResources) Verify() error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("failed to list configmap in namespace: %q", namespace))
|
||||
} else if len(configmapList.Items) == 0 {
|
||||
return errors.Errorf(fmt.Sprintf("Should have configmap found in namespace: %q", namespace))
|
||||
return errors.Errorf("Should have configmap found in namespace: %q", namespace)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
|
|
|
@ -142,7 +142,7 @@ func (l *LabelSelector) Verify() error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, fmt.Sprintf("failed to list secrets in namespace: %q", namespace))
|
||||
} else if len(secretsList.Items) == 0 {
|
||||
return errors.Errorf(fmt.Sprintf("no secrets found in namespace: %q", namespace))
|
||||
return errors.Errorf("no secrets found in namespace: %q", namespace)
|
||||
}
|
||||
} else { //exclude
|
||||
if err == nil {
|
||||
|
|
|
@ -77,7 +77,7 @@ func WaitForPods(ctx context.Context, client TestClient, namespace string, pods
|
|||
return true, nil
|
||||
})
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("Failed to wait for pods in namespace %s to start running", namespace))
|
||||
return errors.Wrapf(err, "Failed to wait for pods in namespace %s to start running", namespace)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -333,7 +333,7 @@ func generateData(ctx context.Context, namespace string, kibishiiData *KibishiiD
|
|||
})
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("Failed to wait generate data in namespace %s", namespace))
|
||||
return errors.Wrapf(err, "Failed to wait generate data in namespace %s", namespace)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ func verifyData(ctx context.Context, namespace string, kibishiiData *KibishiiDat
|
|||
})
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("Failed to verify kibishii data in namespace %s\n", namespace))
|
||||
return errors.Wrapf(err, "Failed to verify kibishii data in namespace %s\n", namespace)
|
||||
}
|
||||
fmt.Printf("Success to verify kibishii data in namespace %s\n", namespace)
|
||||
return nil
|
||||
|
@ -430,7 +430,7 @@ func KibishiiVerifyAfterRestore(client TestClient, kibishiiNamespace string, one
|
|||
for _, pod := range KibishiiPodNameList {
|
||||
exist, err := FileExistInPV(oneHourTimeout, kibishiiNamespace, pod, "kibishii", "data", incrementalFileName)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("fail to get file %s", incrementalFileName))
|
||||
return errors.Wrapf(err, "fail to get file %s", incrementalFileName)
|
||||
}
|
||||
|
||||
if exist {
|
||||
|
|
|
@ -168,7 +168,7 @@ func getStorageAccountKey(credentialsFile, accountName, subscriptionID, resource
|
|||
if err != nil {
|
||||
return "", errors.WithStack(err)
|
||||
}
|
||||
if res.Keys == nil || len(res.Keys) == 0 {
|
||||
if len(res.Keys) == 0 {
|
||||
return "", errors.New("No storage keys found")
|
||||
}
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ func (s GCSStorage) DeleteObjectsInBucket(cloudCredentialsFile, bslBucket, bslPr
|
|||
if strings.Contains(obj.Name, bslPrefix+backupObject+"/") {
|
||||
fmt.Printf("Delete item: %s\n", obj.Name)
|
||||
if err = bucket.Object(obj.Name).Delete(ctx); err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("Fail to delete object %s in bucket %s", obj.Name, bslBucket))
|
||||
return errors.Wrapf(err, "Fail to delete object %s in bucket %s", obj.Name, bslBucket)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -107,12 +107,12 @@ func (s GCSStorage) IsSnapshotExisted(cloudCredentialsFile, bslConfig, backupObj
|
|||
ctx := context.Background()
|
||||
data, err := os.ReadFile(cloudCredentialsFile)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("Failed reading gcloud credential file %s", cloudCredentialsFile))
|
||||
return errors.Wrapf(err, "Failed reading gcloud credential file %s", cloudCredentialsFile)
|
||||
}
|
||||
|
||||
creds, err := google.CredentialsFromJSON(ctx, data)
|
||||
if err != nil {
|
||||
return errors.Wrapf(err, fmt.Sprintf("Failed getting credentials from JSON data %s", string(data)))
|
||||
return errors.Wrapf(err, "Failed getting credentials from JSON data %s", string(data))
|
||||
}
|
||||
|
||||
computeService, err := compute.NewService(context.Background(), option.WithCredentialsFile(cloudCredentialsFile))
|
||||
|
|
Loading…
Reference in New Issue