Exemplo n.º 1
0
    def complete(self, space_ship: Discovery) -> None:
        """Complete the mission after submitting a custom ping."""
        pings.starbase46.submit()

        # This will produce a Glean validation error.
        # Check out the SporeDrive class for more information.
        space_ship.jump("Starbase 46")
Exemplo n.º 2
0
def burnham(
    verbose: bool,
    test_run: str,
    test_name: str,
    enable_telemetry: bool,
    platform: str,
    spore_drive: str,
    missions: Tuple[Mission],
) -> None:
    """Travel through space and complete missions with the Discovery crew.

    If telemetry is enabled, measure, collect, and submit non-personal
    information to the specified data platform with Glean.
    """

    if verbose:
        logging.basicConfig(level=logging.DEBUG)
    else:
        logging.basicConfig(level=logging.INFO)

    Glean.initialize(
        application_id=__title__,
        application_version=__version__,
        upload_enabled=enable_telemetry is True,
        data_dir=Path(TemporaryDirectory().name),
        configuration=Configuration(server_endpoint=platform),
    )

    metrics.test.run.set(test_run)
    metrics.test.name.set(test_name)

    space_ship = Discovery(
        warp_drive=WarpDrive(),
        spore_drive=SporeDrive(branch=spore_drive,
                               active=spore_drive is not None),
    )
    pings.space_ship_ready.submit()

    try:
        for mission in missions:
            complete_mission(space_ship=space_ship, mission=mission)

            # When mission "MISSION H: DISABLE GLEAN UPLOAD" disables the Glean
            # SDK ping upload all pending events, metrics and pings are
            # cleared, except for first_run_date. We need to restore values for
            # test.run and test.name after re-enabling ping upload, so that we
            # can properly correlate new pings with the test scenario.
            if mission.identifier == "MISSION I: ENABLE GLEAN UPLOAD":
                metrics.test.run.set(test_run)
                metrics.test.name.set(test_name)

        secs = 5
        logger.info("All missions completed.")
        logger.info(f" Waiting {secs}s for telemetry to be sent.")
        time.sleep(secs)

    except BurnhamError as err:
        click.echo(f"Error: {err}", err=True)
        sys.exit(1)
Exemplo n.º 3
0
 def complete(self, space_ship: Discovery) -> None:
     space_ship.jump("12345")
Exemplo n.º 4
0
 def complete(self, space_ship: Discovery) -> None:
     space_ship.jump("2016")
     space_ship.jump("Berlin")
Exemplo n.º 5
0
 def complete(self, space_ship: Discovery) -> None:
     space_ship.warp("26.2")
     space_ship.warp("abc")
Exemplo n.º 6
0
 def complete(self, space_ship: Discovery) -> None:
     space_ship.warp("abcdefgh")
Exemplo n.º 7
0
 def complete(self, space_ship: Discovery) -> None:
     space_ship.jump("1234")
     space_ship.warp("abcd")
     space_ship.warp("ab")
     space_ship.jump("8000")
     space_ship.jump("20")
     space_ship.jump("200")
     space_ship.warp("home")
     space_ship.warp("4000")
     space_ship.warp("abc123")
Exemplo n.º 8
0
 def complete(self, space_ship: Discovery) -> None:
     space_ship.warp("abc")
     space_ship.warp("de")
     space_ship.jump("12345")
Exemplo n.º 9
0
def fixture_space_ship():
    """Return a Discovery instance with spore_drive active."""
    return Discovery(
        warp_drive=WarpDrive(),
        spore_drive=SporeDrive(branch="tardigrade", active=True),
    )