Merge changes I97e7d06c,I8ba14291,I3a53dc6c,Idca8071c,I6ec64063 into main am: 4ae9a74c7c
Original change: https://android-review.googlesource.com/c/platform/tools/asuite/+/3369736
Change-Id: Iad57b7676401ad8e645c7f463e489920dcc0e83c
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/atest/rollout_control.py b/atest/rollout_control.py
index 69d3421..9496d14 100644
--- a/atest/rollout_control.py
+++ b/atest/rollout_control.py
@@ -22,6 +22,7 @@
import logging
import os
from atest import atest_enum
+from atest import atest_utils
from atest.metrics import metrics
@@ -56,6 +57,7 @@
env_control_flag: str,
feature_id: int = None,
owners: list[str] | None = None,
+ print_message: str | None = None,
):
"""Initializes the object.
@@ -70,6 +72,8 @@
for metric collection purpose. Must be a positive integer.
owners: The owners of the feature. If not provided, the owners of the
feature will be read from OWNERS file.
+ print_message: The message to print to the console when the feature is
+ enabled for the user.
"""
if rollout_percentage < 0 or rollout_percentage > 100:
raise ValueError(
@@ -87,6 +91,7 @@
self._env_control_flag = env_control_flag
self._feature_id = feature_id
self._owners = owners
+ self._print_message = print_message
def _check_env_control_flag(self) -> bool | None:
"""Checks the environment variable to override the feature enablement.
@@ -164,28 +169,32 @@
result=self._feature_id if is_enabled else -self._feature_id,
)
- if is_enabled and self._rollout_percentage < 100:
- print(
- '\nYou are among the first %s%% of users to receive the feature "%s".'
- ' If you experience any issues, you can disable the feature by'
- ' setting the environment variable "%s" to false, and the atest team'
- ' will be notified.\n'
- % (self._rollout_percentage, self._name, self._env_control_flag)
- )
+ if is_enabled and self._print_message:
+ print(atest_utils.mark_magenta(self._print_message))
return is_enabled
disable_bazel_mode_by_default = RolloutControlledFeature(
name='Bazel mode disabled by default',
- rollout_percentage=5,
+ rollout_percentage=10,
env_control_flag='DISABLE_BAZEL_MODE_BY_DEFAULT',
feature_id=1,
+ print_message=(
+ 'Running host unit tests without bazel mode which is being deprecated.'
+ ' If you experienced any issues and require bazel mode, please comment'
+ ' on http://b/377371679.'
+ ),
)
rolling_tf_subprocess_output = RolloutControlledFeature(
name='Rolling TradeFed subprocess output',
- rollout_percentage=5,
+ rollout_percentage=30,
env_control_flag='ROLLING_TF_SUBPROCESS_OUTPUT',
feature_id=2,
+ print_message=(
+ 'You are one of the first users receiving the "Rolling subprocess'
+ ' output" feature. If you are happy with it, please +1 on'
+ ' http://b/380460196.'
+ ),
)
diff --git a/atest/test_runners/atest_tf_test_runner.py b/atest/test_runners/atest_tf_test_runner.py
index 87e1046..2482c9c 100644
--- a/atest/test_runners/atest_tf_test_runner.py
+++ b/atest/test_runners/atest_tf_test_runner.py
@@ -402,9 +402,9 @@
test_infos, extra_args, server.getsockname()[1]
)
is_rolling_output = (
- rollout_control.rolling_tf_subprocess_output.is_enabled()
- and not extra_args.get(constants.VERBOSE, False)
+ not extra_args.get(constants.VERBOSE, False)
and atest_utils.is_atty_terminal()
+ and rollout_control.rolling_tf_subprocess_output.is_enabled()
)
logging.debug('Running test: %s', run_cmds[0])