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