Skip to content

Commit

Permalink
E2E: metrics-agent tests
Browse files Browse the repository at this point in the history
  • Loading branch information
cheina97 committed Nov 9, 2023
1 parent 54b8477 commit 6852bdc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/e2e/pipeline/infra/cluster-api/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ do
# install local-path storage class
"${KUBECTL}" apply -f https://raw.githubusercontent.com/rancher/local-path-provisioner/v0.0.24/deploy/local-path-storage.yaml --kubeconfig "${TMPDIR}/kubeconfigs/liqo_kubeconf_${i}"
"${KUBECTL}" annotate storageclass local-path storageclass.kubernetes.io/is-default-class=true --kubeconfig "${TMPDIR}/kubeconfigs/liqo_kubeconf_${i}"

# Install metrics-server
"${KUBECTL}" apply -f https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.6.4/components.yaml
"${KUBECTL}" -n kube-system patch deployment metrics-server --type json --patch '[{"op":"add","path":"/spec/template/spec/containers/0/args/-","value":"--kubelet-insecure-tls"}]'
done

for i in $(seq 1 "${CLUSTER_NUMBER}");
Expand Down
25 changes: 25 additions & 0 deletions test/e2e/pipeline/metrics/metrics.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash

# This scripts expects the following variables to be set:
# CLUSTER_NUMBER -> the number of liqo clusters
# NAMESPACE -> the namespace where liqo is running
# LIQO_VERSION -> the liqo version to test
# K8S_VERSION -> the Kubernetes version
# TMPDIR -> the directory where kubeconfigs are stored

set -e # Fail in case of error
set -o nounset # Fail if undefined variables are used
set -o pipefail # Fail if one of the piped commands fails

error() {
local sourcefile=$1
local lineno=$2
echo "An error occurred at $sourcefile:$lineno."
}
trap 'error "${BASH_SOURCE}" "${LINENO}"' ERR

for i in $(seq 1 "${CLUSTER_NUMBER}")
do
export KUBECONFIG="${TMPDIR}/kubeconfigs/liqo_kubeconf_${i}"
kubectl top node "liqo-${i}"
done

0 comments on commit 6852bdc

Please sign in to comment.