Skip to content

Commit

Permalink
Amend failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
estringana committed Jan 8, 2024
1 parent 7b13ad0 commit 3597b5d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion appsec/src/helper/sampler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ class sampler {

void set_sampler_rate(double sampler_rate)
{

sampler_rate = valid_sample_rate(sampler_rate);

if (sampler_rate == sample_rate_) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,16 +364,18 @@ TEST_F(RemoteConfigAsmFeaturesListenerTest, DynamicEnablementIsDisabled)

TEST_F(RemoteConfigAsmFeaturesListenerTest, ApiSecurityIsDisabled)
{
auto some_rate = 0.123;
service_config->set_request_sample_rate(some_rate);
remote_config::asm_features_listener listener(service_config, true, false);

{ // Api security value is stored regardless
{ // Api security is not parsed if not enabled
try {
listener.on_update(
get_config_with_status_and_sample_rate("true", 0.2));
} catch (remote_config::error_applying_config &error) {
std::cout << error.what() << std::endl;
}
EXPECT_EQ(0.2, service_config->get_request_sample_rate());
EXPECT_EQ(some_rate, service_config->get_request_sample_rate());
EXPECT_EQ(enable_asm_status::ENABLED,
service_config->get_asm_enabled_status());
}
Expand All @@ -386,8 +388,8 @@ TEST_F(RemoteConfigAsmFeaturesListenerTest, ApiSecurityIsDisabled)
} catch (remote_config::error_applying_config &error) {
std::cout << error.what() << std::endl;
}
EXPECT_EQ(
0.2, service_config->get_request_sample_rate()); // same as before
EXPECT_EQ(some_rate,
service_config->get_request_sample_rate()); // same as before
EXPECT_EQ(enable_asm_status::ENABLED,
service_config->get_asm_enabled_status());
}
Expand Down

0 comments on commit 3597b5d

Please sign in to comment.