Skip to content

Commit

Permalink
fix unit test pipeline and add delete_docs tests (#713)
Browse files Browse the repository at this point in the history
Co-authored-by: Farshid Zavareh <[email protected]>
  • Loading branch information
vicilliar and farshidz authored Jan 31, 2024
1 parent 85229ad commit ca81177
Show file tree
Hide file tree
Showing 10 changed files with 710 additions and 752 deletions.
49 changes: 39 additions & 10 deletions .github/workflows/unit_test_200gb_CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ on:
workflow_call:
workflow_dispatch:
push:
branches:
mainline
paths-ignore:
- '**.md'
pull_request:
Expand Down Expand Up @@ -73,19 +71,50 @@ jobs:
# override base requirements with marqo requirements, if needed:
pip install -r marqo/requirements.txt
pip install pytest==7.4.0
- name: start Marqo-os
- name: Start Vespa
run: |
export LOCAL_OPENSEARCH_URL="https://localhost:9200"
docker run --name marqo-os -d -p 9200:9200 -p 9600:9600 -e "discovery.type=single-node" marqoai/marqo-os:0.0.3 || exit
# Define these for checking if Vespa is ready
export VESPA_CONFIG_URL=http://localhost:19071
export VESPA_DOCUMENT_URL=http://localhost:8080
export VESPA_QUERY_URL=http://localhost:8080
# wait for marqo-os to start:
timeout 10m bash -c 'until [[ $(curl -v --silent --insecure $LOCAL_OPENSEARCH_URL 2>&1 | grep Unauthorized) ]]; do sleep 0.1; done;' || \
(echo "Marqo-os did not start in time" && exit 1)
cd marqo/scripts/vespa_local
set -x
python vespa_local.py start
set +x
echo "Waiting for Vespa to start"
for i in {1..20}; do
echo -ne "Waiting... $i seconds\r"
sleep 1
done
echo -e "\nDone waiting."
# Zip up schemas and services
apt-get install zip -y
zip -r vespa_tester_app.zip services.xml schemas
# Deploy dummy application with test schema
curl --header "Content-Type:application/zip" --data-binary @vespa_tester_app.zip http://localhost:19071/application/v2/tenant/default/prepareandactivate
# wait for vespa to start (document url):
timeout 10m bash -c 'until curl -f -X GET $VESPA_DOCUMENT_URL >/dev/null 2>&1; do echo " Waiting for Vespa document API to be available..."; sleep 10; done;' || \
(echo "Vespa (Document URL) did not start in time" && exit 1)
echo "Vespa document API is available. Local Vespa setup complete."
# Delete the zip file
rm vespa_tester_app.zip
echo "Deleted vespa_tester_app.zip"
- name: Run Unit Tests
run: |
export LOCAL_OPENSEARCH_URL="https://localhost:9200"
# Define these for use by marqo
export VESPA_CONFIG_URL=http://localhost:19071
export VESPA_DOCUMENT_URL=http://localhost:8080
export VESPA_QUERY_URL=http://localhost:8080
export PYTHONPATH="./marqo/tests:./marqo/src:./marqo"
pytest marqo/tests
Expand Down
5 changes: 5 additions & 0 deletions tests/core/monitoring/test_monitoring.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,11 @@ def setUpClass(cls) -> None:
cls.unstructured_index
]

# WARMUP monitoring calls to avoid NoneType return for first test run
for i in range(2):
for marqo_index in cls.indexes_to_test:
cls.monitoring.get_index_stats(marqo_index)

def test_get_index_stats_emptyIndex_successful(self):
"""
get_index_stats returns the correct stats for an empty index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@


class TestStructuredVespaIndex(MarqoTestCase):

def test_to_vespa_document_standardMarqoDoc_successful(self):
marqo_index = self.structured_marqo_index(
name='my_index',
schema_name='my_index',
model=Model(name='ViT-B/32'),
distance_metric=DistanceMetric.PrenormalizedAnguar,
vector_numeric_type=VectorNumericType.Float,
Expand Down
2 changes: 2 additions & 0 deletions tests/marqo_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def clear_index_by_name(self, index_name: str):
def structured_marqo_index(
cls,
name: str,
schema_name: str,
fields: List[Field] = None,
tensor_fields: List[TensorField] = None,
model: Model = Model(name='hf/all_datasets_v4_MiniLM-L6'),
Expand Down Expand Up @@ -100,6 +101,7 @@ def structured_marqo_index(
"""
return StructuredMarqoIndex(
name=name,
schema_name=schema_name,
model=model,
normalize_embeddings=normalize_embeddings,
text_preprocessing=text_preprocessing,
Expand Down
Loading

0 comments on commit ca81177

Please sign in to comment.