rbd: change iteration variable name in the migration test to be specific

we reuse or overload the variable name in the test execution at present.
This commit use a different variable name as initialized in each run

Signed-off-by: Humble Chirammal <hchiramm@redhat.com>
This commit is contained in:
Humble Chirammal 2021-10-08 13:55:01 +05:30 committed by mergify[bot]
parent a01b9821ee
commit 4e61156dc4

View File

@ -54,12 +54,12 @@ func TestIsMigrationVolID(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
tt := tt newtt := tt
t.Run(tt.name, func(t *testing.T) { t.Run(newtt.name, func(t *testing.T) {
t.Parallel() t.Parallel()
got := isMigrationVolID(tt.args) got := isMigrationVolID(newtt.args)
if got != tt.migVolID { if got != newtt.migVolID {
t.Errorf("isMigrationVolID() = %v, want %v", got, tt.migVolID) t.Errorf("isMigrationVolID() = %v, want %v", got, newtt.migVolID)
} }
}) })
} }
@ -156,17 +156,17 @@ func TestParseMigrationVolID(t *testing.T) {
}, },
} }
for _, tt := range tests { for _, tt := range tests {
tt := tt newtt := tt
t.Run(tt.name, func(t *testing.T) { t.Run(newtt.name, func(t *testing.T) {
t.Parallel() t.Parallel()
got, err := parseMigrationVolID(tt.args) got, err := parseMigrationVolID(newtt.args)
if (err != nil) != tt.wantErr { if (err != nil) != newtt.wantErr {
t.Errorf("ParseMigrationVolID() error = %v, wantErr %v", err, tt.wantErr) t.Errorf("ParseMigrationVolID() error = %v, wantErr %v", err, newtt.wantErr)
return return
} }
if !reflect.DeepEqual(got, tt.want) { if !reflect.DeepEqual(got, newtt.want) {
t.Errorf("ParseMigrationVolID() got = %v, want %v", got, tt.want) t.Errorf("ParseMigrationVolID() got = %v, want %v", got, newtt.want)
} }
}) })
} }