mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: remove unnecessary redeclarations in for loops (#18440)
This commit is contained in:
@@ -243,7 +243,6 @@ func TestFilter(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
actor := tc.Actor
|
||||
@@ -1135,7 +1134,6 @@ func testAuthorize(t *testing.T, name string, subject Subject, sets ...[]authTes
|
||||
authorizer := NewAuthorizer(prometheus.NewRegistry())
|
||||
for _, cases := range sets {
|
||||
for i, c := range cases {
|
||||
c := c
|
||||
caseName := fmt.Sprintf("%s/%d", name, i)
|
||||
t.Run(caseName, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
@@ -165,7 +165,6 @@ func TestObjectEqual(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -265,7 +265,6 @@ neq(input.object.owner, "");
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
part := partialQueries(tc.Queries...)
|
||||
|
||||
@@ -114,7 +114,6 @@ func TestEquality(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -92,7 +92,6 @@ func TestMembership(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -229,7 +229,6 @@ func TestRoleByName(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range testCases {
|
||||
c := c
|
||||
t.Run(c.Role.Identifier.String(), func(t *testing.T) {
|
||||
role, err := RoleByName(c.Role.Identifier)
|
||||
require.NoError(t, err, "role exists")
|
||||
|
||||
@@ -37,7 +37,6 @@ func (a authSubject) Subjects() []authSubject { return []authSubject{a} }
|
||||
func TestBuiltInRoles(t *testing.T) {
|
||||
t.Parallel()
|
||||
for _, r := range rbac.SiteBuiltInRoles() {
|
||||
r := r
|
||||
t.Run(r.Identifier.String(), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
require.NoError(t, r.Valid(), "invalid role")
|
||||
@@ -45,7 +44,6 @@ func TestBuiltInRoles(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, r := range rbac.OrganizationRoles(uuid.New()) {
|
||||
r := r
|
||||
t.Run(r.Identifier.String(), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
require.NoError(t, r.Valid(), "invalid role")
|
||||
@@ -896,7 +894,6 @@ func TestRolePermissions(t *testing.T) {
|
||||
passed := true
|
||||
// nolint:tparallel,paralleltest
|
||||
for _, c := range testCases {
|
||||
c := c
|
||||
// nolint:tparallel,paralleltest // These share the same remainingPermissions map
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
remainingSubjs := make(map[string]struct{})
|
||||
@@ -995,7 +992,6 @@ func TestIsOrgRole(t *testing.T) {
|
||||
|
||||
// nolint:paralleltest
|
||||
for _, c := range testCases {
|
||||
c := c
|
||||
t.Run(c.Identifier.String(), func(t *testing.T) {
|
||||
t.Parallel()
|
||||
ok := c.Identifier.IsOrgRole()
|
||||
@@ -1092,7 +1088,6 @@ func TestChangeSet(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, c := range testCases {
|
||||
c := c
|
||||
t.Run(c.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
@@ -119,7 +119,6 @@ func TestSubjectEqual(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.Name, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user