@@ -4083,7 +4083,6 @@ void connection::test_fido_webauthn(sql::ConnectOptionsMap &opt, bool callback_i
4083
4083
driver->setCallBack (CB{nullptr });
4084
4084
test_connection (0 );
4085
4085
4086
-
4087
4086
cout << endl << " Multi driver tests: " << endl;
4088
4087
4089
4088
auto multi_drv_test = [test_connection_drv]()
@@ -4102,6 +4101,11 @@ void connection::test_fido_webauthn(sql::ConnectOptionsMap &opt, bool callback_i
4102
4101
4103
4102
test_connection_drv (111 , driver1);
4104
4103
test_connection_drv (222 , driver2);
4104
+
4105
+ // Multi-driver callbacks have to be reset too.
4106
+ // Otherwise they will remain set in the next test.
4107
+ driver1->setCallBack (CB{nullptr });
4108
+ driver2->setCallBack (CB{nullptr });
4105
4109
};
4106
4110
4107
4111
multi_drv_test ();
@@ -4127,7 +4131,6 @@ void connection::test_fido_webauthn(sql::ConnectOptionsMap &opt, bool callback_i
4127
4131
cout << e.what () << endl;
4128
4132
FAIL (" Unexpected error!" );
4129
4133
}
4130
-
4131
4134
cout << " Success\n " ;
4132
4135
}
4133
4136
@@ -4155,6 +4158,10 @@ void connection::fido_test()
4155
4158
<< " Check that webauthn callback is not used for fido accounts" << endl;
4156
4159
4157
4160
test_fido_webauthn<sql::WebAuthn_Callback, MyWindowWebAuthn>(opt, true );
4161
+
4162
+ // Clear up the callback.
4163
+ sql::Driver *driver = sql::mysql::get_driver_instance ();
4164
+ driver->setCallBack (sql::WebAuthn_Callback{nullptr });
4158
4165
}
4159
4166
4160
4167
@@ -4181,6 +4188,11 @@ void connection::webauthn_test()
4181
4188
4182
4189
cout << endl << " Running tests with Fido callbacks" << endl;
4183
4190
4191
+ // Prevent errors by resetting callback set as Webauthn_Callback
4192
+ // because the next test uses Fido_Callback.
4193
+ sql::Driver *driver = sql::mysql::get_driver_instance ();
4194
+ driver->setCallBack (sql::WebAuthn_Callback{nullptr });
4195
+
4184
4196
test_fido_webauthn<sql::Fido_Callback, MyWindowFido>(opt);
4185
4197
4186
4198
cout << endl << " Overwrite WebAuthn callback with Fido one" << endl;
@@ -4196,6 +4208,9 @@ void connection::webauthn_test()
4196
4208
catch (sql::SQLException&)
4197
4209
{}
4198
4210
}
4211
+
4212
+ // Clear up the callback.
4213
+ driver->setCallBack (sql::WebAuthn_Callback{nullptr });
4199
4214
}
4200
4215
4201
4216
0 commit comments