Skip to content

Commit 30a5db1

Browse files
authored
Merge pull request kubernetes#86057 from SataQiu/fix-staticcheck-20191209
Fix staticcheck failures of e2e/storage/drivers e2e/storage/testsuites
2 parents 658564d + 3ed535a commit 30a5db1

File tree

6 files changed

+7
-21
lines changed

6 files changed

+7
-21
lines changed

hack/.staticcheck_failures

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ test/e2e/autoscaling
6767
test/e2e/instrumentation/logging/stackdriver
6868
test/e2e/instrumentation/monitoring
6969
test/e2e/manifest
70-
test/e2e/storage/drivers
71-
test/e2e/storage/testsuites
7270
test/e2e/storage/utils
7371
test/e2e/storage/vsphere
7472
test/images/agnhost/dns

test/e2e/storage/drivers/in_tree.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,6 @@ func (v *rbdVolume) DeleteVolume() {
576576

577577
// Ceph
578578
type cephFSDriver struct {
579-
serverIP string
580-
serverPod *v1.Pod
581-
secret *v1.Secret
582-
583579
driverInfo testsuites.DriverInfo
584580
}
585581

@@ -690,8 +686,6 @@ func (v *cephVolume) DeleteVolume() {
690686

691687
// Hostpath
692688
type hostPathDriver struct {
693-
node v1.Node
694-
695689
driverInfo testsuites.DriverInfo
696690
}
697691

@@ -758,8 +752,6 @@ func (h *hostPathDriver) CreateVolume(config *testsuites.PerTestConfig, volType
758752

759753
// HostPathSymlink
760754
type hostPathSymlinkDriver struct {
761-
node v1.Node
762-
763755
driverInfo testsuites.DriverInfo
764756
}
765757

test/e2e/storage/testsuites/base.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -649,14 +649,6 @@ func getMigrationVolumeOpCounts(cs clientset.Interface, pluginName string) (opCo
649649
return opCounts{}, opCounts{}
650650
}
651651

652-
func getTotOps(ops opCounts) int64 {
653-
var tot = int64(0)
654-
for _, count := range ops {
655-
tot += count
656-
}
657-
return tot
658-
}
659-
660652
func validateMigrationVolumeOpCounts(cs clientset.Interface, pluginName string, oldInTreeOps, oldMigratedOps opCounts) {
661653
if len(pluginName) == 0 {
662654
// This is a native CSI Driver and we don't check ops

test/e2e/storage/testsuites/provisioning.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ func (t StorageClassTest) TestBindingWaitForFirstConsumerMultiPVC(claims []*v1.P
468468
framework.ExpectNoError(err)
469469
}
470470
defer func() {
471-
var errors map[string]error
471+
errors := map[string]error{}
472472
for _, claim := range createdClaims {
473473
err := e2epv.DeletePersistentVolumeClaim(t.Client, claim.Name, claim.Namespace)
474474
if err != nil {

test/e2e/storage/testsuites/topology.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ func (t *topologyTestSuite) DefineTests(driver TestDriver, pattern testpatterns.
104104
f := framework.NewDefaultFramework("topology")
105105

106106
init := func() topologyTest {
107-
const numTestTopologies = 2
108107

109108
l := topologyTest{}
110109

test/e2e/storage/testsuites/volumelimits.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,12 +191,17 @@ func (t *volumeLimitsTestSuite) DefineTests(driver TestDriver, pattern testpatte
191191
e2epod.SetAffinity(&selection, nodeName)
192192
pod.Spec.Affinity = selection.Affinity
193193
l.unschedulablePod, err = l.cs.CoreV1().Pods(l.ns.Name).Create(pod)
194+
framework.ExpectNoError(err, "Failed to create an extra pod with one volume to exceed the limit")
194195

195196
ginkgo.By("Waiting for the pod to get unschedulable with the right message")
196197
err = e2epod.WaitForPodCondition(l.cs, l.ns.Name, l.unschedulablePod.Name, "Unschedulable", framework.PodStartTimeout, func(pod *v1.Pod) (bool, error) {
197198
if pod.Status.Phase == v1.PodPending {
199+
reg, err := regexp.Compile(`max.+volume.+count`)
200+
if err != nil {
201+
return false, err
202+
}
198203
for _, cond := range pod.Status.Conditions {
199-
matched, _ := regexp.MatchString("max.+volume.+count", cond.Message)
204+
matched := reg.MatchString(cond.Message)
200205
if cond.Type == v1.PodScheduled && cond.Status == v1.ConditionFalse && cond.Reason == "Unschedulable" && matched {
201206
return true, nil
202207
}

0 commit comments

Comments
 (0)