Skip to content

Commit

Permalink
fix(tests): get rid of loop variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitry Kropachev committed Jul 3, 2023
1 parent 0fe2312 commit 1c44451
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 8 deletions.
3 changes: 2 additions & 1 deletion pkg/auth/auth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ func TestSetAuthenticator(t *testing.T) {
err: "Username not provided",
},
}
for name, test := range tests {
for name := range tests {
test := tests[name]
t.Run(name, func(t *testing.T) {
t.Parallel()
authenticator, err := auth.BuildAuthenticator(
Expand Down
3 changes: 2 additions & 1 deletion pkg/generators/statement_generator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,8 @@ func TestGetCreateSchema(t *testing.T) {
},
}

for name, test := range tests {
for name := range tests {
test := tests[name]
t.Run(name, func(t *testing.T) {
t.Parallel()
got := generators.GetCreateTable(test.table, ks)
Expand Down
6 changes: 4 additions & 2 deletions pkg/murmur/murmur_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ func TestRotl(t *testing.T) {
{-6486402271863858009, 31, 405973038345868736},
}

for _, test := range tests {
for id := range tests {
test := tests[id]
t.Run(fmt.Sprintf("%d >> %d", test.in, test.rotate), func(t *testing.T) {
t.Parallel()
if v := rotl(test.in, uint8(test.rotate)); v != test.exp {
Expand All @@ -59,7 +60,8 @@ func TestFmix(t *testing.T) {
{-7566534940689533355, 4729783097411765989},
}

for _, test := range tests {
for id := range tests {
test := tests[id]
t.Run(strconv.Itoa(int(test.in)), func(t *testing.T) {
t.Parallel()
if v := fmix(test.in); v != test.exp {
Expand Down
3 changes: 2 additions & 1 deletion pkg/replication/replication_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ func TestToCQL(t *testing.T) {
want: "{'class':'NetworkTopologyStrategy','datacenter1':1}",
},
}
for name, test := range tests {
for name := range tests {
test := tests[name]
t.Run(name, func(t *testing.T) {
t.Parallel()
got := test.rs.ToCQL()
Expand Down
3 changes: 2 additions & 1 deletion pkg/tableopts/options_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ func TestToCQL(t *testing.T) {
"'enabled':true,'max_threshold':32,'min_threshold':4,'tombstone_compaction_interval':86400,'tombstone_threshold':0.2}",
},
}
for name, test := range tests {
for name := range tests {
test := tests[name]
t.Run(name, func(t *testing.T) {
t.Parallel()
if o, err := tableopts.FromCQL(test.rs); err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/typedef/schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ func TestSchemaConfigValidate(t *testing.T) {
},
}
cmp.AllowUnexported()
for name, test := range tests {
for name := range tests {
test := tests[name]
t.Run(name, func(t *testing.T) {
t.Parallel()
got := test.config.Valid()
Expand Down
2 changes: 1 addition & 1 deletion pkg/typedef/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ var prettytests = []struct {

func TestCQLPretty(t *testing.T) {
t.Parallel()

for _, p := range prettytests {
result, _ := p.typ.CQLPretty(p.query, p.values)
if result != p.expected {
Expand Down

0 comments on commit 1c44451

Please sign in to comment.