Skip to content

Commit

Permalink
ci: add a ML model artifact test case
Browse files Browse the repository at this point in the history
Both as a test and an example.

Inspired by:
    https://github.com/kubeflow/model-registry/blob/main/docs/logical_model.md

Signed-off-by: Ramkumar Chinchani <[email protected]>
  • Loading branch information
rchincha committed Mar 20, 2024
1 parent eec277e commit c316c5e
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/blackbox/pushpull_authn.bats
Original file line number Diff line number Diff line change
Expand Up @@ -173,3 +173,27 @@ EOF
[ "$status" -eq 0 ]
[ $(echo "${lines[-1]}" | jq '.manifests | length') -eq 0 ]
}

@test "ML artifacts" {
# download model data
curl -v -L0 https://github.com/tarilabs/demo20231212/raw/main/v1.nb20231206162408/mnist.onnx -o ${BATS_FILE_TMPDIR}/mnist.onnx
sha256_in=$(sha256sum ${BATS_FILE_TMPDIR}/mnist.onnx | awk '{print $1}')

# upload artifact with required annotations and version
run regctl artifact put --annotation description="used for demo purposes" --annotation model_format_name="onnx" --annotation model_format_version="1" --artifact-type "application/vnd.model.type" localhost:${zot_port}/models/my-model-from-gh:v1 -f ${BATS_FILE_TMPDIR}/mnist.onnx
[ "$status" -eq 0 ]

# list artifacts
run regctl artifact list localhost:${zot_port}/models/my-model-from-gh:v1 --format raw-body
[ "$status" -eq 0 ]

# list artifacts of type
run regctl artifact list --filter-artifact-type "application/vnd.model.type" localhost:${zot_port}/models/my-model-from-gh:v1 --format raw-body
[ "$status" -eq 0 ]

# get artifact
run regctl artifact get localhost:${zot_port}/models/my-model-from-gh:v1 -o ${BATS_FILE_TMPDIR}/mnist.onnx.check
[ "$status" -eq 0 ]
sha256_out=$(sha256sum ${BATS_FILE_TMPDIR}/mnist.onnx.check | awk '{print $1}')
[ "$sha256_in" -eq "$sha256_out" ]
}

0 comments on commit c316c5e

Please sign in to comment.