forked from TrueCloudLab/distribution
cloudfront: use consistent names for test-tables, t.Parallel()
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
5301ae14bf
commit
f03d966ef7
1 changed files with 14 additions and 12 deletions
|
@ -261,6 +261,7 @@ func TestUpdateCalledRegularly(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEligibleForS3(t *testing.T) {
|
func TestEligibleForS3(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
ips := &awsIPs{
|
ips := &awsIPs{
|
||||||
ipv4: []net.IPNet{{
|
ipv4: []net.IPNet{{
|
||||||
IP: net.ParseIP("192.168.1.1"),
|
IP: net.ParseIP("192.168.1.1"),
|
||||||
|
@ -277,7 +278,7 @@ func TestEligibleForS3(t *testing.T) {
|
||||||
return dcontext.WithRequest(empty, req)
|
return dcontext.WithRequest(empty, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
cases := []struct {
|
tests := []struct {
|
||||||
Context context.Context
|
Context context.Context
|
||||||
Expected bool
|
Expected bool
|
||||||
}{
|
}{
|
||||||
|
@ -286,16 +287,17 @@ func TestEligibleForS3(t *testing.T) {
|
||||||
{Context: makeContext("192.168.0.2"), Expected: false},
|
{Context: makeContext("192.168.0.2"), Expected: false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, testCase := range cases {
|
for _, tc := range tests {
|
||||||
name := fmt.Sprintf("Client IP = %v",
|
tc := tc
|
||||||
testCase.Context.Value("http.request.ip"))
|
t.Run(fmt.Sprintf("Client IP = %v", tc.Context.Value("http.request.ip")), func(t *testing.T) {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Parallel()
|
||||||
assertEqual(t, testCase.Expected, eligibleForS3(testCase.Context, ips))
|
assertEqual(t, tc.Expected, eligibleForS3(tc.Context, ips))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEligibleForS3WithAWSIPNotInitialized(t *testing.T) {
|
func TestEligibleForS3WithAWSIPNotInitialized(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
ips := &awsIPs{
|
ips := &awsIPs{
|
||||||
ipv4: []net.IPNet{{
|
ipv4: []net.IPNet{{
|
||||||
IP: net.ParseIP("192.168.1.1"),
|
IP: net.ParseIP("192.168.1.1"),
|
||||||
|
@ -312,7 +314,7 @@ func TestEligibleForS3WithAWSIPNotInitialized(t *testing.T) {
|
||||||
return dcontext.WithRequest(empty, req)
|
return dcontext.WithRequest(empty, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
cases := []struct {
|
tests := []struct {
|
||||||
Context context.Context
|
Context context.Context
|
||||||
Expected bool
|
Expected bool
|
||||||
}{
|
}{
|
||||||
|
@ -321,11 +323,11 @@ func TestEligibleForS3WithAWSIPNotInitialized(t *testing.T) {
|
||||||
{Context: makeContext("192.168.0.2"), Expected: false},
|
{Context: makeContext("192.168.0.2"), Expected: false},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, testCase := range cases {
|
for _, tc := range tests {
|
||||||
name := fmt.Sprintf("Client IP = %v",
|
tc := tc
|
||||||
testCase.Context.Value("http.request.ip"))
|
t.Run(fmt.Sprintf("Client IP = %v", tc.Context.Value("http.request.ip")), func(t *testing.T) {
|
||||||
t.Run(name, func(t *testing.T) {
|
t.Parallel()
|
||||||
assertEqual(t, testCase.Expected, eligibleForS3(testCase.Context, ips))
|
assertEqual(t, tc.Expected, eligibleForS3(tc.Context, ips))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue