@@ -1646,7 +1646,14 @@ TEST(MetaServiceHttpTest, UpdateConfig) {
1646
1646
{
1647
1647
auto [status_code, content] = ctx.query <std::string>(" update_config" , " configs=aaa=bbb" );
1648
1648
ASSERT_EQ (status_code, 400 );
1649
- std::string msg = " set aaa=bbb failed" ;
1649
+ std::string msg = " config field=aaa not exists" ;
1650
+ ASSERT_NE (content.find (msg), std::string::npos);
1651
+ }
1652
+ {
1653
+ auto [status_code, content] =
1654
+ ctx.query <std::string>(" update_config" , " configs=custom_conf_path=./doris_conf" );
1655
+ ASSERT_EQ (status_code, 400 );
1656
+ std::string msg = " config field=custom_conf_path is immutable" ;
1650
1657
ASSERT_NE (content.find (msg), std::string::npos);
1651
1658
}
1652
1659
{
@@ -1663,31 +1670,77 @@ TEST(MetaServiceHttpTest, UpdateConfig) {
1663
1670
ASSERT_EQ (config::recycle_interval_seconds, 3601 );
1664
1671
}
1665
1672
{
1666
- auto original_conf_path = config::custom_conf_path;
1667
- config::custom_conf_path = " ./doris_cloud.conf" ;
1668
- auto [status_code, content] = ctx.query <std::string>(
1669
- " update_config" ,
1670
- " configs=recycle_interval_seconds=3659,retention_seconds=259219&persist=true" );
1673
+ auto [status_code, content] =
1674
+ ctx.query <std::string>(" update_config" , " configs=enable_s3_rate_limiter=true" );
1671
1675
ASSERT_EQ (status_code, 200 );
1672
- ASSERT_EQ (config::recycle_interval_seconds, 3659 );
1673
- ASSERT_EQ (config::retention_seconds, 259219 );
1674
- config::Properties props;
1675
- ASSERT_TRUE (props.load (config::custom_conf_path.c_str (), true ));
1676
+ ASSERT_TRUE (config::enable_s3_rate_limiter);
1677
+ }
1678
+ {
1679
+ auto [status_code, content] =
1680
+ ctx.query <std::string>(" update_config" , " enable_s3_rate_limiter=invalid" );
1681
+ ASSERT_EQ (status_code, 400 );
1682
+ }
1683
+ {
1684
+ auto original_conf_path = config::custom_conf_path;
1685
+ config::custom_conf_path = " ./doris_cloud_custom.conf" ;
1676
1686
{
1677
- bool new_val_set = false ;
1678
- int64_t recycle_interval_s = 0 ;
1679
- ASSERT_TRUE (props.get_or_default (" recycle_interval_seconds" , nullptr ,
1680
- recycle_interval_s, &new_val_set));
1681
- ASSERT_TRUE (new_val_set);
1682
- ASSERT_EQ (recycle_interval_s, 3659 );
1687
+ auto [status_code, content] = ctx.query <std::string>(
1688
+ " update_config" ,
1689
+ " configs=recycle_interval_seconds=3659,retention_seconds=259219&persist=true" );
1690
+ ASSERT_EQ (status_code, 200 );
1691
+ ASSERT_EQ (config::recycle_interval_seconds, 3659 );
1692
+ ASSERT_EQ (config::retention_seconds, 259219 );
1693
+ config::Properties props;
1694
+ ASSERT_TRUE (props.load (config::custom_conf_path.c_str (), true ));
1695
+ {
1696
+ bool new_val_set = false ;
1697
+ int64_t recycle_interval_s = 0 ;
1698
+ ASSERT_TRUE (props.get_or_default (" recycle_interval_seconds" , nullptr ,
1699
+ recycle_interval_s, &new_val_set));
1700
+ ASSERT_TRUE (new_val_set);
1701
+ ASSERT_EQ (recycle_interval_s, 3659 );
1702
+ }
1703
+ {
1704
+ bool new_val_set = false ;
1705
+ int64_t retention_s = 0 ;
1706
+ ASSERT_TRUE (props.get_or_default (" retention_seconds" , nullptr , retention_s,
1707
+ &new_val_set));
1708
+ ASSERT_TRUE (new_val_set);
1709
+ ASSERT_EQ (retention_s, 259219 );
1710
+ }
1683
1711
}
1684
1712
{
1685
- bool new_val_set = false ;
1686
- int64_t retention_s = 0 ;
1687
- ASSERT_TRUE (
1688
- props.get_or_default (" retention_seconds" , nullptr , retention_s, &new_val_set));
1689
- ASSERT_TRUE (new_val_set);
1690
- ASSERT_EQ (retention_s, 259219 );
1713
+ auto [status_code, content] = ctx.query <std::string>(
1714
+ " update_config" , " configs=enable_s3_rate_limiter=false&persist=true" );
1715
+ ASSERT_EQ (status_code, 200 );
1716
+ ASSERT_EQ (config::recycle_interval_seconds, 3659 );
1717
+ ASSERT_EQ (config::retention_seconds, 259219 );
1718
+ config::Properties props;
1719
+ ASSERT_TRUE (props.load (config::custom_conf_path.c_str (), true ));
1720
+ {
1721
+ bool new_val_set = false ;
1722
+ int64_t recycle_interval_s = 0 ;
1723
+ ASSERT_TRUE (props.get_or_default (" recycle_interval_seconds" , nullptr ,
1724
+ recycle_interval_s, &new_val_set));
1725
+ ASSERT_TRUE (new_val_set);
1726
+ ASSERT_EQ (recycle_interval_s, 3659 );
1727
+ }
1728
+ {
1729
+ bool new_val_set = false ;
1730
+ int64_t retention_s = 0 ;
1731
+ ASSERT_TRUE (props.get_or_default (" retention_seconds" , nullptr , retention_s,
1732
+ &new_val_set));
1733
+ ASSERT_TRUE (new_val_set);
1734
+ ASSERT_EQ (retention_s, 259219 );
1735
+ }
1736
+ {
1737
+ bool new_val_set = false ;
1738
+ bool enable_s3_rate_limiter = true ;
1739
+ ASSERT_TRUE (props.get_or_default (" enable_s3_rate_limiter" , nullptr ,
1740
+ enable_s3_rate_limiter, &new_val_set));
1741
+ ASSERT_TRUE (new_val_set);
1742
+ ASSERT_FALSE (enable_s3_rate_limiter);
1743
+ }
1691
1744
}
1692
1745
std::filesystem::remove (config::custom_conf_path);
1693
1746
config::custom_conf_path = original_conf_path;
0 commit comments