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 Test suite + kind workflow to add them to ci #384

Merged
merged 25 commits into from
Jan 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
efee7ea
Add kind test support for dspa.
HumairAK Sep 29, 2023
73b95d8
Replace old e2e test suite with ginkgo/gomega systems test.
HumairAK Oct 5, 2023
78dea73
Add k8s client configuration for systemtests.
HumairAK Oct 5, 2023
b5b0859
Add client manager for systemtests.
HumairAK Oct 6, 2023
338a57a
Add k8s server flags to system test suite.
HumairAK Oct 6, 2023
b3ceb8f
Add dspa-lite resource, add ns/dspa flags.
HumairAK Oct 6, 2023
5bf229e
Assert on k8s client creation in sys test.
HumairAK Oct 6, 2023
c548c3c
Add dspa setup/teardown for systest.
HumairAK Oct 6, 2023
c631ab3
Add DSPA deploy wait to sys test.
HumairAK Oct 6, 2023
8a2297a
Add dspa tests & skip deploy/cleanup flags.
HumairAK Oct 6, 2023
0038a63
Add systest pod ready states & flag timeouts.
HumairAK Oct 6, 2023
efaa455
Correct linting errors.
HumairAK Oct 6, 2023
2097dbd
Add stub main to pass precommit go build check.
HumairAK Oct 6, 2023
5585247
Add portforwarding logic and working apiserver url.
HumairAK Oct 6, 2023
e353c07
Add pipeline upload test.
HumairAK Oct 6, 2023
b62d53d
Added dspa deploy log messages in sys test.
HumairAK Oct 6, 2023
420a87b
Update kind tests to leverage ginkgo system tests.
HumairAK Oct 6, 2023
63b6be2
Add systest readme.
HumairAK Oct 6, 2023
1e40fbc
Switch to local build for images.
HumairAK Oct 6, 2023
6250eaa
Add build flags for systests.
HumairAK Oct 6, 2023
ee4ef43
Remove unused action and add licenses.
HumairAK Oct 6, 2023
3167cb5
Rename systest to integartion tests.
HumairAK Oct 19, 2023
9e15ddc
Add make command for integration tests.
HumairAK Oct 19, 2023
2f961f7
Clean up integration test suite.
HumairAK Oct 24, 2023
efc1399
Update kind test dspo ns to opendatahub.
HumairAK Jan 8, 2024
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
716 changes: 708 additions & 8 deletions .github/resources/crds/servicemonitor-crd.yaml

Large diffs are not rendered by default.

52 changes: 52 additions & 0 deletions .github/resources/dspa-lite/dspa.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
apiVersion: datasciencepipelinesapplications.opendatahub.io/v1alpha1
kind: DataSciencePipelinesApplication
metadata:
name: test-dspa
spec:
apiServer:
enableOauth: false
resources:
limits:
cpu: 20m
memory: 500Mi
requests:
cpu: 20m
memory: 100m
scheduledWorkflow:
resources:
limits:
cpu: 20m
memory: 500Mi
requests:
cpu: 20m
memory: 100m
persistenceAgent:
resources:
limits:
cpu: 20m
memory: 500Mi
requests:
cpu: 20m
memory: 100Mi
database:
mariaDB:
image: quay.io/centos7/mariadb-103-centos7:ea07c0dade9571d78a272b453fd2dea92077dc7f
pvcSize: 500Mi
resources:
limits:
cpu: 20m
memory: 500Mi
requests:
cpu: 20m
memory: 100m
objectStorage:
minio:
image: 'quay.io/opendatahub/minio:RELEASE.2019-08-14T20-37-41Z-license-compliance'
pvcSize: 500Mi
resources:
limits:
cpu: 20m
memory: 500Mi
requests:
cpu: 20m
memory: 100m
43 changes: 43 additions & 0 deletions .github/resources/tekton-lite/anyuid-scc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
allowHostDirVolumePlugin: false
allowHostIPC: false
allowHostNetwork: false
allowHostPID: false
allowHostPorts: false
allowPrivilegeEscalation: true
allowPrivilegedContainer: false
allowedCapabilities: null
apiVersion: security.openshift.io/v1
defaultAddCapabilities: null
fsGroup:
type: MustRunAs
groups: []
kind: SecurityContextConstraints
metadata:
name: tekton-anyuid
priority: 10
readOnlyRootFilesystem: false
requiredDropCapabilities:
- KILL
- MKNOD
- SETUID
- SETGID
runAsUser:
type: RunAsAny
seLinuxContext:
type: MustRunAs
supplementalGroups:
type: RunAsAny
users:
- system:serviceaccount:tekton-pipelines:tekton-pipelines-controller
- system:serviceaccount:tekton-pipelines:tekton-pipelines-webhook
volumes:
- configMap
- csi
- downwardAPI
- emptyDir
- ephemeral
- persistentVolumeClaim
- projected
- secret
seccompProfiles:
- runtime/default
11 changes: 11 additions & 0 deletions .github/resources/tekton-lite/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- https://github.com/opendatahub-io/data-science-pipelines//manifests/kustomize/third-party/tekton/installs/cluster/?ref\=master
- anyuid-scc.yaml
patchesStrategicMerge:
- patches/deployment_tekton-pipelines-controller.yaml
- patches/deployment_tekton-pipelines-remote-resolvers.yaml
- patches/deployment_tekton-pipelines-webhook.yaml
- patches/horizontalpodautoscaler_tekton-pipelines-webhook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-pipelines-controller
namespace: tekton-pipelines
spec:
replicas: 1
template:
spec:
containers:
- name: tekton-pipelines-controller
resources:
limits:
cpu: 100m
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-pipelines-remote-resolvers
namespace: tekton-pipelines-resolvers
spec:
replicas: 1
template:
spec:
containers:
- name: controller
resources:
limits:
cpu: 100m
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tekton-pipelines-webhook
namespace: tekton-pipelines
spec:
replicas: 1
template:
spec:
containers:
- name: webhook
resources:
limits:
cpu: 100m
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
labels:
app.kubernetes.io/component: webhook
app.kubernetes.io/instance: default
app.kubernetes.io/name: webhook
app.kubernetes.io/part-of: tekton-pipelines
app.kubernetes.io/version: v0.41.0
pipeline.tekton.dev/release: v0.41.0
version: v0.41.0
name: tekton-pipelines-webhook
namespace: tekton-pipelines
spec:
maxReplicas: 1
metrics:
- resource:
name: cpu
target:
averageUtilization: 100
type: Utilization
type: Resource
minReplicas: 1
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: tekton-pipelines-webhook
87 changes: 87 additions & 0 deletions .github/workflows/kind-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: KinD DSPO/DSP Integration Tests

on:
workflow_dispatch:
pull_request:
paths:
- controllers/**
- api/**
- config/**
- tests/**
types:
- opened
- reopened
- closed
- synchronize

concurrency:
group: ${{ github.head_ref }}-${{ github.workflow }}
cancel-in-progress: true

env:
IMAGE_REPO_DSPO: data-science-pipelines-operator
DSPA_NAMESPACE: test-dspa
DSPA_NAME: test-dspa
DSPA_DEPLOY_WAIT_TIMEOUT: 300
INTEGRATION_TESTS_DIR: ${{ github.workspace }}/tests
jobs:
dspo-tests:
runs-on: ubuntu-20.04
timeout-minutes: 60

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v1
with:
go-version: '1.19.x'
id: go

- name: Setup and start KinD cluster
uses: ./.github/actions/kind

# TODO: Consolidate testing CRDS (2 locations)
- name: Apply OCP CRDs
env:
RESOURCES_DIR: ${{ github.workspace }}/.github/resources
CONFIG_DIR: ${{ github.workspace }}/config
run: |
kubectl apply -f ${{ env.RESOURCES_DIR }}/crds
kubectl apply -f ${{ env.CONFIG_DIR }}/crd/external/route.openshift.io_routes.yaml

- name: Build image
env:
DSPO_IMAGE: ${{env.REGISTRY_ADDRESS}}/data-science-pipelines-operator
run: |
make podman-build -e IMG="${DSPO_IMAGE}"

- name: Deploy DSPO
env:
DSPO_IMAGE: ${{env.REGISTRY_ADDRESS}}/data-science-pipelines-operator
run: |
kubectl create namespace opendatahub
make podman-push -e IMG="${DSPO_IMAGE}"
make deploy-kind -e IMG="${DSPO_IMAGE}"

- name: Wait for DSPO deployment
run: |
kubectl wait -n opendatahub --timeout=60s --for=condition=Available=true deployment data-science-pipelines-operator-controller-manager

- name: Create DSPA Namespace
run: |
kubectl create namespace ${{ env.DSPA_NAMESPACE }}

- name: Run tests
working-directory: ${{ github.workspace }}
env:
NAMESPACE: ${{ env.DSPA_NAMESPACE }}
DSPA_NAME: ${{ env.DSPA_NAME }}
run: |
make integrationtest K8SAPISERVERHOST=$(oc whoami --show-server) DSPANAMESPACE=${NAMESPACE}

- name: Clean up
run: |
make undeploy-kind
26 changes: 25 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ ENVTEST_K8S_VERSION = 1.25.0
# Namespace to deploy the operator
OPERATOR_NS ?= opendatahub

# Integration Test ENVvars
KUBECONFIGPATH ?= $(HOME)/.kube/config
K8SAPISERVERHOST ?= http://localhost:6443
DSPANAMESPACE ?= default
DSPAPATH ?= resources/dspa-lite.yaml

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
Expand Down Expand Up @@ -115,6 +121,11 @@ unittest: manifests generate fmt vet envtest ## Run tests.
functest: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test ./... --tags=test_functional -coverprofile cover.out

.PHONY: integrationtest
integrationtest: ## Run integration tests
cd tests && \
go run github.com/onsi/ginkgo/v2/ginkgo --tags=test_integration -- -kubeconfig=${KUBECONFIGPATH} -k8sApiServerHost=${K8SAPISERVERHOST} -DSPANamespace=${DSPANAMESPACE} -DSPAPath=${DSPAPATH} -ginkgo.v
HumairAK marked this conversation as resolved.
Show resolved Hide resolved

##@ Build

.PHONY: build
Expand All @@ -126,7 +137,7 @@ run: manifests generate fmt vet ## Run a controller from your host.
go run ./main.go

.PHONY: podman-build
podman-build: test ## Build container image with the manager.
podman-build: ## Build container image with the manager.
podman build -t ${IMG} .

.PHONY: podman-push
Expand Down Expand Up @@ -154,11 +165,24 @@ deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in
&& $(KUSTOMIZE) edit set namespace ${OPERATOR_NS}
$(KUSTOMIZE) build config/overlays/make-deploy | kubectl apply -f -

.PHONY: deploy-kind
deploy-kind:
cd config/overlays/kind-tests \
&& kustomize edit set image controller=${IMG} \
&& kustomize edit set namespace ${OPERATOR_NS}
kustomize build config/overlays/kind-tests | kubectl apply -f -
HumairAK marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
cd config/overlays/make-deploy && $(KUSTOMIZE) edit set namespace ${OPERATOR_NS}
$(KUSTOMIZE) build config/overlays/make-deploy | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

.PHONY: undeploy-kind
undeploy-kind: ## Undeploy controller from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion.
cd config/overlays/kind-tests \
&& kustomize edit set namespace ${OPERATOR_NS}
kustomize build config/overlays/kind-tests | kubectl delete --ignore-not-found=$(ignore-not-found) -f -

##@ Build Dependencies

## Location to install dependencies to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# This CRD is used for func/kind tests
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
Expand Down
1 change: 1 addition & 0 deletions config/crd/external/route.openshift.io_routes.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This CRD is used for func/kind tests
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
1 change: 1 addition & 0 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ spec:
- /home/config
image: $(IMAGES_DSPO)
name: manager
imagePullPolicy: Always
env:
# Env vars are prioritized over --config
- name: IMAGES_APISERVER
Expand Down
11 changes: 11 additions & 0 deletions config/overlays/kind-tests/img_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: data-science-pipelines-operator-controller-manager
namespace: opendatahub
spec:
template:
spec:
containers:
- image: controller
name: manager
13 changes: 13 additions & 0 deletions config/overlays/kind-tests/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: kustomize.config.k8s.io/v1beta1
DharmitD marked this conversation as resolved.
Show resolved Hide resolved
HumairAK marked this conversation as resolved.
Show resolved Hide resolved
kind: Kustomization
namespace: opendatahub
resources:
- ../../base
patchesStrategicMerge:
- img_patch.yaml
- res_patch.yaml
- user_patch.yaml
images:
- name: controller
newName: quay.io/opendatahub/data-science-pipelines-operator
newTag: main
Loading
Loading