diff --git a/test/canary/Dockerfile.canary b/test/canary/Dockerfile.canary index 177fb3c9..186464a3 100644 --- a/test/canary/Dockerfile.canary +++ b/test/canary/Dockerfile.canary @@ -1,21 +1,53 @@ -FROM public.ecr.aws/ubuntu/ubuntu:18.04 +FROM public.ecr.aws/ubuntu/ubuntu:22.04 -# Build time parameters +# Build time parameters ARG SERVICE=sagemaker +# Python parameters +ARG PYTHON=python3 +ARG PYTHON_VERSION=3.12.8 +ARG PYTHON_SHORT_VERSION=3.12 +# Python won’t try to write .pyc or .pyo files on the import of source modules +# Force stdin, stdout and stderr to be totally unbuffered. Good for logging +ENV PYTHONDONTWRITEBYTECODE=1 +ENV PYTHONUNBUFFERED=1 +ENV PYTHONIOENCODING=UTF-8 + RUN apt-get update && apt-get install -y curl \ wget \ git \ - python3.8 \ - python3-pip \ - python3.8-dev \ vim \ sudo \ jq \ - unzip + unzip \ + zlib1g-dev \ + cmake \ + libssl-dev + +# Install python +RUN cd /tmp/ \ +&& wget https://www.python.org/ftp/python/${PYTHON_VERSION}/Python-${PYTHON_VERSION}.tgz \ +&& tar xzf Python-${PYTHON_VERSION}.tgz \ +&& cd Python-${PYTHON_VERSION} \ +&& ./configure --enable-optimizations --with-lto --with-computed-gotos --with-system-ffi \ +&& make -j "$(nproc)" \ +&& make altinstall \ +&& cd .. \ +&& rm -rf Python-${PYTHON_VERSION} \ +&& rm Python-${PYTHON_VERSION}.tgz \ +&& ln -s /usr/local/bin/python${PYTHON_SHORT_VERSION} /usr/local/bin/python \ +&& ln -s /usr/local/bin/python${PYTHON_SHORT_VERSION} /usr/local/bin/python3 \ +&& rm -f /root/.python_history + +# Python Path +ENV PATH="/usr/local/bin:${PATH}" + +RUN python -m pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org +RUN pip install --no-cache-dir \ + setuptools # Install awscli -RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64-2.6.3.zip" -o "awscliv2.zip" \ +RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ && unzip -qq awscliv2.zip \ && ./aws/install @@ -25,26 +57,23 @@ RUN apt-get update && apt install -y software-properties-common \ && apt update && apt install -y yq # Install kubectl -RUN curl -LO "https://dl.k8s.io/release/v1.24.0/bin/linux/amd64/kubectl" \ +RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" \ && chmod +x ./kubectl \ && cp ./kubectl /bin # Install eksctl RUN curl --silent --location "https://github.com/weaveworks/eksctl/releases/latest/download/eksctl_$(uname -s)_amd64.tar.gz" | tar xz -C /tmp && mv /tmp/eksctl /bin -# Install Helm -RUN curl -q -L "https://get.helm.sh/helm-v3.7.0-linux-amd64.tar.gz" | tar zxf - -C /usr/local/bin/ \ +# Install Helm +RUN curl -q -L "https://get.helm.sh/helm-v4.0.0-linux-amd64.tar.gz" | tar zxf - -C /usr/local/bin/ \ && mv /usr/local/bin/linux-amd64/helm /usr/local/bin/helm \ && rm -r /usr/local/bin/linux-amd64 \ - && chmod +x /usr/local/bin/helm + && chmod +x /usr/local/bin/helm ENV SERVICE_REPO_PATH=/$SERVICE-controller COPY ./test/e2e/requirements.txt requirements.txt -RUN ln -s /usr/bin/python3.8 /usr/bin/python \ - && python -m pip install --upgrade pip - RUN python -m pip install -r requirements.txt WORKDIR /$SERVICE_REPO_PATH -CMD ["./test/canary/scripts/run_test.sh"] \ No newline at end of file +CMD ["./test/canary/scripts/run_test.sh"] diff --git a/test/canary/canary.buildspec.yaml b/test/canary/canary.buildspec.yaml index 5ffbdb70..19fb6972 100644 --- a/test/canary/canary.buildspec.yaml +++ b/test/canary/canary.buildspec.yaml @@ -19,15 +19,15 @@ phases: commands: # Run tests - docker run --name ack-canary $(env | cut -f1 -d= | sed 's/^/-e /') --mount type=bind,source="$(pwd)/",target="/${SERVICE}-controller/" ${ECR_CACHE_URI}:latest - + post_build: commands: - docker cp ack-canary:/sagemaker-controller/test/canary/integration_tests.xml /tmp/results.xml || true # Push test image to cache ECR repo - docker push ${ECR_CACHE_URI}:latest || true - + reports: IntegrationTestReport: files: - "results.xml" - base-directory: "/tmp" \ No newline at end of file + base-directory: "/tmp" diff --git a/test/canary/scripts/install_controller_helm.sh b/test/canary/scripts/install_controller_helm.sh index 4bf55026..d8315f49 100755 --- a/test/canary/scripts/install_controller_helm.sh +++ b/test/canary/scripts/install_controller_helm.sh @@ -8,13 +8,12 @@ function install_helm_chart() { local region="$3" local namespace="$4" - yq w -i helm/values.yaml "serviceAccount.annotations" "" - yq w -i helm/values.yaml 'serviceAccount.annotations."eks.amazonaws.com/role-arn"' "$oidc_role_arn" - yq w -i helm/values.yaml "aws.region" $region - yq w -i helm/values.yaml "log.level" "debug" - yq w -i helm/values.yaml "log.enable_development_logging" "true" - + yq eval ".serviceAccount.annotations = {}" -i helm/values.yaml + yq eval ".serviceAccount.annotations.\"eks.amazonaws.com/role-arn\" = \"$oidc_role_arn\"" -i helm/values.yaml + yq eval ".aws.region = \"$region\"" -i helm/values.yaml + yq eval '.log.level = "debug"' -i helm/values.yaml + yq eval '.log.enable_development_logging = true' -i helm/values.yaml kubectl apply -f helm/crds helm install -n $namespace --create-namespace ack-$service-controller --skip-crds helm -} \ No newline at end of file +} diff --git a/test/canary/scripts/run_test.sh b/test/canary/scripts/run_test.sh index 094e7424..7d7eca5a 100755 --- a/test/canary/scripts/run_test.sh +++ b/test/canary/scripts/run_test.sh @@ -1,6 +1,6 @@ #!/bin/bash -# cleanup on EXIT regardles of error +# cleanup on EXIT regardles of error # Inputs to this file as environment variables # SERVICE @@ -12,7 +12,7 @@ set -euo pipefail export NAMESPACE=${NAMESPACE:-"ack-system"} -export AWS_DEFAULT_REGION=$SERVICE_REGION +export AWS_DEFAULT_REGION=$SERVICE_REGION export E2E_DIR=$SERVICE_REPO_PATH/test/e2e/ SCRIPTS_DIR=${SERVICE_REPO_PATH}/test/canary/scripts @@ -47,7 +47,6 @@ function cleanup { kubectl delete modelbiasjobdefinitions --all kubectl delete modelexplainabilityjobdefinitions --all kubectl delete modelqualityjobdefinitions --all - kubectl delete adoptedresources --all kubectl delete featuregroups --all kubectl delete modelpackages --all kubectl delete modelpackagegroups --all @@ -65,7 +64,7 @@ function cleanup { kubectl delete namespace $NAMESPACE cd $E2E_DIR - export PYTHONPATH=.. + export PYTHONPATH=.. python service_cleanup.py } diff --git a/test/e2e/requirements.txt b/test/e2e/requirements.txt index 3cea3154..201d8306 100644 --- a/test/e2e/requirements.txt +++ b/test/e2e/requirements.txt @@ -1,4 +1,4 @@ -acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@c91073f388b3b42192aac300762fca2542fa39f0 +acktest @ git+https://github.com/aws-controllers-k8s/test-infra.git@b9fd0d31598f7cc9e2952d9513501c6c2464b059 pytest==8.0.2 -black==20.8b1 +black>=24.3.0 flaky==3.7.0 diff --git a/test/e2e/tests/test_inference_component.py b/test/e2e/tests/test_inference_component.py index 157e37b8..99ccbae3 100644 --- a/test/e2e/tests/test_inference_component.py +++ b/test/e2e/tests/test_inference_component.py @@ -248,17 +248,6 @@ def update_inference_component_failed_test(self, inference_component, faulty_mod resource = k8s.wait_resource_consumed_by_controller(reference) assert resource is not None - # inference component transitions Updating -> InService state - assert_inference_component_status_in_sync( - reference.name, - reference, - cfg.INFERENCE_COMPONENT_STATUS_UPDATING, - ) - - assert k8s.wait_on_condition( - reference, ack_condition.CONDITION_TYPE_RESOURCE_SYNCED, "False" - ) - assert k8s.get_resource_condition(reference, ack_condition.CONDITION_TYPE_TERMINAL) is None resource = k8s.get_resource(reference) assert_inference_component_status_in_sync(