Skip to content

Commit

Permalink
Merge branch 'main' into issuer-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kfox1111 authored Jan 29, 2025
2 parents bcf6e92 + 138f283 commit fcb33ec
Show file tree
Hide file tree
Showing 113 changed files with 7 additions and 283 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ linters:
- intrange
- whitespace
- gocritic
- copyloopvar
- wastedassign
- nolintlint

Expand Down
8 changes: 0 additions & 8 deletions cmd/spire-agent/cli/run/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,6 @@ func TestDownloadTrustBundle(t *testing.T) {
}

for _, testCase := range cases {
testCase := testCase

t.Run(testCase.msg, func(t *testing.T) {
testServer := httptest.NewServer(http.HandlerFunc(
func(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -629,8 +627,6 @@ func TestMergeInput(t *testing.T) {
cases = append(cases, mergeInputCasesOS()...)

for _, testCase := range cases {
testCase := testCase

fileInput := &Config{Agent: &agentConfig{}}
cliInput := &agentConfig{}

Expand Down Expand Up @@ -1042,8 +1038,6 @@ func TestNewAgentConfig(t *testing.T) {
}
cases = append(cases, newAgentConfigCasesOS(t)...)
for _, testCase := range cases {
testCase := testCase

input := defaultValidConfig()

testCase.input(input)
Expand Down Expand Up @@ -1206,8 +1200,6 @@ func TestWarnOnUnknownConfig(t *testing.T) {
}

for _, testCase := range cases {
testCase := testCase

c, err := ParseFile(filepath.Join(testFileDir, testCase.confFile), false)
require.NoError(t, err)

Expand Down
1 change: 0 additions & 1 deletion cmd/spire-server/cli/entry/util_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ func TestParseEntryJSON(t *testing.T) {
}

for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
p := testCase.testDataPath

Expand Down
1 change: 0 additions & 1 deletion cmd/spire-server/cli/logger/printers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Launch Level : info
expectedError: errors.New("internal error: unexpected type *types.Entry returned; please report this as a bug"),
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.env = &commoncli.Env{
Stdout: &tt.outWriter,
Expand Down
8 changes: 0 additions & 8 deletions cmd/spire-server/cli/run/run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -470,8 +470,6 @@ func TestMergeInput(t *testing.T) {
cases = append(cases, mergeInputCasesOS(t)...)

for _, testCase := range cases {
testCase := testCase

fileInput := &Config{Server: &serverConfig{}}

testCase.fileInput(fileInput)
Expand Down Expand Up @@ -1213,8 +1211,6 @@ func TestNewServerConfig(t *testing.T) {
cases = append(cases, newServerConfigCasesOS(t)...)

for _, testCase := range cases {
testCase := testCase

input := defaultValidConfig()

testCase.input(input)
Expand Down Expand Up @@ -1337,7 +1333,6 @@ func TestValidateConfig(t *testing.T) {
}

for _, testCase := range testCases {
testCase := testCase
t.Run(testCase.name, func(t *testing.T) {
conf := defaultValidConfig()
testCase.applyConf(conf)
Expand Down Expand Up @@ -1550,8 +1545,6 @@ func TestWarnOnUnknownConfig(t *testing.T) {
}

for _, testCase := range cases {
testCase := testCase

c, err := ParseFile(filepath.Join(testFileDir, testCase.confFile), false)
require.NoError(t, err)

Expand Down Expand Up @@ -1759,7 +1752,6 @@ func TestHasCompatibleTTLs(t *testing.T) {
}

for _, testCase := range cases {
testCase := testCase
if testCase.caTTL == 0 {
testCase.caTTL = credtemplate.DefaultX509CATTL
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/Masterminds/sprig/v3 v3.3.0
github.com/Microsoft/go-winio v0.6.2
github.com/andres-erbsen/clock v0.0.0-20160526145045-9e14626cd129
github.com/aws/aws-sdk-go-v2 v1.33.0
github.com/aws/aws-sdk-go-v2 v1.34.0
github.com/aws/aws-sdk-go-v2/config v1.29.0
github.com/aws/aws-sdk-go-v2/credentials v1.17.53
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.24
Expand All @@ -33,7 +33,7 @@ require (
github.com/aws/aws-sdk-go-v2/service/s3 v1.73.0
github.com/aws/aws-sdk-go-v2/service/secretsmanager v1.34.0
github.com/aws/aws-sdk-go-v2/service/sts v1.33.8
github.com/aws/smithy-go v1.22.1
github.com/aws/smithy-go v1.22.2
github.com/blang/semver/v4 v4.0.0
github.com/cenkalti/backoff/v4 v4.3.0
github.com/docker/docker v27.5.0+incompatible
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,8 @@ github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3d
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go v1.55.5 h1:KKUZBfBoyqy5d3swXyiC7Q76ic40rYcbqH7qjh59kzU=
github.com/aws/aws-sdk-go v1.55.5/go.mod h1:eRwEWoyTWFMVYVQzKMNHWP5/RV4xIUGMQfXQHfHkpNU=
github.com/aws/aws-sdk-go-v2 v1.33.0 h1:Evgm4DI9imD81V0WwD+TN4DCwjUMdc94TrduMLbgZJs=
github.com/aws/aws-sdk-go-v2 v1.33.0/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
github.com/aws/aws-sdk-go-v2 v1.34.0 h1:9iyL+cjifckRGEVpRKZP3eIxVlL06Qk1Tk13vreaVQU=
github.com/aws/aws-sdk-go-v2 v1.34.0/go.mod h1:JgstGg0JjWU1KpVJjD5H0y0yyAIpSdKEq556EI6yOOM=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7 h1:lL7IfaFzngfx0ZwUGOZdsFFnQ5uLvR0hWqqhyE7Q9M8=
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.7/go.mod h1:QraP0UcVlQJsmHfioCrveWOC1nbiWUl3ej08h4mXWoc=
github.com/aws/aws-sdk-go-v2/config v1.29.0 h1:Vk/u4jof33or1qAQLdofpjKV7mQQT7DcUpnYx8kdmxY=
Expand Down Expand Up @@ -616,8 +616,8 @@ github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.9 h1:I1TsPEs34vbpOnR81GIcAq4/
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.9/go.mod h1:Fzsj6lZEb8AkTE5S68OhcbBqeWPsR8RnGuKPr8Todl8=
github.com/aws/aws-sdk-go-v2/service/sts v1.33.8 h1:pqEJQtlKWvnv3B6VRt60ZmsHy3SotlEBvfUBPB1KVcM=
github.com/aws/aws-sdk-go-v2/service/sts v1.33.8/go.mod h1:f6vjfZER1M17Fokn0IzssOTMT2N8ZSq+7jnNF0tArvw=
github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro=
github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/aws/smithy-go v1.22.2 h1:6D9hW43xKFrRx/tXXfAlIZc4JI+yQe6snnWcQyxSyLQ=
github.com/aws/smithy-go v1.22.2/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg=
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231024185945-8841054dbdb8 h1:SoFYaT9UyGkR0+nogNyD/Lj+bsixB+SNuAS4ABlEs6M=
github.com/awslabs/amazon-ecr-credential-helper/ecr-login v0.0.0-20231024185945-8841054dbdb8/go.mod h1:2JF49jcDOrLStIXN/j/K1EKRq8a8R2qRnlZA6/o/c7c=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand Down
1 change: 0 additions & 1 deletion pkg/agent/api/debug/v1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,6 @@ func TestGetInfo(t *testing.T) {
err: "failed to verify agent SVID: x509svid: could not get leaf SPIFFE ID: certificate contains no URI SAN",
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
test := setupServiceTest(t)
defer test.Cleanup()
Expand Down
4 changes: 0 additions & 4 deletions pkg/agent/api/delegatedidentity/v1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,6 @@ func TestSubscribeToX509SVIDs(t *testing.T) {
expectMetrics: generateSubscribeToX509SVIDMetrics(),
},
} {
tt := tt
t.Run(tt.testName, func(t *testing.T) {
metrics := fakemetrics.New()
params := testParams{
Expand Down Expand Up @@ -428,7 +427,6 @@ func TestSubscribeToX509Bundles(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.testName, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down Expand Up @@ -668,7 +666,6 @@ func TestFetchJWTSVIDs(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.testName, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down Expand Up @@ -768,7 +765,6 @@ func TestSubscribeToJWTBundles(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.testName, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down
1 change: 0 additions & 1 deletion pkg/agent/api/health/v1/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ func TestServiceCheck(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
log, logHook := test.NewNullLogger()

Expand Down
3 changes: 0 additions & 3 deletions pkg/agent/attestor/node/node_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,6 @@ func TestAttestor(t *testing.T) {
}

for _, testCase := range testCases {
testCase := testCase

t.Run(testCase.name, func(t *testing.T) {
require := require.New(t)

Expand Down Expand Up @@ -527,7 +525,6 @@ func TestIsSVIDExpired(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.Desc, func(t *testing.T) {
isExpired := attestor.IsSVIDExpired(tt.SVID, func() time.Time { return now })
require.Equal(t, tt.ExpectExpired, isExpired)
Expand Down
3 changes: 0 additions & 3 deletions pkg/agent/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ func TestRenewSVID(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
logHook.Reset()
tc.agentServer.err = tt.agentErr
Expand Down Expand Up @@ -757,7 +756,6 @@ func TestFetchUpdatesReleaseConnectionIfItFailsToFetch(t *testing.T) {
err: "failed to fetch bundle: rpc error: code = Unknown desc = an error",
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
client, tc := createClient(t)
tt.setupTest(tc)
Expand Down Expand Up @@ -921,7 +919,6 @@ func TestFetchJWTSVID(t *testing.T) {
fetchErr: status.Error(codes.Internal, "NewJWTSVID fails"),
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
tt.setupTest(tt.fetchErr)
resp, err := client.NewJWTSVID(ctx, "entry-id", []string{"myAud"})
Expand Down
1 change: 0 additions & 1 deletion pkg/agent/common/sigstore/sigstore_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,6 @@ func TestVerify(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
t.Parallel()

Expand Down
1 change: 0 additions & 1 deletion pkg/agent/endpoints/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@ func TestEndpoints(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
log, hook := test.NewNullLogger()
metrics := fakemetrics.New()
Expand Down
5 changes: 0 additions & 5 deletions pkg/agent/endpoints/workload/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,6 @@ func TestFetchX509SVID(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down Expand Up @@ -425,7 +424,6 @@ func TestFetchX509Bundles(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.testName, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down Expand Up @@ -837,7 +835,6 @@ func TestFetchJWTSVID(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down Expand Up @@ -1042,7 +1039,6 @@ func TestFetchJWTBundles(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
params := testParams{
CA: ca,
Expand Down Expand Up @@ -1476,7 +1472,6 @@ func TestValidateJWTSVID(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
params := testParams{
Updates: tt.updates,
Expand Down
1 change: 0 additions & 1 deletion pkg/agent/manager/cache/jwt_cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,6 @@ func TestJWTSVIDCache(t *testing.T) {
},
},
} {
tt := tt
t.Run(tt.name, func(t *testing.T) {
cache := NewJWTSVIDCache(log, fakeMetrics, 8)
if tt.setJWTSVIDsCached != nil {
Expand Down
2 changes: 0 additions & 2 deletions pkg/agent/manager/storecache/cache_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -523,8 +523,6 @@ func TestUpdateEntries(t *testing.T) {
},
},
} {
tt := tt

t.Run(tt.name, func(t *testing.T) {
log, hook := test.NewNullLogger()
log.Level = logrus.DebugLevel
Expand Down
1 change: 0 additions & 1 deletion pkg/agent/plugin/keymanager/test/keymanagertest.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ func assertRSAKey(t *testing.T, key keymanager.Key, bits int) {

func testSignCertificates(t *testing.T, key keymanager.Key, signatureAlgorithms []x509.SignatureAlgorithm) {
for _, signatureAlgorithm := range signatureAlgorithms {
signatureAlgorithm := signatureAlgorithm
t.Run("sign data "+signatureAlgorithm.String(), func(t *testing.T) {
assertSignCertificate(t, key, signatureAlgorithm)
})
Expand Down
4 changes: 0 additions & 4 deletions pkg/agent/plugin/keymanager/v1_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ func TestV1GenerateKey(t *testing.T) {
expectCode: codes.OK,
},
} {
tt := tt
t.Run(tt.test, func(t *testing.T) {
plugin := fakeV1Plugin{
generateKeyResponse: &keymanagerv1.GenerateKeyResponse{
Expand Down Expand Up @@ -137,7 +136,6 @@ func TestV1GetKey(t *testing.T) {
expectCode: codes.OK,
},
} {
tt := tt
t.Run(tt.test, func(t *testing.T) {
plugin := fakeV1Plugin{
getPublicKeyResponse: &keymanagerv1.GetPublicKeyResponse{
Expand Down Expand Up @@ -194,7 +192,6 @@ func TestV1GetKeys(t *testing.T) {
expectCode: codes.OK,
},
} {
tt := tt
t.Run(tt.test, func(t *testing.T) {
resp := &keymanagerv1.GetPublicKeysResponse{}
if tt.publicKey != nil {
Expand Down Expand Up @@ -291,7 +288,6 @@ func TestV1SignData(t *testing.T) {
expectCode: codes.OK,
},
} {
tt := tt
t.Run(tt.test, func(t *testing.T) {
plugin := fakeV1Plugin{
expectSignerOpts: tt.expectSignerOpts,
Expand Down
1 change: 0 additions & 1 deletion pkg/agent/plugin/nodeattestor/gcpiit/iit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ func TestRetrieveIdentity(t *testing.T) {
}

for _, tt := range tests {
tt := tt // alias loop variable as it is used in the closure
t.Run(tt.msg, func(t *testing.T) {
url := tt.url
if tt.handleFunc != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ func TestConfigureCommon(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
plugin := newPlugin()

Expand Down Expand Up @@ -85,7 +84,6 @@ func TestAidAttestationFailures(t *testing.T) {
},
}
for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
var err error
p := loadAndConfigurePlugin(t, tt.trustDomain, tt.config)
Expand Down Expand Up @@ -194,7 +192,6 @@ func TestAidAttestationSucceeds(t *testing.T) {
}

for _, tt := range tests {
tt := tt
t.Run(tt.name, func(t *testing.T) {
var err error
expectPayload, err := json.Marshal(&tt.attestationData)
Expand Down
Loading

0 comments on commit fcb33ec

Please sign in to comment.