Skip to content

Commit

Permalink
TEMP
Browse files Browse the repository at this point in the history
  • Loading branch information
lentzi90 committed Sep 20, 2023
1 parent 9e3c194 commit bddcc24
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ unit-verbose: ## Run unit tests with verbose output
ARTIFACTS ?= ${ROOT_DIR}/test/e2e/_artifacts

.PHONY: test-e2e
test-e2e: $(GINKGO) tools/bin/cmctl ## Run the end-to-end tests
test-e2e: $(GINKGO) ## Run the end-to-end tests
$(GINKGO) -v --trace -poll-progress-after=$(GINKGO_POLL_PROGRESS_AFTER) \
-poll-progress-interval=$(GINKGO_POLL_PROGRESS_INTERVAL) --tags=e2e --focus="$(GINKGO_FOCUS)" \
$(_SKIP_ARGS) --nodes=$(GINKGO_NODES) --timeout=$(GINKGO_TIMEOUT) --no-color=$(GINKGO_NOCOLOR) \
Expand Down
14 changes: 6 additions & 8 deletions hack/ci-e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,23 @@ cd "${REPO_ROOT}" || exit 1

# Ensure requirements are installed
"${REPO_ROOT}/hack/e2e/ensure_go.sh"
export PATH=$PATH:/usr/local/go/bin
"${REPO_ROOT}/hack/e2e/ensure_minikube.sh"
"${REPO_ROOT}/hack/e2e/ensure_kubectl.sh"
"${REPO_ROOT}/hack/e2e/ensure_cmctl.sh"
# TODO: This should ideally be already in place.
# sudo apt-get install build-essential qemu-kvm libvirt-daemon-system virt-manager dnsmasq -y
# sudo adduser $USER libvirt

# Build the container image with e2e tag (used in tests)
IMG=quay.io/metal3-io/baremetal-operator:e2e make docker

# Set up minikube
minikube start --driver=kvm2

virsh net-destroy baremetal-e2e
virsh net-define ${REPO_ROOT}/hack/e2e/net.xml
virsh net-start baremetal-e2e
virsh -c qemu:///system net-destroy baremetal-e2e
virsh -c qemu:///system net-define ${REPO_ROOT}/hack/e2e/net.xml
virsh -c qemu:///system net-start baremetal-e2e
# Attach baremetal-e2e interface to minikube with specific mac.
# This will give minikube a known reserved IP address that we can use for Ironic
virsh attach-interface --domain minikube --mac="52:54:00:6c:3c:01" \
virsh -c qemu:///system attach-interface --domain minikube --mac="52:54:00:6c:3c:01" \
--model virtio --source baremetal-e2e --type network --config

# Restart minikube to apply the changes
Expand All @@ -47,7 +45,7 @@ docker run --name vbmc --network host -d \
NAME="bmo-e2e-0"
BOOT_MAC_ADDRESS="00:60:2f:31:81:01"
VBMC_PORT="16230"
virt-install -n "${NAME}" --description "Virtualized BareMetalHost" --osinfo=ubuntu-lts-latest \
virt-install --connect qemu:///system -n "${NAME}" --description "Virtualized BareMetalHost" --osinfo=ubuntu-lts-latest \
--ram=4096 --vcpus=2 --disk size=20 --graphics=none --console pty --serial pty --pxe \
--network network=baremetal-e2e,mac="${BOOT_MAC_ADDRESS}" --noautoconsole

Expand Down
5 changes: 3 additions & 2 deletions hack/e2e/ensure_cmctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -o errexit
set -o nounset
set -o pipefail

GOPATH_BIN="$(go env GOPATH)/bin/"
# GOPATH_BIN="$(go env GOPATH)/bin/"
GOPATH_BIN="/usr/local/bin/"
OS=$(go env GOOS)
ARCH=$(go env GOARCH)
MINIMUM_CMCTL_VERSION=v1.13.0
Expand All @@ -18,7 +19,7 @@ verify_cmctl_version() {
echo 'cmctl not found, installing'
curl -fsSL -o cmctl.tar.gz https://github.com/cert-manager/cert-manager/releases/download/${MINIMUM_CMCTL_VERSION}/cmctl-${OS}-${ARCH}.tar.gz
tar xzf cmctl.tar.gz
mv cmctl "${GOPATH_BIN}/cmctl"
sudo mv cmctl "${GOPATH_BIN}/cmctl"
rm cmctl.tar.gz
else
echo "Missing required binary in path: cmctl"
Expand Down
9 changes: 6 additions & 3 deletions hack/e2e/ensure_kubectl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ set -o errexit
set -o nounset
set -o pipefail

GOPATH_BIN="$(go env GOPATH)/bin/"
# GOPATH_BIN="$(go env GOPATH)/bin/"
GOPATH_BIN="/usr/local/bin/"
MINIMUM_KUBECTL_VERSION=v1.28.1

# Ensure the kubectl tool exists and is a viable version, or installs it
Expand All @@ -31,8 +32,8 @@ verify_kubectl_version()
mkdir -p "${GOPATH_BIN}"
fi
echo 'kubectl not found, installing'
curl -sLo "${GOPATH_BIN}/kubectl" https://storage.googleapis.com/kubernetes-release/release/${MINIMUM_KUBECTL_VERSION}/bin/linux/amd64/kubectl
chmod +x "${GOPATH_BIN}/kubectl"
curl -LO "https://dl.k8s.io/release/${MINIMUM_KUBECTL_VERSION}/bin/linux/amd64/kubectl"
sudo install kubectl "${GOPATH_BIN}/kubectl"
else
echo "Missing required binary in path: kubectl"
return 2
Expand All @@ -50,3 +51,5 @@ EOF
return 2
fi
}

verify_kubectl_version
5 changes: 3 additions & 2 deletions hack/e2e/ensure_minikube.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -o errexit
set -o nounset
set -o pipefail

GOPATH_BIN="$(go env GOPATH)/bin/"
# GOPATH_BIN="$(go env GOPATH)/bin/"
GOPATH_BIN="/usr/local/bin/"
OS=$(go env GOOS)
ARCH=$(go env GOARCH)
MINIMUM_MINIKUBE_VERSION=v1.31.2
Expand All @@ -17,7 +18,7 @@ verify_minikube_version() {
fi
echo 'minikube not found, installing'
curl -LO "https://storage.googleapis.com/minikube/releases/${MINIMUM_MINIKUBE_VERSION}/minikube-${OS}-${ARCH}"
install minikube-linux-amd64 "${GOPATH_BIN}/minikube"
sudo install minikube-linux-amd64 "${GOPATH_BIN}/minikube"
else
echo "Missing required binary in path: minikube"
return 2
Expand Down

0 comments on commit bddcc24

Please sign in to comment.