Skip to content

Commit 656e150

Browse files
committed
chore: apply gofumpt in test packages
Signed-off-by: Matthieu MOREL <[email protected]>
1 parent ddc1bcb commit 656e150

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+270
-173
lines changed

test/e2e/backup/backup.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func BackupRestoreTest(backupRestoreTestConfig BackupRestoreTestConfig) {
120120
It("should be successfully backed up and restored to the default BackupStorageLocation", func() {
121121
if InstallVelero {
122122
if useVolumeSnapshots {
123-
//Install node agent also
123+
// Install node agent also
124124
veleroCfg.UseNodeAgent = useVolumeSnapshots
125125
// DefaultVolumesToFsBackup should be mutually exclusive with useVolumeSnapshots in installation CLI,
126126
// otherwise DefaultVolumesToFsBackup need to be set to false in backup CLI when taking volume snapshot
@@ -162,7 +162,7 @@ func BackupRestoreTest(backupRestoreTestConfig BackupRestoreTestConfig) {
162162
if InstallVelero {
163163
if useVolumeSnapshots {
164164
veleroCfg.DefaultVolumesToFsBackup = !useVolumeSnapshots
165-
} else { //FS volume backup
165+
} else { // FS volume backup
166166
// Install VolumeSnapshots also
167167
veleroCfg.UseVolumeSnapshots = !useVolumeSnapshots
168168
// DefaultVolumesToFsBackup is false in installation CLI here,

test/e2e/backups/deletion.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func BackupDeletionWithSnapshots() {
4343
func BackupDeletionWithRestic() {
4444
backup_deletion_test(false)
4545
}
46+
4647
func backup_deletion_test(useVolumeSnapshots bool) {
4748
veleroCfg := VeleroCfg
4849
veleroCfg.UseVolumeSnapshots = useVolumeSnapshots
@@ -81,7 +82,8 @@ func backup_deletion_test(useVolumeSnapshots bool) {
8182

8283
// runUpgradeTests runs upgrade test on the provider by kibishii.
8384
func runBackupDeletionTests(client TestClient, veleroCfg VeleroConfig, backupLocation string,
84-
useVolumeSnapshots bool, kibishiiDirectory string) error {
85+
useVolumeSnapshots bool, kibishiiDirectory string,
86+
) error {
8587
var err error
8688
var snapshotCheckPoint SnapshotCheckPoint
8789
backupName := "backup-" + UUIDgen.String()

test/e2e/backups/sync_backups.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,7 @@ func (b *SyncBackups) Init() {
5050

5151
func BackupsSyncTest() {
5252
test := new(SyncBackups)
53-
var (
54-
err error
55-
)
53+
var err error
5654
veleroCfg := VeleroCfg
5755
BeforeEach(func() {
5856
flag.Parse()

test/e2e/basic/api-group/enable_api_group_extentions.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ import (
3030
)
3131

3232
func APIExtensionsVersionsTest() {
33-
var (
34-
backupName, restoreName string
35-
)
33+
var backupName, restoreName string
3634

3735
resourceName := "apiextensions.k8s.io"
3836
crdName := "rocknrollbands.music.example.io"

test/e2e/basic/backup-volume-info/base.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ func (v *BackupVolumeInfo) Start() error {
9696
v.TestCase.Start()
9797
return nil
9898
}
99+
99100
func (v *BackupVolumeInfo) CreateResources() error {
100101
labels := map[string]string{
101102
"volume-info": "true",

test/e2e/basic/namespace-mapping.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ type NamespaceMapping struct {
2121

2222
const NamespaceBaseName string = "ns-mp-"
2323

24-
var OneNamespaceMappingResticTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 1, UseVolumeSnapshots: false}})
25-
var MultiNamespacesMappingResticTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 2, UseVolumeSnapshots: false}})
26-
var OneNamespaceMappingSnapshotTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 1, UseVolumeSnapshots: true}})
27-
var MultiNamespacesMappingSnapshotTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 2, UseVolumeSnapshots: true}})
24+
var (
25+
OneNamespaceMappingResticTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 1, UseVolumeSnapshots: false}})
26+
MultiNamespacesMappingResticTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 2, UseVolumeSnapshots: false}})
27+
OneNamespaceMappingSnapshotTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 1, UseVolumeSnapshots: true}})
28+
MultiNamespacesMappingSnapshotTest func() = TestFunc(&NamespaceMapping{TestCase: TestCase{NamespacesTotal: 2, UseVolumeSnapshots: true}})
29+
)
2830

2931
func (n *NamespaceMapping) Init() error {
3032
n.TestCase.Init()

test/e2e/basic/nodeport.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,8 @@ func (n *NodePort) Restore() error {
166166
}
167167

168168
func createServiceWithNodeport(ctx context.Context, client TestClient, namespace string,
169-
service string, labels map[string]string, nodePort int32) error {
169+
service string, labels map[string]string, nodePort int32,
170+
) error {
170171
serviceSpec := &v1.ServiceSpec{
171172
Ports: []v1.ServicePort{
172173
{

test/e2e/basic/pvc-selected-node-changing.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,10 @@ func (p *PVCSelectedNodeChanging) Init() error {
4343
}
4444
p.BackupName = "backup-" + p.CaseBaseName
4545
p.RestoreName = "restore-" + p.CaseBaseName
46-
p.labels = map[string]string{"velero.io/plugin-config": "",
47-
"velero.io/change-pvc-node-selector": "RestoreItemAction"}
46+
p.labels = map[string]string{
47+
"velero.io/plugin-config": "",
48+
"velero.io/change-pvc-node-selector": "RestoreItemAction",
49+
}
4850
p.configmaptName = "change-pvc-node-selector-config"
4951
p.volume = "volume-1"
5052
p.podName = "pod-1"
@@ -128,6 +130,7 @@ func (p *PVCSelectedNodeChanging) Restore() error {
128130
})
129131
return nil
130132
}
133+
131134
func (p *PVCSelectedNodeChanging) Verify() error {
132135
By(fmt.Sprintf("PVC selected node should be %s", p.newNodeName), func() {
133136
pvcNameList, err := GetPvcByPVCName(p.Ctx, p.mappedNS, p.pvcName)

test/e2e/basic/resources-check/namespaces_annotation.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ func (n *NSAnnotationCase) Verify() error {
7676
checkNSName := fmt.Sprintf("%s-%00000d", n.CaseBaseName, nsNum)
7777
checkAnnoName := fmt.Sprintf("annotation-%s-%00000d", n.CaseBaseName, nsNum)
7878
checkNS, err := GetNamespace(n.Ctx, n.Client, checkNSName)
79-
8079
if err != nil {
8180
return errors.Wrapf(err, "Could not retrieve test namespace %s", checkNSName)
8281
}

test/e2e/basic/resources-check/rbac.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,8 @@ func (r *RBACCase) Verify() error {
112112
return errors.Errorf("Retrieved namespace for %s has name %s instead", checkNSName, checkNS.Name)
113113
}
114114

115-
//getting service account from the restore
115+
// getting service account from the restore
116116
checkSA, err := GetServiceAccount(r.Ctx, r.Client, checkNSName, checkServiceAccountName)
117-
118117
if err != nil {
119118
return errors.Wrapf(err, "Could not retrieve test service account %s", checkSA)
120119
}
@@ -123,9 +122,8 @@ func (r *RBACCase) Verify() error {
123122
return errors.Errorf("Retrieved service account for %s has name %s instead", checkServiceAccountName, checkSA.Name)
124123
}
125124

126-
//getting cluster role from the restore
125+
// getting cluster role from the restore
127126
checkClusterRole, err := GetClusterRole(r.Ctx, r.Client, checkClusterRoleName)
128-
129127
if err != nil {
130128
return errors.Wrapf(err, "Could not retrieve test cluster role %s", checkClusterRole)
131129
}
@@ -134,9 +132,8 @@ func (r *RBACCase) Verify() error {
134132
return errors.Errorf("Retrieved cluster role for %s has name %s instead", checkClusterRoleName, checkClusterRole.Name)
135133
}
136134

137-
//getting cluster role binding from the restore
135+
// getting cluster role binding from the restore
138136
checkClusterRoleBinding, err := GetClusterRoleBinding(r.Ctx, r.Client, checkClusterRoleBindingName)
139-
140137
if err != nil {
141138
return errors.Wrapf(err, "Could not retrieve test cluster role binding %s", checkClusterRoleBinding)
142139
}
@@ -145,7 +142,7 @@ func (r *RBACCase) Verify() error {
145142
return errors.Errorf("Retrieved cluster role binding for %s has name %s instead", checkClusterRoleBindingName, checkClusterRoleBinding.Name)
146143
}
147144

148-
//check if the role binding maps to service account
145+
// check if the role binding maps to service account
149146
checkSubjects := checkClusterRoleBinding.Subjects[0].Name
150147

151148
if checkSubjects != checkServiceAccountName {
@@ -156,13 +153,13 @@ func (r *RBACCase) Verify() error {
156153
}
157154

158155
func (r *RBACCase) Destroy() error {
159-
//cleanup clusterrole
156+
// cleanup clusterrole
160157
err := CleanupClusterRole(r.Ctx, r.Client, r.CaseBaseName)
161158
if err != nil {
162159
return errors.Wrap(err, "Could not cleanup clusterroles")
163160
}
164161

165-
//cleanup cluster rolebinding
162+
// cleanup cluster rolebinding
166163
err = CleanupClusterRoleBinding(r.Ctx, r.Client, r.CaseBaseName)
167164
if err != nil {
168165
return errors.Wrap(err, "Could not cleanup clusterrolebindings")

0 commit comments

Comments
 (0)