Skip to content

DIST‐S1 Interface Acceptance Testing Instructions

Riley Kuttruff edited this page Dec 16, 2024 · 4 revisions

This page contains instructions for performing Acceptance Testing for the DIST-S1 Interface delivery from the OPERA-ADT team. These instructions pertain to the latest version of the Interface release, currently SAS v0.0.3. These instructions assume the user has Docker installed on their local machine.

Acquiring the DIST-S1 Interface Docker Image

The image is currently hosted on the public Github repository for https://github.com/opera-adt/dist-s1. No additional credentials should be needed to either clone the repo or pull the SAS Docker image.

Loading the image into Docker

The first step in running the DIST-S1 image is to load it into Docker via the following command:

docker pull ghcr.io/opera-adt/dist-s1:0.0.3

This should add the Docker image to your local repository with the name ghcr.io/opera-adt/dist-s1 and the tag 0.0.3.

Preparing the test data

For the current DIST-S1 Interface delivery, all test data is bundled into the SAS Docker image for use with the built-in unit test suite. This test data can be copied to the local filesystem so we can execute the dist-s1 container in a production-like fashion. The location the files are copied to will be referred to throughout these instructions as <DIST_S1_DIR>.

To copy the test data, first start the dist-s1 container in the background:

docker run -i --name dist-s1 --rm ghcr.io/opera-adt/dist-s1:0.0.3 &

NOTE: We instruct the container to use the name "dist-s1" for easy reference in the following command.

Next, to extract the test data:

docker cp dist-s1:home/ops/dist-s1/tests/test_data <DIST_S1_DIR>

You should see something like Successfully copied 1.62MB to <DIST_S1_DIR>/.

Lastly, to terminate the running dist-s1 container, use the fg command to bring the container into the foreground, then terminate with a Ctrl+C.

In order to execute the SAS, the test data directory, runconfig and an output location will be mounted into the container instance as Docker Volumes. To help streamline this process, we recommend making the following changes within the <DIST_S1_DIR> directory:

  • Create the output directory:

    mkdir -p <DIST_S1_DIR>/output_dir

  • Create the runconfig directory and copy the test runconfig.yml file into it:

    mkdir -p <DIST_S1_DIR>/runconfig_dir

    cp <DIST_S1_DIR>/test_data/10SGD_cropped/runconfig.yml <DIST_S1_DIR>/runconfig_dir

Executing the DIST-S1 container on the sample test data

Change directory into the <DIST_S1_DIR> directory.

cd <DIST_S1_DIR>/

We're now ready to execute the DIST-S1 Interface delivery. Run the following the command to kick off execution with the test assets and copy the output products to the mounted output_dir volume:

NOTE: Docker requires absolute paths for volume arguments, so assuming you are running from within <DIST_S1_DIR>, the $(pwd) command can be utilized as a shortcut.

docker run --rm -i --tty -u $(id -u):$(id -g) \
  -v $(pwd)/test_data:/home/ops/test_data \
  -v $(pwd)/runconfig_dir:/home/ops/runconfig_dir \
  -v $(pwd)/output_dir:/home/ops/output_dir \
  ghcr.io/opera-adt/dist-s1:0.0.3 sh -c "/opt/conda/envs/dist-s1-env/bin/dist-s1 run_sas --runconfig_yml_path /home/ops/runconfig_dir/runconfig.yml && mv /home/ops/OPERA_L3_DIST-ALERT-S1* /home/ops/output_dir/"

You should see the following almost instantaneously:

Writing to DIST-S1 product to directory: /home/ops/OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1

NOTE: The 20241204T175000Z portion of this sample product name is the production time, and will be different for each execution of the dist-s1 container. All other portions of the file name should match.

The output results should also have been copied to <DIST_S1_DIR>/output_dir:

 $ ls $(pwd)/output_dir/*
<DIST_S1_DIR>/output_dir/OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1:
OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_DATE-FIRST.tif       OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_GEN-METRIC.tif
OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_DATE-LATEST.tif      OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_N-DIST.tif
OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_DIST-STATUS-ACQ.tif  OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_N-OBS.tif
OPERA_L3_DIST-ALERT-S1_T10SGD_20241103T015902Z_20241204T175000Z_S1_30_v0.0.1_DIST-STATUS.tif

For this Acceptance Test, ensure the same set of expected files has been created on the local machine.

Executing the unit test suite within the DIST-S1 container

To ensure the dist-s1 container is executing as expected, we can also run its built-in Python unit test suite from within the container:

docker run --rm ghcr.io/opera-adt/dist-s1:0.0.3 bash -l -c 'cd dist-s1 && pytest tests'

For this Acceptance Test, all tests within the suite are expected to pass. A passing pytest report should match the following:

$ docker run ghcr.io/opera-adt/dist-s1:0.0.3 bash -l -c 'cd dist-s1 && pytest tests'
============================= test session starts ==============================
platform linux -- Python 3.13.0, pytest-8.3.3, pluggy-1.5.0
rootdir: /home/ops/dist-s1
configfile: pyproject.toml
plugins: anyio-4.6.2.post1, cov-6.0.0
collected 3 items

tests/test_main.py .                                                     [ 33%]
tests/test_package.py .                                                  [ 66%]
tests/test_runconfig_model.py .                                          [100%]

============================== 3 passed in 1.44s ===============================
Clone this wiki locally