Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/workflows/test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ name: E2E test

on:
workflow_call:
inputs:
release:
description: 'Kubeflex release to test (e.g. latest or v0.5.1)'
required: false
type: string
workflow_dispatch:
inputs:
release:
description: 'Kubeflex release to test (e.g. latest or v0.5.1)'
required: false
type: string
pull_request:
branches:
- main
Expand Down
6 changes: 6 additions & 0 deletions docs/contributors.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ LATEST_TAG=<tag used for image> make ko-build-push-cmupdate
```
Wait until goreleaser completes the release process.

1. Invoke [the E2E test workflow](../.github/workflows/test-e2e.yaml) on
the release just made (e.g, using [the GitHub web
UI](https://github.com/kubestellar/kubeflex/actions/workflows/test-e2e.yaml)). See
if it succeeds. If not then there is a problem that needs to be
remedied and a newer release made.

1. The goreleaser workflow will also create a branch named `brew` with some changes (to the homebrew instsall script) that need to get merged into `main`. Make a PR to merge `brew` into `main`, and get it approved and merged.

1. To avoid leaving a time bomb, delete that `brew` branch after it was merged into `main` (the goreleaser will fail to create the new `brew` branch if one already exists).
15 changes: 5 additions & 10 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
KubeFlex provides an end-to-end (E2E) test suite that validates full system behavior in a Kubernetes environment.

End-to-end tests that can be used manually by a contributor or be triggered by CI.
The end-to-end test suite can be used manually by a contributor and also is used in CI.

The end-to-end test suite can either test the local sources or a given release.

## Prerequisites
`kind`,`jq` and `kubectl` are required to run the test.

## Run E2E tests manually
#### The E2E test suite can be run in the following modes:
- local source builds
- a released KubeFlex version, specified with the `--release` option

When a release is specified, the tests install KubeFlex from a published Helm chart.
The special value `latest` installs the most recent released version, while a literal
version installs that specific release.

From the root directory of this git repository, you can run:
From the root directory of this git repository, you can run any of the following commands.

```shell
test/e2e/run.sh # Run E2E tests against local source
test/e2e/run.sh --release latest # Run E2E tests against the latest released version
test/e2e/run.sh --release v0.9.2 # Run E2E tests against a specific release
test/e2e/run.sh --release v0.9.1 # Run E2E tests against a specific release
```
82 changes: 45 additions & 37 deletions test/e2e/setup-kubeflex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ release=""
while [[ $# -gt 0 ]]; do
case "$1" in
--release)
if [[ $# -lt 2 ]]; then
echo "Error: --release requires a value (e.g. v0.9.2 or latest)"
exit 1
fi
release="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
exit 1
;;
if [[ $# -lt 2 ]]; then
echo "Error: --release requires a value (e.g. v0.9.2 or latest)"
exit 1
fi
release="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
exit 1
;;
esac
done
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
Expand All @@ -46,30 +46,27 @@ kubectl -n ingress-nginx patch deployment/ingress-nginx-controller --patch-file=
:
: -------------------------------------------------------------------------
if [[ -z "${release}" ]]; then
echo "Installing kubeflex from local source"
: Compile binaries
:
make build
echo "Installing kubeflex from local source"
: Compile binaries
:
make build

:
: -------------------------------------------------------------------------
: Build the OCI image for the kubeflex controller manager and load it in the local docker registry
:
:
make ko-local-build
:
: -------------------------------------------------------------------------
: Build the OCI image for the kubeflex controller manager and load it in the local docker registry
:
:
make ko-local-build

:
: -------------------------------------------------------------------------
: Load the local image in kind, re-generate manifests and helm chart, and install the helm chart:
:
:
make install-local-chart
:
:
:
: -------------------------------------------------------------------------
: Load the local image in kind, re-generate manifests and helm chart, and install the helm chart:
:
:
make install-local-chart
:
:
else
echo "Installing kubeflex release: ${release}"
kubectl create namespace kubeflex-system --dry-run=client -o yaml | kubectl apply -f -

if [[ "${release}" == "latest" ]]; then
echo "Resolving latest kubeflex release from GitHub"
release="$(curl -fsSL https://api.github.com/repos/kubestellar/kubeflex/releases/latest \
Expand All @@ -82,11 +79,22 @@ else

echo "Resolved latest release to ${release}"
fi

echo "Installing kubeflex release ${release}"
helm install kubeflex \
oci://ghcr.io/kubestellar/kubeflex/chart/kubeflex-operator \
--version "${release}"

bash <(curl -s https://raw.githubusercontent.com/kubestellar/kubeflex/refs/tags/${release}/scripts/install-kubeflex.sh) --version $release --ensure-folder bin --strip-bin -X

if [ "$( { echo v0.9.2; echo "$release"; } | sort -V | head -1)" == v0.9.2 ]; then
helm install kubeflex-operator \
oci://ghcr.io/kubestellar/kubeflex/chart/kubeflex-operator \
--version "${release}"
else
kubectl create namespace kubeflex-system --dry-run=client -o yaml | kubectl apply -f -
helm install kubeflex-operator \
oci://ghcr.io/kubestellar/kubeflex/chart/kubeflex-operator \
--namespace kubeflex-system \
--version "${release}"
fi

fi
:
: -------------------------------------------------------------------------
Expand Down Expand Up @@ -144,4 +152,4 @@ EOF
: Wait for kubeflex-controller-manager ready
:

kubectl wait --for=condition=available --timeout=300s -n kubeflex-system deployment/kubeflex-controller-manager
kubectl wait --for=condition=available --timeout=300s -n kubeflex-system deployment/kubeflex-controller-manager