Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit tests #34

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ USER root
WORKDIR /caikit
COPY caikit /caikit

RUN yum -y install git && yum clean all && \
RUN yum -y install git git-lfs && yum clean all && \
git lfs install && \
pip install pipenv && \
pipenv install --system && \
rm -rf ~/.cache && \
Expand Down
33 changes: 32 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
TGIS_IMAGE=quay.io/opendatahub/text-generation-inference:fast-ec05689

.PHONY: default

default:
Expand All @@ -7,4 +9,33 @@ default:
.PHONY: refresh-piplock-files

refresh-piplock-files:
cd caikit && pipenv lock
podman run --user root -it \
--rm -v $$(pwd)/caikit:/app/caikit:z \
$(TGIS_IMAGE) \
/bin/bash -c " \
cd caikit && \
yum -y install git && pip install pipenv && \
pipenv lock --pre \
"


.PHONY: docker-test

docker-test: default
podman run -it --rm \
-e DTYPE_STR=float32 \
--name caikit-tgis-serving-test-$$(git rev-parse --short HEAD) \
--volume $$(pwd)/test:/tmp/test:z --volume $$(pwd)/utils:/tmp/utils:z \
caikit-tgis-serving:$$(git rev-parse --short HEAD) \
/tmp/test/smoke-test.sh


.PHONY: shell

shell: default
podman run -it --rm \
-e DTYPE_STR=float32 \
--name caikit-tgis-serving-test-$$(git rev-parse --short HEAD) \
--volume $$(pwd)/test:/tmp/test:z --volume $$(pwd)/utils:/tmp/utils:z \
caikit-tgis-serving:$$(git rev-parse --short HEAD) \
/bin/bash
30 changes: 30 additions & 0 deletions test/smoke-test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/sh

tempdir="$(mktemp -d)"

cd ${tempdir}

curl -sL https://github.com/fullstorydev/grpcurl/releases/download/v1.8.7/grpcurl_1.8.7_linux_x86_64.tar.gz | tar zxvf - grpcurl && \

grpcurl="${tempdir}/grpcurl"

git clone https://huggingface.co/google/flan-t5-small

/tmp/utils/convert.py --model-path flan-t5-small --model-save-path flan-t5-small-caikit

mv flan-t5-small-caikit /opt/models/

CAIKIT_LOG_FILE=$(mktemp)
cd /caikit
./start-serving.sh &>$CAIKIT_LOG_FILE &
# timeout --signal=SIGINT 30 bash -c "tail -f -n0 $CAIKIT_LOG_FILE | grep 'Caikit Runtime is serving on port'"
timeout --signal=SIGINT 30 bash -c "grep -m1 'Caikit Runtime is serving on port' <(tail -f $CAIKIT_LOG_FILE)"

cat $CAIKIT_LOG_FILE

${grpcurl} -plaintext -d '{"text": "At what temperature does liquid Nitrogen boil?"}' -H "mm-model-id: flan-t5-small-caikit" localhost:8085 caikit.runtime.Nlp.NlpService/TextGenerationTaskPredict
rc=$?

kill %1

exit $rc