Skip to content

Running Emcee Android on macOS

This is experimental functionality

  • Might be unstable
  • Do not use in production

For demonstration purposes Emcee might be deployed and run on macOS. However, managing emulators inside containers is not available. And all tests will be run on user emulators.

How it works#

For Emcee workers to operate correctly, they need to be run on OS Linux with KVM enabled. If you run tests on workers deployed on macOS emulators inside containers will crash with an error.

To demonstrate how Emcee works on macOS we provide the ability to disable emulators inside containers. You can connect emulators running directly on macOS directly to Emcee workers instead. This way workers will run tests on external emulators.

Set up#

Before launching workers on macOS you need to manually launch emulators with the sdk version you want to use in emceeplan. Remember their device serial, we'll need them later.

For example, if you run 3 emulators the adb devices command will display the running emulators and their device serial (emulator-5554, etc.):

> adb devices -l
List of devices attached
emulator-5554          device product:sdk_google_phone_arm64 model:Android_SDK_built_for_arm64 device:generic_arm64 transport_id:28
emulator-5556          device product:sdk_google_phone_arm64 model:Android_SDK_built_for_arm64 device:generic_arm64 transport_id:29
emulator-5558          device product:sdk_google_phone_arm64 model:Android_SDK_built_for_arm64 device:generic_arm64 transport_id:30

Additional configuration of workers using Docker Compose#

To turn "macOS-mode" on you need to add the environment variable MAC_DEMO_MODE_ENABLED in the worker configuration:

emcee-worker.env
EMCEE_WORKER_QUEUE_URL=http://emcee-queue-service:41000
EMCEE_WORKER_LOG_LEVEL=info
MAC_DEMO_MODE_ENABLED=true

For each worker set a personal environment variable MAC_DEMO_MODE_DEVICE_SERIAL with a unique device serial of the emulator on which tests from this worker will be run.

Using Docker Compose configuration file docker-compose.yml might look like this:

docker-compose.yml
version: '3'
services:
  emcee-queue-service:
    image: avitotech/emcee-queue:latest
    container_name: emcee-queue-service
    ports:
      - 41000:41000

  queue-worker-1:
    image: avitotech/emcee-worker:latest
    env_file:
      - emcee-worker.env
    environment:
      - MAC_DEMO_MODE_DEVICE_SERIAL=emulator-5554
    depends_on:
      - emcee-queue-service

  queue-worker-2:
    image: avitotech/emcee-worker:latest
    env_file:
      - emcee-worker.env
    environment:
      - MAC_DEMO_MODE_DEVICE_SERIAL=emulator-5556
    depends_on:
      - emcee-queue-service

  queue-worker-3:
    image: avitotech/emcee-worker:latest
    env_file:
      - emcee-worker.env
    environment:
      - MAC_DEMO_MODE_DEVICE_SERIAL=emulator-5558
    depends_on:
      - emcee-queue-service

  emcee-artifactory:
    image: docker.bintray.io/jfrog/artifactory-oss:7.63.11
    container_name: emcee-artifactory
    ports:
      - 8081:8081
      - 8082:8082
    volumes:
      - emcee_artifactory:/var/opt/jfrog/artifactory
volumes:
  emcee_artifactory:

Then you can deploy Emcee and run tests as described in the documentation. Tests will be run on local emulators.

Additional information#

If you plan to launch tests from the same mac OS machine that runs Emcee, be aware of the following:

  • According to the Storage documentation the Emcee client and worker must have access to the Artifactory container.

It's mean that the worker and the client must have correct Artifactory address. You can achieve that with different ways.

For example, easy way is to put Artifactory container name to /etc/hosts file:

#...
127.0.0.1        emcee-artifactory

And then set this name as the host address in the Storage configuration:

#...
storage:
  type: artifactory
  baseUrl: http://emcee-artifactory:8081/artifactory/
  repository: emcee-transport
  user: "your_user"
  password: "your_password"

It will help system to map this hostname to the local machine. The worker container will map this hostname according to the internal docker network.

This way you will configure correct Artifactory address for both client and worker.

Example#

This is how running tests on 3 simulators might look like:

Emcee Android mac demo