File tree Expand file tree Collapse file tree 7 files changed +55
-9
lines changed
Expand file tree Collapse file tree 7 files changed +55
-9
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,15 @@ unit-verbose: ## Run unit tests with verbose output
120120
121121ARTIFACTS ?= ${ROOT_DIR}/test/e2e/_artifacts
122122
123+ # # Checking that required tools exist and running e2e script on a VM
124+ # #
125+ # # To note: Run this on your VM and not your local machine. These installations
126+ # # work for linux amd64, at least on Ubuntu 24.04. You may need to log out and
127+ # # log in to apply all changes if the installations are done for the first time.
128+ .PHONY : run-e2e-script
129+ run-e2e-script :
130+ ./hack/ci-e2e.sh
131+
123132.PHONY : test-e2e
124133test-e2e : $(GINKGO ) # # Run the end-to-end tests
125134 $(GINKGO ) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER ) \
Original file line number Diff line number Diff line change @@ -45,16 +45,20 @@ export E2E_BMCS_CONF_FILE="${REPO_ROOT}/test/e2e/config/bmcs-${BMC_PROTOCOL}.yam
4545 ;;
4646esac
4747
48+ sudo apt-get install -y build-essential tar
49+
4850# Ensure requirements are installed
4951export PATH=" /usr/local/go/bin:${PATH} "
5052" ${REPO_ROOT} /hack/e2e/ensure_go.sh"
5153" ${REPO_ROOT} /hack/e2e/ensure_htpasswd.sh"
5254# CAPI test framework uses kubectl in the background
5355" ${REPO_ROOT} /hack/e2e/ensure_kubectl.sh"
5456" ${REPO_ROOT} /hack/e2e/ensure_yq.sh"
57+ " ${REPO_ROOT} /hack/e2e/ensure_docker.sh"
5558
5659sudo apt-get update
57- sudo apt-get install -y libvirt-dev pkg-config
60+ sudo apt-get install -y libvirt-daemon-system qemu-kvm virt-manager libvirt-dev
61+ make build
5862
5963# Build the container image with e2e tag (used in tests)
6064IMG=quay.io/metal3-io/baremetal-operator:e2e make docker
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env bash
2+
3+ set -eux
4+
5+ # Check if docker is installed and install it if not.
6+ # The `newgrp` will stop a non-interactive script run.
7+ verify_docker ()
8+ {
9+ if ! [ -x " $( command -v docker) " ]; then
10+ if [[ " ${OSTYPE} " == " linux-gnu" ]]; then
11+ echo " docker not found, installing"
12+ sudo apt-get install ca-certificates
13+ sudo install -m 0755 -d /etc/apt/keyrings
14+ sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
15+ sudo chmod a+r /etc/apt/keyrings/docker.asc
16+ echo \
17+ " deb [arch=$( dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
18+ $( . /etc/os-release && echo " ${UBUNTU_CODENAME:- $VERSION_CODENAME } " ) stable" | \
19+ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
20+ sudo apt-get update
21+ sudo apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
22+ sudo usermod -aG docker " ${USER} "
23+ newgrp docker
24+ else
25+ echo " Missing required binary in path: docker"
26+ return 2
27+ fi
28+ fi
29+ }
30+
31+ verify_docker
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ verify_go_version()
1313 echo ' go not found, installing'
1414 curl -sLo " /tmp/${MINIMUM_GO_VERSION} .linux-amd64.tar.gz" " https://go.dev/dl/${MINIMUM_GO_VERSION} .linux-amd64.tar.gz"
1515 sudo tar -C /usr/local -xzf " /tmp/${MINIMUM_GO_VERSION} .linux-amd64.tar.gz"
16- export PATH=/usr/local/go/bin: $PATH
16+ export PATH=" ${PATH} : /usr/local/go/bin"
1717 else
1818 echo " Missing required binary in path: go"
1919 return 2
Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ verify_kubectl_version()
2626 if ! [ -x " $( command -v kubectl) " ]; then
2727 if [[ " ${OSTYPE} " == " linux-gnu" ]]; then
2828 echo " kubectl not found, installing"
29- curl -LO " https://dl.k8s.io/release/${MINIMUM_KUBECTL_VERSION} /bin/linux/amd64/kubectl"
30- sudo install kubectl " ${USR_LOCAL_BIN} /kubectl"
29+ curl --create-dirs -LO --output-dir " ${HOME} " " https://dl.k8s.io/release/${MINIMUM_KUBECTL_VERSION} /bin/linux/amd64/kubectl"
30+ sudo install " ${HOME} / kubectl" " ${USR_LOCAL_BIN} /kubectl"
3131 else
3232 echo " Missing required binary in path: kubectl"
3333 return 2
Original file line number Diff line number Diff line change @@ -11,9 +11,9 @@ verify_yq()
1111 if ! [[ -x " $( command -v yq) " ]]; then
1212 if [[ " ${OSTYPE} " == " linux-gnu" ]]; then
1313 echo " yq not found, installing"
14- curl -LO " https://github.com/mikefarah/yq/releases/download/${YQ_VERSION} /yq_linux_amd64.tar.gz"
15- tar xvf yq_linux_amd64.tar.gz
16- sudo install yq_linux_amd64 " ${USR_LOCAL_BIN} /yq"
14+ curl --create-dirs -LO --output-dir " ${HOME} " " https://github.com/mikefarah/yq/releases/download/${YQ_VERSION} /yq_linux_amd64.tar.gz"
15+ sudo tar - xvf " ${HOME} / yq_linux_amd64.tar.gz" -C " ${HOME} "
16+ sudo install " ${HOME} / yq_linux_amd64" " ${USR_LOCAL_BIN} /yq"
1717 else
1818 echo " Missing required binary in path: yq"
1919 return 2
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ as BMC. Ironic runs in the "host network" of the kind cluster in the test. The
1515kind cluster is then configured to expose the relevant ports on the actual host
1616so that they can be reached from the BareMetalHost VMs.
1717
18+ There is a Makefile target for running this e2e script called ` run-e2e-script ` .
19+
1820Currently there are two sets of tests, which cannot be ran together in the same
1921cluster. One is the "optional" set, currently consists of only the
2022[ upgrade tests] ( upgrade_test.go ) , and the "main" set, which are the ones
@@ -25,14 +27,14 @@ setting, the script sets `GINKGO_SKIP` to `upgrade`.
2527E.g. Here is how to run the E2E main tests:
2628
2729``` bash
28- ./hack/ci -e2e.sh
30+ make run -e2e-script
2931```
3032
3133And here is how to run the E2E optional tests:
3234
3335``` bash
3436export GINKGO_FOCUS=" upgrade"
35- ./hack/ci -e2e.sh
37+ make run -e2e-script
3638```
3739
3840` GINKGO_FOCUS ` can be set manually to run specific tests. The options for these
You can’t perform that action at this time.
0 commit comments