Skip to content

Commit

Permalink
Merge pull request #605 from Iceber/fix_e2e_0.7
Browse files Browse the repository at this point in the history
[release/0.7] bump kwokctl
  • Loading branch information
Iceber authored Nov 27, 2023
2 parents b88e267 + e8c31f1 commit f54e70a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 30 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,10 @@ jobs:
fetch-depth: 0
- name: Run e2e test
run: ./test/test.sh

- name: Upload logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: e2e-logs-${{ github.run_id }}
path: ${{ github.workspace }}/test/logs-*
1 change: 1 addition & 0 deletions test/environments/default.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ create_data_plane data-v1-23 v1.23.4 || {
echo "Failed to create data plane"
exit 1
}

"${ROOT}/hack/gen-clusterconfigs.sh"

"${cases}"
16 changes: 9 additions & 7 deletions test/environments/multiple.env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,18 @@ cases="${1}"
source "$(dirname "${BASH_SOURCE[0]}")/../helper.sh"

releases=(
v1.23.5
v1.22.8
v1.21.11
v1.28.2
v1.27.6
v1.26.9
v1.25.14
v1.24.15
v1.23.17
v1.22.17
v1.21.14
v1.20.15
v1.19.16
v1.18.20
v1.17.17
v1.16.15
v1.15.12
v1.14.10
v1.13.12
v1.12.10
v1.11.10
v1.10.13
Expand All @@ -46,6 +47,7 @@ for release in "${releases[@]}"; do
exit 1
}
done

"${ROOT}/hack/gen-clusterconfigs.sh"

"${cases}"
37 changes: 14 additions & 23 deletions test/helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function create_cluster() {
# delete the kind cluster
function delete_cluster() {
local name="${1:-kind}"
kind export logs --name "${name}" "${ROOT}/test/logs/kind/${name}"
kind delete cluster --name "${name}"
}

Expand Down Expand Up @@ -127,7 +128,7 @@ function install_kwokctl() {
if cmd_exist kwokctl; then
return 0
fi
wget "https://github.com/kubernetes-sigs/kwok/releases/download/v0.1.0/kwokctl-$(go env GOOS)-$(go env GOARCH)" -O "/usr/local/bin/kwokctl" &&
wget "https://github.com/kubernetes-sigs/kwok/releases/download/v0.4.0/kwokctl-$(go env GOOS)-$(go env GOARCH)" -O "/usr/local/bin/kwokctl" &&
chmod +x "/usr/local/bin/kwokctl"
}

Expand All @@ -150,44 +151,34 @@ function create_data_plane() {
local name="${1}"
local version="${2:-v1.19.16}"
local kubeconfig
local pedia_cluster
local ip

install_kwokctl

KWOK_KUBE_VERSION="${version}" kwokctl create cluster --name "${name}" --quiet-pull
ip="$(host_docker_internal)"
kwokctl create cluster --name "${name}" --wait 120s --kubeconfig "" --config - <<EOF
kind: KwokctlConfiguration
apiVersion: config.kwok.x-k8s.io/v1alpha1
options:
quietPull: true
kubeVersion: ${version}
kubeApiserverCertSANs:
- ${ip}
EOF
kubeconfig="$(kwokctl get kubeconfig --name="${name}" | sed "s#/127.0.0.1:#/${ip}:#" || :)"
if [[ "${kubeconfig}" == "" ]]; then
echo "kubeconfig is empty"
return 1
fi
kwokctl --name="${name}" kubectl apply -f - <<EOF
apiVersion: v1
kind: Node
metadata:
annotations:
kwok.x-k8s.io/node: fake
node.alpha.kubernetes.io/ttl: "0"
labels:
beta.kubernetes.io/arch: amd64
beta.kubernetes.io/os: linux
kubernetes.io/arch: amd64
kubernetes.io/hostname: fake-node
kubernetes.io/os: linux
kubernetes.io/role: agent
node-role.kubernetes.io/agent: ""
type: kwok-controller
name: fake-node
EOF
pedia_cluster="$(build_pedia_cluster "${name}" "${kubeconfig}")"
echo "${pedia_cluster}" | kubectl apply -f -
kwokctl scale node --name="${name}" --replicas 1
build_pedia_cluster "${name}" "${kubeconfig}" | kubectl apply -f -
}

# delete the worker fake cluster
function delete_data_plane() {
local name="${1}"

kubectl delete PediaCluster "${name}"
kwokctl export logs --name "${name}" "${ROOT}/test/logs/kwok/${name}"
kwokctl delete cluster --name "${name}"
}
4 changes: 4 additions & 0 deletions test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ function main() {
echo "::group::Running test ${name} on ${env_name}"
if ! "${env}" "${file}"; then
failed+=("'${name} on ${env_name}'")
mv "${TEST_ROOT}/logs" "${TEST_ROOT}/logs-${name}-${env_name}"
else
# Clean up logs
rm -rf "${TEST_ROOT}/logs"
fi
echo "::endgroup::"
done
Expand Down

0 comments on commit f54e70a

Please sign in to comment.