@@ -419,6 +419,82 @@ TEST_F(RouterRoutingTest, ConnectTimeoutShutdownEarlyXProtocol) {
419
419
connect_thread.join ();
420
420
}
421
421
422
+ TEST_F (RouterRoutingTest, EccCertificate) {
423
+ RecordProperty (" Bug" , " 35317484" );
424
+ RecordProperty (" Description" ,
425
+ " Check if router can start with a ECC certificate" );
426
+
427
+ const auto server_classic_port = port_pool_.get_next_available ();
428
+ const auto server_x_port = port_pool_.get_next_available ();
429
+ const auto router_classic_ecdh_rsa_port = port_pool_.get_next_available ();
430
+ const auto router_classic_ecdh_dsa_port = port_pool_.get_next_available ();
431
+ const auto router_classic_ecdsa_port = port_pool_.get_next_available ();
432
+
433
+ const std::string json_stmts = get_data_dir ().join (" bootstrap_gr.js" ).str ();
434
+
435
+ launch_mysql_server_mock (json_stmts, server_classic_port, EXIT_SUCCESS, false ,
436
+ /* http_port*/ 0 , server_x_port);
437
+
438
+ TempDirectory conf_dir (" conf-ecc-certificate" );
439
+ auto writer = config_writer (conf_dir.name ());
440
+ writer.section (
441
+ " routing:classic_ecdh_rsa" ,
442
+ {
443
+ {" bind_port" , std::to_string (router_classic_ecdh_rsa_port)},
444
+ {" mode" , " read-write" },
445
+ {" destinations" , " 127.0.0.1:" + std::to_string (server_classic_port)},
446
+ {" routing_strategy" , " round-robin" },
447
+ {" protocol" , " classic" },
448
+ {" client_ssl_key" ,
449
+ SSL_TEST_DATA_DIR " /ecdh_rsa_certs/server-key.pem" },
450
+ {" client_ssl_cert" ,
451
+ SSL_TEST_DATA_DIR " /ecdh_rsa_certs/server-cert.pem" },
452
+ });
453
+ writer.section (
454
+ " routing:classic_ecdh_dsa" ,
455
+ {
456
+ {" bind_port" , std::to_string (router_classic_ecdh_dsa_port)},
457
+ {" mode" , " read-write" },
458
+ {" destinations" , " 127.0.0.1:" + std::to_string (server_classic_port)},
459
+ {" routing_strategy" , " round-robin" },
460
+ {" protocol" , " classic" },
461
+ {" client_ssl_key" ,
462
+ SSL_TEST_DATA_DIR " /ecdh_dsa_certs/server-key.pem" },
463
+ {" client_ssl_cert" ,
464
+ SSL_TEST_DATA_DIR " /ecdh_dsa_certs/server-cert.pem" },
465
+ });
466
+ writer.section (
467
+ " routing:classic_ecdsa" ,
468
+ {
469
+ {" bind_port" , std::to_string (router_classic_ecdsa_port)},
470
+ {" mode" , " read-write" },
471
+ {" destinations" , " 127.0.0.1:" + std::to_string (server_classic_port)},
472
+ {" routing_strategy" , " round-robin" },
473
+ {" protocol" , " classic" },
474
+ {" client_ssl_key" , SSL_TEST_DATA_DIR " /ecdsa_certs/server-key.pem" },
475
+ {" client_ssl_cert" , SSL_TEST_DATA_DIR " /ecdsa_certs/server-cert.pem" },
476
+ });
477
+ ASSERT_NO_FATAL_FAILURE (router_spawner ().spawn ({" -c" , writer.write ()}));
478
+
479
+ {
480
+ mysqlrouter::MySQLSession client;
481
+ EXPECT_NO_THROW (client.connect (" 127.0.0.1" , router_classic_ecdh_rsa_port,
482
+ " root" , " fake-pass" , " " , " " ));
483
+ }
484
+
485
+ {
486
+ mysqlrouter::MySQLSession client;
487
+ EXPECT_NO_THROW (client.connect (" 127.0.0.1" , router_classic_ecdh_dsa_port,
488
+ " root" , " fake-pass" , " " , " " ));
489
+ }
490
+
491
+ {
492
+ mysqlrouter::MySQLSession client;
493
+ EXPECT_NO_THROW (client.connect (" 127.0.0.1" , router_classic_ecdsa_port,
494
+ " root" , " fake-pass" , " " , " " ));
495
+ }
496
+ }
497
+
422
498
/* *
423
499
* check empty packet leads to an error.
424
500
*
0 commit comments