Skip to content

Commit

Permalink
Merge pull request kubernetes#97779 from tiloso/staticcheck-test-inte…
Browse files Browse the repository at this point in the history
…gration-gs

Fix staticcheck in test/integration/{garbagecollector,scheduler_perf}
  • Loading branch information
k8s-ci-robot authored Mar 11, 2021
2 parents a5b5a68 + e1ceac0 commit 23af91b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
2 changes: 0 additions & 2 deletions hack/.staticcheck_failures
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
cluster/images/etcd/migrate
pkg/controller/replicaset
pkg/kubelet/dockershim
test/integration/garbagecollector
test/integration/scheduler_perf
vendor/k8s.io/apimachinery/pkg/api/apitesting/roundtrip
vendor/k8s.io/apimachinery/pkg/apis/meta/v1/validation
vendor/k8s.io/apimachinery/pkg/runtime/serializer/json
Expand Down
8 changes: 2 additions & 6 deletions test/integration/garbagecollector/garbage_collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,7 @@ func setupRCsPods(t *testing.T, gc *garbagecollector.GarbageCollector, clientSet
}
orphan := false
switch {
//lint:file-ignore SA1019 Keep testing deprecated OrphanDependents option until it's being removed
case options.OrphanDependents == nil && options.PropagationPolicy == nil && len(initialFinalizers) == 0:
// if there are no deletion options, the default policy for replication controllers is orphan
orphan = true
Expand Down Expand Up @@ -1024,12 +1025,7 @@ func TestBlockingOwnerRefDoesBlock(t *testing.T) {
// dependency graph before handling the foreground deletion of the rc.
ctx.startGC(5)
timeout := make(chan struct{})
go func() {
select {
case <-time.After(5 * time.Second):
close(timeout)
}
}()
time.AfterFunc(5*time.Second, func() { close(timeout) })
if !cache.WaitForCacheSync(timeout, gc.IsSynced) {
t.Fatalf("failed to wait for garbage collector to be synced")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,7 @@ func benchmarkScheduling(numExistingPods, minPods int,
testPodStrategy testutils.TestPodCreateStrategy,
b *testing.B) {
if b.N < minPods {
//lint:ignore SA3001 Set a minimum for b.N to get more meaningful results
b.N = minPods
}
finalFunc, podInformer, clientset := mustSetupScheduler()
Expand Down Expand Up @@ -498,7 +499,7 @@ func benchmarkScheduling(numExistingPods, minPods int,
b.StopTimer()
}

// makeBasePodWithSecrets creates a Pod object to be used as a template.
// makeBasePodWithSecret creates a Pod object to be used as a template.
// The pod uses a single Secrets volume.
func makeBasePodWithSecret() *v1.Pod {
basePod := &v1.Pod{
Expand Down

0 comments on commit 23af91b

Please sign in to comment.