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

Improve speed of execution for integration tests #1086

Merged
merged 42 commits into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
6337728
Testing parallel tests
axsaucedo Nov 10, 2019
945847d
Added unique namespace per test
axsaucedo Nov 10, 2019
b06b9cd
Cleaned and fixed namespaces
axsaucedo Nov 10, 2019
e90be22
Updated conftest typo
axsaucedo Nov 10, 2019
3231b97
Updated to support retries on apply
axsaucedo Nov 10, 2019
2680d01
Updated to support retries on apply
axsaucedo Nov 10, 2019
cf6d055
Changed make to have optional number of workers
axsaucedo Nov 11, 2019
a0bca43
Added limits to ensure enough memory for kube system
axsaucedo Nov 11, 2019
16a3dd6
Fixed helm charts
axsaucedo Nov 11, 2019
285e058
Added wait before initial request
axsaucedo Nov 11, 2019
9d9c937
Re-added make dependencies
axsaucedo Nov 11, 2019
4d071cc
Updated kind script to only run builds for images that have been updated
axsaucedo Nov 11, 2019
611c19a
Updated for linter
axsaucedo Nov 11, 2019
df0b07d
Removed commented code
axsaucedo Nov 11, 2019
8c72551
Added multithreading by default
axsaucedo Nov 11, 2019
06fabef
Updated script to run when files are modified and show modified files
axsaucedo Nov 11, 2019
1344da4
Merge remote-tracking branch 'upstream/master' into 1032_improve_spee…
axsaucedo Nov 11, 2019
cf65e7e
Merge remote-tracking branch 'upstream/master' into 1032_improve_spee…
axsaucedo Nov 11, 2019
a68f8b5
Added parallel execution of python tests
axsaucedo Nov 11, 2019
6676350
Removed concurrent tests
axsaucedo Nov 11, 2019
366741c
Added requests
axsaucedo Nov 11, 2019
3f56f3b
Added less cores
axsaucedo Nov 11, 2019
65b6960
Moved prints to logs and added extra guards on namespace creation
axsaucedo Nov 11, 2019
73c9077
Removed logging from request loops
axsaucedo Nov 11, 2019
adf933c
Added networking config
axsaucedo Nov 12, 2019
9b5b9d7
Added networking config
axsaucedo Nov 12, 2019
95f1f68
Removing networking
axsaucedo Nov 12, 2019
1b2cf7c
Disabling CNI
axsaucedo Nov 12, 2019
8322dff
Disabling s2i tests
axsaucedo Nov 12, 2019
b7238cb
Updated testing scripts
axsaucedo Nov 12, 2019
1aa5727
Added initial rest request
axsaucedo Nov 12, 2019
125e925
Added support for initial requests with data
axsaucedo Nov 12, 2019
b44b038
Added support for initial requests with data
axsaucedo Nov 12, 2019
f211d0d
Added support for initial requests with data
axsaucedo Nov 12, 2019
10a9c8c
Adding explicit run of script on background
axsaucedo Nov 13, 2019
b6fe47a
Updated pods info
axsaucedo Nov 13, 2019
6f85ebd
Updated pods to pass all tests
axsaucedo Nov 13, 2019
1abde69
Updated prepackaged model
axsaucedo Nov 13, 2019
7f50210
Added lower attempts and lower cores
axsaucedo Nov 13, 2019
b1df57d
Separated s2i tests from the rest
axsaucedo Nov 13, 2019
cc865bc
Separated s2i tests from the rest
axsaucedo Nov 13, 2019
c4025e4
Added check for 200 check
axsaucedo Nov 13, 2019
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
4 changes: 2 additions & 2 deletions jenkins-x-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ pipelineConfig:
mountPath: /var/lib/docker
resources:
requests:
cpu: 1
memory: 4000Mi
cpu: 4
memory: 8000Mi
securityContext:
privileged: true
imagePullPolicy: Always
Expand Down
2 changes: 1 addition & 1 deletion jenkins-x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pipelineConfig:
resources:
requests:
cpu: 1
memory: 4000Mi
memory: 2000Mi
securityContext:
privileged: true
imagePullPolicy: Always
Expand Down
21 changes: 19 additions & 2 deletions testing/scripts/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
VERSION := $(shell cat ../../version.txt)

# This can be "Auto" or a Number
PYTEST_WORKERS ?= "4"

kind_create_cluster:
kind create cluster --config kind_config.yaml

Expand Down Expand Up @@ -36,7 +39,7 @@ create_namespaces:
kubectl create namespace test1 || echo "Namespace test1 already exists"
kubectl config set-context $$(kubectl config current-context) --namespace=seldon

kind_setup: kind_build_images install_helm install_ambassador install_seldon create_namespaces
kind_setup: install_helm install_ambassador install_seldon create_namespaces

port-forward-ambassador:
kubectl port-forward $$(kubectl get pods -n seldon -l app.kubernetes.io/name=ambassador -o jsonpath='{.items[0].metadata.name}') -n seldon 8003:8080
Expand All @@ -61,7 +64,21 @@ install:

.PHONY: test
test: build_protos install
pytest --verbose -s -W ignore 2>&1
pip install pytest-xdist
axsaucedo marked this conversation as resolved.
Show resolved Hide resolved
# Run the core tests in parallel
pytest \
--verbose \
-s \
-W ignore \
--ignore test_s2i_python.py \
-n $(PYTEST_WORKERS) 2>&1
# Then run the s2i tests in sequence (as they currently fail in parallel
pytest \
--verbose \
-s \
-W ignore \
-n 0 \
test_s2i_python.py 2>&1

.PHONY: clean
clean:
Expand Down
20 changes: 15 additions & 5 deletions testing/scripts/conftest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
import pytest
from k8s_utils import *
from s2i_utils import *
from seldon_e2e_utils import get_s2i_python_version
from subprocess import run


@pytest.fixture(scope="session", autouse=True)
def run_pod_information_in_background(request):
# This command runs the pod information and prints it
# in the background every time there's a new update
run(
(
"kubectl get pods --all-namespaces -w | "
+ 'awk \'{print "\\nPODS UPDATE: "$0"\\n"}\' & '
),
shell=True,
)


@pytest.fixture(scope="module")
def s2i_python_version():
return do_s2i_python_version()


#### Implementations below


def do_s2i_python_version():
return get_s2i_python_version()
25 changes: 0 additions & 25 deletions testing/scripts/k8s_utils.py

This file was deleted.

22 changes: 22 additions & 0 deletions testing/scripts/kind_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,25 @@ nodes:
extraPortMappings:
- containerPort: 30080
hostPort: 8003
kubeadmConfigPatches:
- |
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
metadata:
name: config
kubeReserved:
cpu: "300m"
memory: "300Mi"
ephemeral-storage: "1Gi"
kubeReservedCgroup: "/kube-reserved"
systemReserved:
cpu: "300m"
memory: "300Mi"
ephemeral-storage: "1Gi"
evictionHard:
memory.available: "200Mi"
nodefs.available: "10%"
featureGates:
DynamicKubeletConfig: true
RotateKubeletServerCertificate: true

36 changes: 30 additions & 6 deletions testing/scripts/kind_test_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,37 @@ export KUBECONFIG=$(kind get kubeconfig-path)

# ONLY RUN THE FOLLOWING IF SUCCESS
if [[ ${KIND_EXIT_VALUE} -eq 0 ]]; then
# BUILD S2I BASE IMAGES
make s2i_build_base_images
S2I_EXIT_VALUE=$?

# CREATE PROTOS
make build_protos
PROTOS_EXIT_VALUE=$?
echo "Files changed in python folder:"
git --no-pager diff --exit-code --name-only origin/master ../../python
PYTHON_MODIFIED=$?
axsaucedo marked this conversation as resolved.
Show resolved Hide resolved
if [[ $PYTHON_MODIFIED -gt 0 ]]; then
make s2i_build_base_images
else
echo "SKIPPING PYTHON IMAGE BUILD..."
fi

echo "Files changed in operator folder:"
git --no-pager diff --exit-code --name-only origin/master ../../operator
OPERATOR_MODIFIED=$?
if [[ $OPERATOR_MODIFIED -gt 0 ]]; then
make kind_build_operator
OPERATOR_EXIT_VALUE=$?
else
echo "SKIPPING OPERATOR IMAGE BUILD..."
fi

echo "Files changed in engine folder:"
git --no-pager diff --exit-code --name-only origin/master ../../engine
ENGINE_MODIFIED=$?
if [[ $ENGINE_MODIFIED -gt 0 ]]; then
make build_protos
PROTO_EXIT_VALUE=$?
make kind_build_engine
ENGINE_EXIT_VALUE=$?
else
echo "SKIPPING ENGINE IMAGE BUILD..."
fi

# KIND CLUSTER SETUP
make kind_setup
Expand Down
13 changes: 0 additions & 13 deletions testing/scripts/s2i_utils.py

This file was deleted.

Loading