Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(ci): Try rearranging android integration tests to fix failures. #12093

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -742,10 +742,10 @@ workflows:
- main
- create_mobile_recipes:
name: Create Fenix and iOS recipes
filters:
branches:
only:
- update_firefox_versions
# filters:
# branches:
# only:
# - update_firefox_versions
- integration_nimbus_desktop_ui:
name: Test Desktop Nimbus UI (Release Firefox)
filters:
Expand Down Expand Up @@ -790,19 +790,19 @@ workflows:
- main
- build_firefox_fenix:
name: Build Fenix APKs
filters:
branches:
only:
- update_firefox_versions
# filters:
# branches:
# only:
# - update_firefox_versions
- integration_nimbus_fenix_enrollment:
name: Test Firefox for Android (Fenix)
requires:
- Create Fenix and iOS recipes
- Build Fenix APKs
filters:
branches:
only:
- update_firefox_versions
# filters:
# branches:
# only:
# - update_firefox_versions
- integration_nimbus_ios_enrollment:
name: Test Firefox for iOS Beta
requires:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,40 @@ def open_app():
return open_app


@pytest.fixture(name="unenroll_experiment")
def fixture_unenroll_experiment(run_nimbus_cli_command):
def unenroll_experiment():
command = "nimbus-cli --app fenix --channel developer unenroll"
run_nimbus_cli_command(command)
time.sleep(10)

return unenroll_experiment


@pytest.fixture(name="trigger_telemetry_update")
def fixture_trigger_telemetry_update():
def trigger_telemetry():
command = [
"adb",
"shell",
"am",
"start",
"-n org.mozilla.fenix.debug/mozilla.telemetry.glean.debug.GleanDebugActivity"
"--es sendPing",
"events",
]
try:
out = subprocess.check_output(
" ".join(command), encoding="utf8", shell=True, stderr=subprocess.STDOUT
)
logging.debug(out)
except subprocess.CalledProcessError as e:
out = e.output
raise

return trigger_telemetry


@pytest.fixture
def gradlewbuild_log(pytestconfig, tmpdir):
gradlewbuild_log = f"{tmpdir.join('gradlewbuild.log')}"
Expand Down Expand Up @@ -109,11 +143,13 @@ def runner():


@pytest.fixture(name="check_ping_for_experiment")
def fixture_check_ping_for_experiment(experiment_slug, ping_server, open_app):
def fixture_check_ping_for_experiment(
experiment_slug, ping_server, trigger_telemetry_update
):
def _check_ping_for_experiment(branch=None, experiment=experiment_slug, reason=None):
model = TelemetryModel(branch=branch, experiment=experiment)

timeout = time.time() + 60
timeout = time.time() + 300
while time.time() < timeout:
data = requests.get(f"{ping_server}/pings").json()
events = []
Expand Down Expand Up @@ -141,7 +177,8 @@ def _check_ping_for_experiment(branch=None, experiment=experiment_slug, reason=N
if model == telemetry_model:
return True
time.sleep(5)
open_app() # Open app in cycles to trigger telemetry
# Open app in cycles to trigger telemetry
trigger_telemetry_update()
return False

return _check_ping_for_experiment
Expand Down Expand Up @@ -182,36 +219,38 @@ def setup_experiment():


@pytest.mark.generic_test
def test_experiment_unenrolls_via_studies_toggle(
setup_experiment, gradlewbuild, open_app
def test_experiment_enrolls(
setup_experiment, gradlewbuild, open_app, check_ping_for_experiment
):
setup_experiment()
open_app()
gradlewbuild.test("GenericExperimentIntegrationTest#disableStudiesViaStudiesToggle")
gradlewbuild.test("GenericExperimentIntegrationTest#verifyStudiesAreDisabled")
gradlewbuild.test("GenericExperimentIntegrationTest#testExperimentEnrolled")
assert check_ping_for_experiment(reason="enrollment", branch="control")


@pytest.mark.generic_test
def test_experiment_enrolls(
def test_experiment_unenrolls_via_secret_menu(
setup_experiment,
gradlewbuild,
open_app,
check_ping_for_experiment,
unenroll_experiment,
):
setup_experiment()
open_app()
gradlewbuild.test("GenericExperimentIntegrationTest#testExperimentEnrolled")
assert check_ping_for_experiment(reason="enrollment", branch="control")
gradlewbuild.test(
"GenericExperimentIntegrationTest#testExperimentUnenrolledViaSecretMenu"
)
gradlewbuild.test("GenericExperimentIntegrationTest#testExperimentUnenrolled")
unenroll_experiment()
assert check_ping_for_experiment(reason="unenrollment", branch="control")


@pytest.mark.generic_test
def test_experiment_unenrolls_via_secret_menu(
setup_experiment, gradlewbuild, open_app, check_ping_for_experiment
def test_experiment_unenrolls_via_studies_toggle(
setup_experiment, gradlewbuild, open_app
):
setup_experiment()
open_app()
gradlewbuild.test(
"GenericExperimentIntegrationTest#testExperimentUnenrolledViaSecretMenu"
)
gradlewbuild.test("GenericExperimentIntegrationTest#testExperimentUnenrolled")
assert check_ping_for_experiment(reason="unenrollment", branch="control")
gradlewbuild.test("GenericExperimentIntegrationTest#disableStudiesViaStudiesToggle")
gradlewbuild.test("GenericExperimentIntegrationTest#verifyStudiesAreDisabled")