From 7e5948427cbc93be9a42e4afbb8b5eb883c16b53 Mon Sep 17 00:00:00 2001 From: Owais Akbani Date: Fri, 29 May 2020 11:55:24 +0500 Subject: [PATCH 1/3] fix(log-level) change single audience result to debug --- lib/optimizely/audience.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/optimizely/audience.rb b/lib/optimizely/audience.rb index 84152da3..cdac12f0 100644 --- a/lib/optimizely/audience.rb +++ b/lib/optimizely/audience.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # -# Copyright 2016-2017, 2019, Optimizely and contributors +# Copyright 2016-2017, 2019-2020 Optimizely and contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -84,7 +84,7 @@ def user_in_experiment?(config, experiment, attributes, logger) result = ConditionTreeEvaluator.evaluate(audience_conditions, evaluate_custom_attr) result_str = result.nil? ? 'UNKNOWN' : result.to_s.upcase logger.log( - Logger::INFO, + Logger::DEBUG, format(Helpers::Constants::AUDIENCE_EVALUATION_LOGS['AUDIENCE_EVALUATION_RESULT'], audience_id, result_str) ) result From ff1c4b0e5d5d9a683f590c559c55ab376367c438 Mon Sep 17 00:00:00 2001 From: Owais Akbani Date: Fri, 29 May 2020 11:58:14 +0500 Subject: [PATCH 2/3] fix: unit tests --- spec/audience_spec.rb | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/spec/audience_spec.rb b/spec/audience_spec.rb index 5e67106f..d9ca334b 100644 --- a/spec/audience_spec.rb +++ b/spec/audience_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # -# Copyright 2016-2017, 2019, Optimizely and contributors +# Copyright 2016-2017, 2019-2020 Optimizely and contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -253,7 +253,7 @@ ) expect(spy_logger).to have_received(:log).once.with( - Logger::INFO, + Logger::DEBUG, "Audience '11154' evaluated to UNKNOWN." ) @@ -265,7 +265,7 @@ ) expect(spy_logger).to have_received(:log).once.with( - Logger::INFO, + Logger::DEBUG, "Audience '11155' evaluated to UNKNOWN." ) @@ -299,7 +299,7 @@ ).ordered # Order: 1 expect(spy_logger).to have_received(:log).once.with( - Logger::INFO, + Logger::DEBUG, "Audience '3468206647' evaluated to FALSE." ).ordered # Order: 2 @@ -311,7 +311,7 @@ ).ordered # Order: 3 expect(spy_logger).to have_received(:log).once.with( - Logger::INFO, + Logger::DEBUG, "Audience '3988293898' evaluated to UNKNOWN." ).ordered # Order: 4 @@ -323,7 +323,7 @@ ).ordered # Order: 5 expect(spy_logger).to have_received(:log).once.with( - Logger::INFO, + Logger::DEBUG, "Audience '3468206646' evaluated to TRUE." ).ordered # Order: 6 From 28432c2c3685189d080321cf5f5a70264a34c139 Mon Sep 17 00:00:00 2001 From: Owais Akbani Date: Fri, 29 May 2020 12:01:17 +0500 Subject: [PATCH 3/3] nit: comma --- lib/optimizely/audience.rb | 2 +- spec/audience_spec.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/optimizely/audience.rb b/lib/optimizely/audience.rb index cdac12f0..a53a3292 100644 --- a/lib/optimizely/audience.rb +++ b/lib/optimizely/audience.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # -# Copyright 2016-2017, 2019-2020 Optimizely and contributors +# Copyright 2016-2017, 2019-2020, Optimizely and contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/spec/audience_spec.rb b/spec/audience_spec.rb index d9ca334b..583beb31 100644 --- a/spec/audience_spec.rb +++ b/spec/audience_spec.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true # -# Copyright 2016-2017, 2019-2020 Optimizely and contributors +# Copyright 2016-2017, 2019-2020, Optimizely and contributors # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License.