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

Integration tests #149

Merged
merged 97 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from 42 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
25d1aaa
test with k3s
roxanne-o Nov 23, 2024
8766327
more stuff
roxanne-o Nov 23, 2024
a9ac588
fix a few things up
roxanne-o Nov 23, 2024
7bcf454
Automatically reformatting code with black and isort
Nov 23, 2024
9e4312f
update this
roxanne-o Nov 23, 2024
0fa2948
get rid of this
roxanne-o Nov 23, 2024
c8d869b
Merge branch 'test-with-k3s' of https://github.com/groundlight/edge-e…
roxanne-o Nov 23, 2024
7f0f8e0
some more stuff
roxanne-o Nov 23, 2024
20d4fda
fix yaml
roxanne-o Nov 23, 2024
9a66be7
add poetry install
roxanne-o Nov 23, 2024
a7711db
watch for rollout status
roxanne-o Nov 23, 2024
b2e7131
describe pods for debugging
roxanne-o Nov 23, 2024
40b13d6
try this
roxanne-o Nov 23, 2024
bf624b1
try this??
roxanne-o Nov 23, 2024
f3afd07
try this?
roxanne-o Nov 23, 2024
3da9411
hm okay try this
roxanne-o Nov 23, 2024
9364ee8
add this as well
roxanne-o Nov 23, 2024
46a72dc
add rollout stuff
roxanne-o Nov 23, 2024
35a7e22
Update test/setup_k3s_test_environment.sh
roxanne-o Nov 25, 2024
25b90d1
Merge branch 'main' of https://github.com/groundlight/edge-endpoint i…
roxanne-o Dec 3, 2024
c054d04
some stuff
roxanne-o Dec 6, 2024
7f73916
fix
roxanne-o Dec 6, 2024
671f0a2
Merge branch 'main' of https://github.com/groundlight/edge-endpoint i…
roxanne-o Dec 6, 2024
e51557b
stuff passes now
roxanne-o Dec 6, 2024
183ecd8
update pipeline
roxanne-o Dec 6, 2024
767d88f
fix pipeline
roxanne-o Dec 6, 2024
ee07cca
fix sequencing
roxanne-o Dec 6, 2024
21d66f3
nevermind
roxanne-o Dec 6, 2024
535fab1
setup basic
roxanne-o Dec 8, 2024
b3958aa
more stuff
roxanne-o Dec 9, 2024
501fb98
Automatically reformatting code with black and isort
Dec 9, 2024
75e26b9
more stuff
roxanne-o Dec 9, 2024
f621047
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Dec 9, 2024
7010918
Automatically reformatting code with black and isort
Dec 9, 2024
ca40e11
finishing up
roxanne-o Dec 10, 2024
e6d8ad8
Automatically reformatting code with black and isort
Dec 10, 2024
b63eedf
tweak some stuff
roxanne-o Dec 13, 2024
142d673
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Dec 13, 2024
6175cc4
Automatically reformatting code with black and isort
Dec 13, 2024
ffac9e5
cleaning up pt2
roxanne-o Dec 13, 2024
8d0280e
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Dec 13, 2024
471a60f
Automatically reformatting code with black and isort
Dec 13, 2024
4e403bd
Merge branch 'main' of https://github.com/groundlight/edge-endpoint i…
roxanne-o Jan 21, 2025
7554c74
updates from merge
roxanne-o Jan 21, 2025
b2de82d
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Jan 21, 2025
b6063f9
make some tests pass?
roxanne-o Jan 21, 2025
7d5b409
this past for me locally
roxanne-o Jan 24, 2025
e78c8f0
Automatically reformatting code with black and isort
Jan 24, 2025
576c925
debug one?
roxanne-o Jan 24, 2025
9eb5663
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Jan 24, 2025
3f81399
try this
roxanne-o Jan 24, 2025
6d968f1
Merge branch 'main' of https://github.com/groundlight/edge-endpoint i…
roxanne-o Jan 24, 2025
5d02b78
Automatically reformatting code with black and isort
Jan 24, 2025
231a088
fix this part one million
roxanne-o Jan 24, 2025
f471bb6
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Jan 24, 2025
f4ff964
Automatically reformatting code with black and isort
Jan 24, 2025
e363741
try this?
roxanne-o Jan 24, 2025
d5aef65
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Jan 24, 2025
11731b4
try this???
roxanne-o Jan 24, 2025
1c564ea
Automatically reformatting code with black and isort
Jan 24, 2025
d7d4379
two things
roxanne-o Jan 24, 2025
09ce237
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Jan 24, 2025
806ca41
yay a fix!
roxanne-o Jan 24, 2025
093652f
Automatically reformatting code with black and isort
Jan 24, 2025
776c312
debug
roxanne-o Jan 24, 2025
9882257
Merge branch 'integration-tests' of https://github.com/groundlight/ed…
roxanne-o Jan 24, 2025
02135d5
try this?
roxanne-o Jan 24, 2025
9ae9a1a
try this
roxanne-o Jan 24, 2025
ff143c6
docker system prune
roxanne-o Jan 24, 2025
e66259b
debugging
roxanne-o Jan 24, 2025
d30d239
more debugging
roxanne-o Jan 24, 2025
41dff23
try this?
roxanne-o Jan 24, 2025
6157358
fix yaml
roxanne-o Jan 24, 2025
c6109e8
add this
roxanne-o Jan 24, 2025
0f542e4
try this
roxanne-o Jan 27, 2025
d1added
try this?
roxanne-o Jan 27, 2025
458d618
update to this
roxanne-o Jan 27, 2025
a7f7851
idk try this
roxanne-o Jan 27, 2025
b5dd63b
try this?
roxanne-o Jan 27, 2025
ee9e9ae
try this?
roxanne-o Jan 27, 2025
eaa1737
ugh okay try this
roxanne-o Jan 27, 2025
3594841
try this
roxanne-o Jan 27, 2025
76ff2bd
try this?
roxanne-o Jan 27, 2025
74c80dc
revert this back
roxanne-o Jan 27, 2025
c3c6a0b
will this work?
roxanne-o Jan 28, 2025
bc376d1
maybe this?
roxanne-o Jan 28, 2025
4a9cf9c
get rid of this
roxanne-o Jan 28, 2025
56bdb0c
try this?
roxanne-o Jan 28, 2025
b60219c
okay we can try this
roxanne-o Jan 28, 2025
431950c
nvm it didn't quite work
roxanne-o Jan 28, 2025
363d935
rename?
roxanne-o Jan 28, 2025
66a0d8d
rename this
roxanne-o Jan 28, 2025
58c5403
make help test be the same
roxanne-o Jan 28, 2025
2ea96b2
use random id
roxanne-o Jan 28, 2025
2b6a983
change variable name
roxanne-o Jan 28, 2025
24db8e1
add runner?
roxanne-o Jan 28, 2025
8d6feec
Automatically reformatting code with black and isort
Jan 28, 2025
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
94 changes: 46 additions & 48 deletions .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,48 @@ jobs:
if: always()
run: docker stop ${{ steps.start_container.outputs.container_id }}


test-with-k3s:
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
# We only run this action if all the prior test actions succeed
needs:
- test-general-edge-endpoint
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install k3s
run: |
curl -sfL https://get.k3s.io | sh -
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
sudo chown $USER /etc/rancher/k3s/k3s.yaml
# symlink to kubeconfig
mkdir -p ~/.kube
ln -s /etc/rancher/k3s/k3s.yaml ~/.kube/config

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_GL_PUBLIC_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_GL_PUBLIC_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Install poetry
uses: snok/install-poetry@v1
with:
version: ${{ env.POETRY_VERSION }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true

- name: Install edge-endpoint's python dependencies
run: |
poetry install --no-interaction --no-root

- name: Run tests with k3s
run: make test-with-k3s

# Run Groundlight SDK tests against the edge proxy endpoint
test-sdk:
runs-on: ubuntu-22.04
Expand Down Expand Up @@ -180,13 +222,13 @@ jobs:
if: always()
run: docker stop ${{ steps.start_container.outputs.container_id }}


build-push-edge-endpoint-multiplatform:
if: (github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch')
if: ${{ github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch' }}
# We only run this action if all the prior test actions succeed
needs:
- test-general-edge-endpoint
- test-sdk
- test-with-k3s
runs-on: ubuntu-22.04
steps:
- name: Configure AWS credentials
Expand All @@ -204,54 +246,10 @@ jobs:
uses: actions/checkout@v4
- name: Build and Push Multiplatform edge-endpoint Image to ECR
timeout-minutes: 45
run:
./deploy/bin/build-push-edge-endpoint-image.sh

test-in-k3s:
needs:
# In order to test in k3s, we pull the latest edge-endpoint image from ECR. Which means that
# we need to build and push the image first or, we're just testing against a stale image.
- build-push-edge-endpoint-multiplatform
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3

- name: Install k3s
run: |
curl -sfL https://get.k3s.io | sh -
sudo chmod 644 /etc/rancher/k3s/k3s.yaml
sudo chown $USER /etc/rancher/k3s/k3s.yaml
# symlink to kubeconfig
mkdir -p ~/.kube
ln -s /etc/rancher/k3s/k3s.yaml ~/.kube/config

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_GL_PUBLIC_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_GL_PUBLIC_SECRET_ACCESS_KEY }}
aws-region: us-west-2

- name: Deploy the edge-endpoint yaml
run: |
set -ex
# Once there's a fix for disk-pressure issues on GHA's runner, we can uncomment the
# following command in order to set up the environment to test out edge inference
# source test/setup_inference_test_env.sh
export INFERENCE_FLAVOR="CPU"
export DEPLOYMENT_NAMESPACE="default"
bash deploy/bin/setup-ee.sh
kubectl describe deployment

- name: Wait for edge-endpoint pod to be ready
run: |
set -ex
kubectl rollout status deployment edge-endpoint --timeout=5m
kubectl describe pod edge-endpoint
run: ./deploy/bin/build-push-edge-endpoint-image.sh

update-glhub:
needs: test-in-k3s
needs: test-with-k3s
runs-on: ubuntu-latest
environment: live

Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
.PHONY: install install-lint install-pre-commit test test-with-docker test-all lint format
SHELL := /bin/bash

install:
poetry install --no-root
Expand All @@ -18,7 +19,9 @@ test-with-docker: install ## Run tests that require a live edge-endpoint server
test-all: test test-with-docker ## Run all tests in one make command
@echo "All tests completed."


test-with-k3s:
. test/integration/setup_and_run_tests.sh

# Adjust which paths we lint
LINT_PATHS="app test"

Expand Down
2 changes: 2 additions & 0 deletions deploy/bin/git-tag-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# including the branch name, and a consistent hash of the uncommitted changes

set -e
cd "$(dirname "$0")"


fail() {
echo $1
Expand Down
36 changes: 27 additions & 9 deletions deploy/bin/setup-ee.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# - DEPLOYMENT_NAMESPACE: The namespace for deployment. Defaults to the current namespace.
# - RUN_EDGE_ENDPOINT: Controls the launch of edge endpoint pods.
# - If set, the edge-endpoint pods will be launched. If not set, pods will not be launched.

set -ex

# If we're in a container, sudo won't be available. But otherwise there are commands where we want sudo.
Expand Down Expand Up @@ -67,13 +66,23 @@ K=${KUBECTL_CMD:-"kubectl"}
INFERENCE_FLAVOR=${INFERENCE_FLAVOR:-"GPU"}
DEPLOY_LOCAL_VERSION=${DEPLOY_LOCAL_VERSION:-1}
DEPLOYMENT_NAMESPACE=${DEPLOYMENT_NAMESPACE:-$($K config view -o json | jq -r '.contexts[] | select(.name == "'$($K config current-context)'") | .context.namespace // "default"')}
IMAGE_TAG=${IMAGE_TAG:-"latest"}

# Update K to include the deployment namespace
K="$K -n $DEPLOYMENT_NAMESPACE"

# move to the root directory of the repo
cd "$(dirname "$0")"/../..


# Replace some configurable values in our deployment manifests,
# if they are provided in environment variables.

# Most users do not need to think about these.

PERSISTENT_VOLUME_NAME=${PERSISTENT_VOLUME_NAME:-"edge-endpoint-pv"}
EDGE_ENDPOINT_PORT=${EDGE_ENDPOINT_PORT:-30101}

# Create Secrets
if ! ./deploy/bin/make-aws-secret.sh; then
echo "Failed to execute make-aws-secret.sh successfully. Exiting."
Expand Down Expand Up @@ -137,28 +146,33 @@ $K get service -o custom-columns=":metadata.name" --no-headers=true | \

# Check if DEPLOY_LOCAL_VERSION is set. If so, use a local volume instead of an EFS volume
if [[ "${DEPLOY_LOCAL_VERSION}" == "1" ]]; then
if ! check_pv_conflict "edge-endpoint-pv" "local-sc"; then
fail "PersistentVolume edge-endpoint-pv conflicts with the existing resource."
if ! check_pv_conflict "$PERSISTENT_VOLUME_NAME" "local-sc"; then
fail "PersistentVolume $PERSISTENT_VOLUME_NAME conflicts with the existing resource."
fi

$K apply -f deploy/k3s/local_persistent_volume.yaml
# Use envsubst to replace the PERSISTENT_VOLUME_NAME, PERSISTENT_VOLUME_NAME in the local_persistent_volume.yaml template
envsubst < deploy/k3s/local_persistent_volume.yaml > deploy/k3s/local_persistentvolume.yaml
$K apply -f deploy/k3s/local_persistentvolume.yaml
rm deploy/k3s/local_persistentvolume.yaml

else
# If environment variable EFS_VOLUME_ID is not set, exit
if [[ -z "${EFS_VOLUME_ID}" ]]; then
fail "EFS_VOLUME_ID environment variable not set"
fi

if ! check_pv_conflict "edge-endpoint-pv" "efs-sc"; then
fail "PersistentVolume edge-endpoint-pv conflicts with the existing resource."
if ! check_pv_conflict "$PERSISTENT_VOLUME_NAME" "efs-sc"; then
fail "PersistentVolume $PERSISTENT_VOLUME_NAME conflicts with the existing resource."
fi

# Use envsubst to replace the EFS_VOLUME_ID in the persistentvolumeclaim.yaml template
# Use envsubst to replace the EFS_VOLUME_ID, PERSISTENT_VOLUME_NAME, PERSISTENT_PERSISTENT_VOLUME_NAMEVOLUME_CLAIM_NAME
# in the persistentvolumeclaim.yaml template
envsubst < deploy/k3s/efs_persistent_volume.yaml > deploy/k3s/persistentvolume.yaml
$K apply -f deploy/k3s/persistentvolume.yaml
rm deploy/k3s/persistentvolume.yaml
fi

# Check if the edge-endpoint-pvc exists. If not, create it
# Check if the persistent volume claim exists. If not, create it
if ! $K get pvc edge-endpoint-pvc; then
# If environment variable EFS_VOLUME_ID is not set, exit
if [[ -z "${EFS_VOLUME_ID}" ]]; then
Expand All @@ -179,6 +193,10 @@ $K apply -f deploy/k3s/service_account.yaml.tmp
rm deploy/k3s/service_account.yaml.tmp

$K apply -f deploy/k3s/inference_deployment/warmup_inference_model.yaml
$K apply -f deploy/k3s/edge_deployment/edge_deployment.yaml

# Substitutes the EDGE_ENDPOINT_PORT
envsubst < deploy/k3s/edge_deployment/edge_deployment.yaml > deploy/k3s/edge_deployment/edge_deployment.yaml.tmp
$K apply -f deploy/k3s/edge_deployment/edge_deployment.yaml.tmp
rm deploy/k3s/edge_deployment/edge_deployment.yaml.tmp

$K describe deployment edge-endpoint
4 changes: 2 additions & 2 deletions deploy/k3s/edge_deployment/edge_deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ spec:
- protocol: TCP
# Service port for NGINX
port: 30101
nodePort: 30101
nodePort: ${EDGE_ENDPOINT_PORT}
type: NodePort
---
apiVersion: apps/v1
Expand All @@ -40,7 +40,7 @@ spec:
serviceAccountName: edge-endpoint-service-account
initContainers:
- name: database-prep
image: &edgeEndpointImage 767397850842.dkr.ecr.us-west-2.amazonaws.com/edge-endpoint:latest
image: &edgeEndpointImage 767397850842.dkr.ecr.us-west-2.amazonaws.com/edge-endpoint:${IMAGE_TAG}
imagePullPolicy: Always
volumeMounts:
- name: edge-endpoint-persistent-volume
Expand Down
2 changes: 1 addition & 1 deletion deploy/k3s/efs_persistent_volume.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: edge-endpoint-pv
name: ${PERSISTENT_VOLUME_NAME}
spec:
capacity:
storage: 2Gi
Expand Down
2 changes: 1 addition & 1 deletion deploy/k3s/local_persistent_volume.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
kind: PersistentVolume
metadata:
name: edge-endpoint-pv
name: ${PERSISTENT_VOLUME_NAME}
spec:
capacity:
storage: 2Gi
Expand Down
Loading