tmnet

Script tmnet provides possibility to store and manage testmon data files on S3 Bucket. S3 storage is organized into environments. Each environment contains unique string to identify environment i.e. linux-py39.

Cached files in an environment are not shared with other environments.

S3 Bucket contains one “cache index files” (_tmnet.json). This json file contains a dict where top level keys are a abbreviated Git SHA codes (as given git log --oneline).

The values are the list of filenames that were cached. on S3 the file name is given by <sha>_<filename>.

Usage

There are 2 supported operations:

Download

  1. Download the cache index for given environment (_tmnet.json).
  2. Get list of commits in the local repo, find latest changeset present. in the cache index.
  3. Download all files specified in the index from S3 at given revision.

Upload

  1. Download tmnet index file from S3 (Note there is potential for race condition if 2 instances are executed at the same time).
  2. Add local revision to tmnet index.
  3. Upload modified tmnet file to S3.
  4. Upload individual cache files to S3.

Example of configuration

Just add next section to your pytest.ini file

[pytest.tmnet]

TMNET_S3_REGION = us
TMNET_S3_ENDPOINT = https://s3endpoint.com
TMNET_S3_BUCKET = bucket_name
TMNET_S3_ACCESS_ID = XXXXXXXXXXXXXXXXXXXX
TMNET_S3_SECRET_KEY = XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

CLI options

Please, note if argument is provided it overwrites related value in pytest.ini.

optionhelp
--uploadFlag. If provided then tmnet will upload data file to S3 Bucket.
--s3-bucketS3 Bucket name, use unique identifier for project.
--s3-access-idS3 access ID.
--s3-secretS3 secret key.
--s3-regionS3 region name.
--s3-endpointS3 endpoint link.

Example usages

tmnet linux-py39    # will download testmon data file from S3 bucket.
tmnet linux-py39 --upload    # will upload testmon data file to S3 bucket specified in pytest.ini.
tmnet linux-py39 --s3-bucket=mybucket    # will upload testmon data file to S3 bucket with name 'mybucket'.

Environment variables

optionhelp
TMNET_S3_SECRET_KEYIf provided overwrites TMNET_S3_SECRET_KEY provided in pytest.ini and --s3-secret argument.