Skip to content

Commit 222dd0a

Browse files
authored
Merge pull request kubernetes#71022 from emwalker/68026-golint-fixes-5
Remove test/integration/* from hack/.golint_failures
2 parents 098075c + 75df4dc commit 222dd0a

19 files changed

+115
-105
lines changed

hack/.golint_failures

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -669,12 +669,4 @@ test/e2e_node/environment
669669
test/e2e_node/remote
670670
test/e2e_node/runner/remote
671671
test/e2e_node/services
672-
test/integration
673-
test/integration/auth
674-
test/integration/evictions
675-
test/integration/framework
676-
test/integration/master
677-
test/integration/replicaset
678-
test/integration/replicationcontroller
679-
test/integration/scheduler
680672
test/utils

test/integration/auth/auth_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ var aBinding string = `
228228
}
229229
`
230230

231-
var emptyEndpoints string = `
231+
var emptyEndpoints = `
232232
{
233233
"kind": "Endpoints",
234234
"apiVersion": "v1",
@@ -493,10 +493,10 @@ func parseResourceVersion(response []byte) (string, float64, error) {
493493
}
494494

495495
func getPreviousResourceVersionKey(url, id string) string {
496-
baseUrl := strings.Split(url, "?")[0]
497-
key := baseUrl
496+
baseURL := strings.Split(url, "?")[0]
497+
key := baseURL
498498
if id != "" {
499-
key = fmt.Sprintf("%s/%v", baseUrl, id)
499+
key = fmt.Sprintf("%s/%v", baseURL, id)
500500
}
501501
return key
502502
}
@@ -1075,8 +1075,8 @@ func TestKindAuthorization(t *testing.T) {
10751075
if r.verb == "PUT" && r.body != "" {
10761076
// For update operations, insert previous resource version
10771077
if resVersion := previousResourceVersion[getPreviousResourceVersionKey(r.URL, "")]; resVersion != 0 {
1078-
resourceVersionJson := fmt.Sprintf(",\r\n\"resourceVersion\": \"%v\"", resVersion)
1079-
bodyStr = fmt.Sprintf(r.body, resourceVersionJson)
1078+
resourceVersionJSON := fmt.Sprintf(",\r\n\"resourceVersion\": \"%v\"", resVersion)
1079+
bodyStr = fmt.Sprintf(r.body, resourceVersionJSON)
10801080
}
10811081
}
10821082
}

test/integration/auth/bootstraptoken_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func (b bootstrapSecrets) Get(name string) (*corev1.Secret, error) {
4747

4848
// TestBootstrapTokenAuth tests the bootstrap token auth provider
4949
func TestBootstrapTokenAuth(t *testing.T) {
50-
tokenId, err := bootstraputil.GenerateTokenId()
50+
tokenID, err := bootstraputil.GenerateTokenId()
5151
if err != nil {
5252
t.Fatalf("unexpected error: %v", err)
5353
}
@@ -62,7 +62,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
6262
},
6363
Type: corev1.SecretTypeBootstrapToken,
6464
Data: map[string][]byte{
65-
bootstrapapi.BootstrapTokenIDKey: []byte(tokenId),
65+
bootstrapapi.BootstrapTokenIDKey: []byte(tokenID),
6666
bootstrapapi.BootstrapTokenSecretKey: []byte(secret),
6767
bootstrapapi.BootstrapTokenUsageAuthentication: []byte("true"),
6868
},
@@ -74,7 +74,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
7474
},
7575
Type: corev1.SecretTypeBootstrapToken,
7676
Data: map[string][]byte{
77-
bootstrapapi.BootstrapTokenIDKey: []byte(tokenId),
77+
bootstrapapi.BootstrapTokenIDKey: []byte(tokenID),
7878
bootstrapapi.BootstrapTokenSecretKey: []byte("invalid"),
7979
bootstrapapi.BootstrapTokenUsageAuthentication: []byte("true"),
8080
},
@@ -86,7 +86,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
8686
},
8787
Type: corev1.SecretTypeBootstrapToken,
8888
Data: map[string][]byte{
89-
bootstrapapi.BootstrapTokenIDKey: []byte(tokenId),
89+
bootstrapapi.BootstrapTokenIDKey: []byte(tokenID),
9090
bootstrapapi.BootstrapTokenSecretKey: []byte("invalid"),
9191
bootstrapapi.BootstrapTokenUsageAuthentication: []byte("true"),
9292
bootstrapapi.BootstrapTokenExpirationKey: []byte(bootstraputil.TimeStringFromNow(-time.Hour)),
@@ -134,7 +134,7 @@ func TestBootstrapTokenAuth(t *testing.T) {
134134
previousResourceVersion := make(map[string]float64)
135135
transport := http.DefaultTransport
136136

137-
token := tokenId + "." + secret
137+
token := tokenID + "." + secret
138138
var bodyStr string
139139
if test.request.body != "" {
140140
sub := ""

test/integration/evictions/evictions_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ func TestConcurrentEvictionRequests(t *testing.T) {
9595

9696
waitPDBStable(t, clientSet, numOfEvictions, ns.Name, pdb.Name)
9797

98-
var numberPodsEvicted uint32 = 0
98+
var numberPodsEvicted uint32
9999
errCh := make(chan error, 3*numOfEvictions)
100100
var wg sync.WaitGroup
101101
// spawn numOfEvictions goroutines to concurrently evict the pods

test/integration/framework/master_utils.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,13 @@ type MasterHolder struct {
103103
M *master.Master
104104
}
105105

106+
// SetMaster assigns the current master.
106107
func (h *MasterHolder) SetMaster(m *master.Master) {
107108
h.M = m
108109
close(h.Initialized)
109110
}
110111

112+
// DefaultOpenAPIConfig returns an openapicommon.Config initialized to default values.
111113
func DefaultOpenAPIConfig() *openapicommon.Config {
112114
openAPIConfig := genericapiserver.DefaultOpenAPIConfig(openapi.GetOpenAPIDefinitions, openapinamer.NewDefinitionNamer(legacyscheme.Scheme))
113115
openAPIConfig.Info = &spec.Info{
@@ -237,7 +239,7 @@ func startMasterOrDie(masterConfig *master.Config, incomingServer *httptest.Serv
237239
return m, s, closeFn
238240
}
239241

240-
// Returns the master config appropriate for most integration tests.
242+
// NewIntegrationTestMasterConfig returns the master config appropriate for most integration tests.
241243
func NewIntegrationTestMasterConfig() *master.Config {
242244
masterConfig := NewMasterConfig()
243245
masterConfig.GenericConfig.PublicAddress = net.ParseIP("192.168.10.4")
@@ -249,7 +251,7 @@ func NewIntegrationTestMasterConfig() *master.Config {
249251
return masterConfig
250252
}
251253

252-
// Returns a basic master config.
254+
// NewMasterConfig returns a basic master config.
253255
func NewMasterConfig() *master.Config {
254256
// This causes the integration tests to exercise the etcd
255257
// prefix code, so please don't change without ensuring
@@ -336,6 +338,7 @@ func NewMasterConfig() *master.Config {
336338
// CloseFunc can be called to cleanup the master
337339
type CloseFunc func()
338340

341+
// RunAMaster starts a master with the provided config.
339342
func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server, CloseFunc) {
340343
if masterConfig == nil {
341344
masterConfig = NewMasterConfig()
@@ -344,6 +347,7 @@ func RunAMaster(masterConfig *master.Config) (*master.Master, *httptest.Server,
344347
return startMasterOrDie(masterConfig, nil, nil)
345348
}
346349

350+
// RunAMasterUsingServer starts up a master using the provided config on the specified server.
347351
func RunAMasterUsingServer(masterConfig *master.Config, s *httptest.Server, masterReceiver MasterReceiver) (*master.Master, *httptest.Server, CloseFunc) {
348352
return startMasterOrDie(masterConfig, s, masterReceiver)
349353
}

test/integration/framework/perf_utils.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,14 @@ const (
3131
retries = 5
3232
)
3333

34+
// IntegrationTestNodePreparer holds configuration information for the test node preparer.
3435
type IntegrationTestNodePreparer struct {
3536
client clientset.Interface
3637
countToStrategy []testutils.CountToStrategy
3738
nodeNamePrefix string
3839
}
3940

41+
// NewIntegrationTestNodePreparer creates an IntegrationTestNodePreparer configured with defaults.
4042
func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy []testutils.CountToStrategy, nodeNamePrefix string) testutils.TestNodePreparer {
4143
return &IntegrationTestNodePreparer{
4244
client: client,
@@ -45,6 +47,7 @@ func NewIntegrationTestNodePreparer(client clientset.Interface, countToStrategy
4547
}
4648
}
4749

50+
// PrepareNodes prepares countToStrategy test nodes.
4851
func (p *IntegrationTestNodePreparer) PrepareNodes() error {
4952
numNodes := 0
5053
for _, v := range p.countToStrategy {
@@ -96,6 +99,7 @@ func (p *IntegrationTestNodePreparer) PrepareNodes() error {
9699
return nil
97100
}
98101

102+
// CleanupNodes deletes existing test nodes.
99103
func (p *IntegrationTestNodePreparer) CleanupNodes() error {
100104
nodes := e2eframework.GetReadySchedulableNodesOrDie(p.client)
101105
for i := range nodes.Items {

test/integration/framework/test_server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import (
3939
"k8s.io/kubernetes/pkg/master"
4040
)
4141

42+
// TestServerSetup holds configuration information for a kube-apiserver test server.
4243
type TestServerSetup struct {
4344
ModifyServerRunOptions func(*options.ServerRunOptions)
4445
ModifyServerConfig func(*master.Config)

test/integration/framework/util.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ const (
3333
currentPodInfraContainerImageVersion = "3.1"
3434
)
3535

36+
// CreateTestingNamespace creates a namespace for testing.
3637
func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *testing.T) *v1.Namespace {
3738
// TODO: Create a namespace with a given basename.
3839
// Currently we neither create the namespace nor delete all of its contents at the end.
@@ -45,6 +46,7 @@ func CreateTestingNamespace(baseName string, apiserver *httptest.Server, t *test
4546
}
4647
}
4748

49+
// DeleteTestingNamespace is currently a no-op function.
4850
func DeleteTestingNamespace(ns *v1.Namespace, apiserver *httptest.Server, t *testing.T) {
4951
// TODO: Remove all resources from a given namespace once we implement CreateTestingNamespace.
5052
}

test/integration/master/kms_plugin_mock.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ type base64Plugin struct {
4646
encryptRequest chan *kmsapi.EncryptRequest
4747
}
4848

49-
func NewBase64Plugin() (*base64Plugin, error) {
49+
func newBase64Plugin() (*base64Plugin, error) {
5050
listener, err := net.Listen(unixProtocol, sockFile)
5151
if err != nil {
5252
return nil, fmt.Errorf("failed to listen on the unix socket, error: %v", err)

test/integration/master/kms_transformation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (r rawDEKKEKSecret) getPayload() []byte {
8080
// 4. The payload (ex. Secret) should be encrypted via AES CBC transform
8181
// 5. Prefix-EncryptedDEK-EncryptedPayload structure should be deposited to ETCD
8282
func TestKMSProvider(t *testing.T) {
83-
pluginMock, err := NewBase64Plugin()
83+
pluginMock, err := newBase64Plugin()
8484
if err != nil {
8585
t.Fatalf("failed to create mock of KMS Plugin: %v", err)
8686
}

0 commit comments

Comments
 (0)