test

package
v0.0.0-...-19f3ddf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

README

End-to-End testing instruction:

Requirements:

To run end-to-end testing locally, you will need cipd access on your machine and drone service account (or direct access to android-provisioning/android-provisioning-apks gs bucket).
You will also need a valid ssh config to connect to the labstation (see ssh config section).

Testing:

End to end testing is done over ssh tunneling to labstation (dutServer).

  1. Establish the ssh tunnel:

ssh -f -N -L 2500:<dut_ip>:22 root@<host>

  1. In ‘common/constants.go’ change the DroneServiceAccountCreds to the local path to drone service account.

  2. Fill out the input_example.json to meet your requirements.

  • "dut" // DUT information. Required.
    • "id" // DUT id, needed for output file. Required.
    • "android" // DUT type. Required.
      • "associatedHostname" // Hostname of the device that the Android DUT is attached to. Optional.
      • "name" // DUT name. Optional.
      • "serialNumber" // string created by adb to uniquely identify the device. Required.
    • "cacheServer" // Cache server for downloading artifacts. Optional.
  • "provisionState" // List of packages to install. Required.
    • "id": {"value": "provision_state_id"} // Provision state id (string). Required.
    • "cipdPackages" // List of CIPD packages to install. Required.
      • "name" // CIPD package name. Required.
      • "instanceId" // CIPD package ID. Required.
      • "serviceUrl" // CIPD service URL. Optional. chrome-infra-packages.appspot.com by default.
      • "androidPackage" // Type of the package (1 - GMS Core). Required.
      • "apkDetails" // Package details. Optional.
  • "dutServer" // Address of the DUT server. Required.
  1. ./android-provision cli -input input_example.json -output output.json

Notes:

  • Make sure the dutServer field is set to 127.0.0.1 and the port used in the ssh tunnel corresponds to the port in your input file. Passing 127.0.0.1 as the address will automatically start the application in testing mode and use the ssh connection to reach the host.
  • Because this implementation focuses on testing android-provision service, we are not doing any caching. Instead, apk files are downloaded locally and copied remotely to labstation everytime the service is run. Depending on the size of the apk, this step alone could take 7-10 minutes.

ssh config:

Host 127.0.0.1 localhost
  CanonicalizeHostname yes
  PreferredAuthentications publickey
  StrictHostKeyChecking no
  User root
  IdentityFile %d/.ssh/testing_rsa

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LocalDutServiceAdapter

type LocalDutServiceAdapter struct {
	// contains filtered or unexported fields
}

LocalDutServiceAdapter implements Service Adapter interface and used to substitute DUT Service in local testing.

func NewLocalDutServiceAdapter

func NewLocalDutServiceAdapter(endPoint *api.IpEndpoint) (*LocalDutServiceAdapter, error)

func (LocalDutServiceAdapter) CopyData

func (s LocalDutServiceAdapter) CopyData(ctx context.Context, sourceUrl string, destPath string) error

CopyData mocks the caching service functionality. It downloads the apk file from GCP to current directory and copy it remotely to the host.

func (LocalDutServiceAdapter) CreateDirectories

func (s LocalDutServiceAdapter) CreateDirectories(ctx context.Context, dirs []string) error

func (LocalDutServiceAdapter) DeleteDirectory

func (s LocalDutServiceAdapter) DeleteDirectory(ctx context.Context, dir string) error

func (LocalDutServiceAdapter) FetchFile

func (s LocalDutServiceAdapter) FetchFile(ctx context.Context, path string) (io.ReadCloser, error)

func (LocalDutServiceAdapter) ForceReconnectWithBackoff

func (s LocalDutServiceAdapter) ForceReconnectWithBackoff(ctx context.Context) error

func (LocalDutServiceAdapter) PathExists

func (s LocalDutServiceAdapter) PathExists(ctx context.Context, path string) (bool, error)

func (LocalDutServiceAdapter) PipeData

func (s LocalDutServiceAdapter) PipeData(ctx context.Context, sourceUrl string, pipeCommand string) error

func (LocalDutServiceAdapter) Restart

func (LocalDutServiceAdapter) RunCmd

func (s LocalDutServiceAdapter) RunCmd(ctx context.Context, cmd string, args []string) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL