Skip to content

Commit

Permalink
test: Add validation that pipette eeproms are created correctly (#270)
Browse files Browse the repository at this point in the history
  • Loading branch information
DerekMaggio authored and Derek Maggio committed Jun 27, 2023
1 parent 80f9240 commit 1f2c227
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 2 deletions.
41 changes: 41 additions & 0 deletions emulation_system/tests/e2e/results/ot3_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
from dataclasses import dataclass
from typing import Set, Type

from docker.models.containers import Container # type: ignore[import]

from tests.e2e.consts import (
ENTRYPOINT_MOUNT,
MONOREPO_WHEEL_VOLUME,
Expand Down Expand Up @@ -301,6 +303,42 @@ def get_actual_results(
)


@dataclass
class PipetteEeproms(ResultABC):
"""Validate that pipette eeproms are correct."""

left_pipette_eeprom_file_has_content: bool
right_pipette_eeprom_file_has_content: bool

@staticmethod
def _file_has_content(container: Container) -> bool:
return int(exec_in_container(container, "stat -c %s /eeprom/eeprom.bin")) > 0

@classmethod
def get_expected_results(
cls: Type["PipetteEeproms"], system_test_def: SystemTestDefinition
) -> "PipetteEeproms":
"""Generate expected pipette eeproms."""
return cls(
left_pipette_eeprom_file_has_content=system_test_def.left_pipette_expected,
right_pipette_eeprom_file_has_content=system_test_def.right_pipette_expected,
)

@classmethod
def get_actual_results(
cls: Type["PipetteEeproms"], system_under_test: E2EHostSystem
) -> "PipetteEeproms":
"""Load actual pipette eeproms."""
return cls(
left_pipette_eeprom_file_has_content=cls._file_has_content(
system_under_test.ot3_containers.left_pipette
),
right_pipette_eeprom_file_has_content=cls._file_has_content(
system_under_test.ot3_containers.right_pipette
),
)


@dataclass
class OT3Result(ResultABC):
"""Collect all ot3 result classes into a single dataclass."""
Expand All @@ -311,6 +349,7 @@ class OT3Result(ResultABC):
emulator_mounts: OT3EmulatorMounts
builder_named_volumes: OT3FirmwareBuilderNamedVolumes
binaries: OT3Binaries
pipette_eeproms: PipetteEeproms

@classmethod
def get_actual_results(
Expand All @@ -330,6 +369,7 @@ def get_actual_results(
system_under_test
),
binaries=OT3Binaries.get_actual_results(system_under_test),
pipette_eeproms=PipetteEeproms.get_actual_results(system_under_test),
)

@classmethod
Expand All @@ -350,4 +390,5 @@ def get_expected_results(
system_test_def
),
binaries=OT3Binaries.get_expected_results(system_test_def),
pipette_eeproms=PipetteEeproms.get_expected_results(system_test_def),
)
6 changes: 6 additions & 0 deletions emulation_system/tests/e2e/system_mappings.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
ot3_firmware_build_args=BuildArgConfigurations.LATEST_BUILD_ARGS,
opentrons_modules_build_args=BuildArgConfigurations.NO_BUILD_ARGS,
module_configuration=ModuleConfiguration.NO_MODULES(),
left_pipette_expected=True,
right_pipette_expected=False,
)

OT3_FIRMWARE_DEV = SystemTestDefinition(
Expand All @@ -42,6 +44,8 @@
ot3_firmware_build_args=BuildArgConfigurations.LATEST_BUILD_ARGS,
opentrons_modules_build_args=BuildArgConfigurations.NO_BUILD_ARGS,
module_configuration=ModuleConfiguration.NO_MODULES(),
left_pipette_expected=False,
right_pipette_expected=True,
)

OT3_AND_MODULES = SystemTestDefinition(
Expand All @@ -64,6 +68,8 @@
fw_magnetic_module_names={"ot3-and-modules-magdeck"},
fw_temperature_module_names={"ot3-and-modules-tempdeck"},
),
left_pipette_expected=True,
right_pipette_expected=True,
)

_TEST_DEFS: Dict[str, SystemTestDefinition] = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,5 @@ class SystemTestDefinition:
opentrons_modules_build_args: BuildArgConfigurations

module_configuration: ModuleConfiguration
left_pipette_expected: bool
right_pipette_expected: bool
1 change: 0 additions & 1 deletion samples/ci/ot3/ot3_remote.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ robot:
emulation-level: hardware
hardware-specific-attributes:
left-pipette: P1000 Multi
right-pipette: P50 Multi

monorepo-source: latest
ot3-firmware-source: latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ robot:
hardware: ot3
emulation-level: hardware
hardware-specific-attributes:
left-pipette: P1000 Multi
right-pipette: P50 Multi

monorepo-source: /home/runner/work/opentrons-emulation/opentrons-emulation/opentrons
Expand Down

0 comments on commit 1f2c227

Please sign in to comment.