You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: convergence_test.go
    path of file: ./repos/cockroach/pkg/gossip
    
    the code of the file until where you have to start completion: // Copyright 2014 The Cockroach Authors.
//
// Use of this software is governed by the Business Source License
// included in the file licenses/BSL.txt.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License, Version 2.0, included in the file
// licenses/APL.txt.

package gossip_test

import (
	"context"
	"testing"

	"github.com/cockroachdb/cockroach/pkg/gossip/simulation"
	"github.com/cockroachdb/cockroach/pkg/testutils/skip"
	"github.com/cockroachdb/cockroach/pkg/util/leaktest"
	"github.com/cockroachdb/cockroach/pkg/util/log"
	"github.com/cockroachdb/cockroach/pkg/util/stop"
)

// The tests in this package have fairly small cluster sizes for the sake of
// not takin
    
func TestNetworkReachesEquilibrium(t *testing.T) {
	defer leaktest.AfterTest(t)()
	skip.UnderStress(t)

	stopper := stop.NewStopper()
	defer stopper.Stop(context.Background())

	network := simulation.NewNetwork(stopper, testReachesEquilibriumSize, true)

	var connsRefused int64
	var cyclesWithoutChange int
	var numCycles int
	network.SimulateNetwork(func(cycle int, network *simulation.Network) bool {
		numCycles = cycle
		newConnsRefused := connectionsRefused(network)
		if newConnsRefused > connsRefused {
			connsRefused = newConnsRefused
			cyclesWithoutChange = 0
		} else {
			cyclesWithoutChange++
		}
		if cycle%5 == 0 {
			log.Infof(context.Background(), "cycle: %d, cyclesWithoutChange: %d, fullyConnected: %v",
				cycle, cyclesWithoutChange, network.IsNetworkConnected())
		}
		return cyclesWithoutChange < 5
	})

	const maxCycles = 200
	if numCycles > maxCycles {
		log.Warningf(context.Background(), "expected a non-thrashing network within %d cycles; took %d",
			maxCycles, numCycles)
	}

	const maxConnsRefused = 500
	if connsRefused > maxConnsRefused {
		log.Warningf(context.Background(),
			"expected thrashing to die down with <= %d connections refused; took %d",
			maxConnsRefused, connsRefused)
	}
}