Skip to content
Open
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
2 changes: 0 additions & 2 deletions e2e/handlers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
. lib.sh

setup_suite() {
# shellcheck disable=SC2016
block_until_ready_by_name kube-system kilo-userspace
_kubectl wait pod -l app.kubernetes.io/name=adjacency --for=condition=Ready --timeout 3m
}

test_graph_handler() {
Expand Down
2 changes: 0 additions & 2 deletions e2e/kgctl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
. lib.sh

setup_suite() {
# shellcheck disable=SC2016
block_until_ready_by_name kube-system kilo-userspace
_kubectl wait pod -l app.kubernetes.io/name=adjacency --for=condition=Ready --timeout 3m
}

test_connect() {
Expand Down
26 changes: 17 additions & 9 deletions e2e/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ delete_peer() {
_kubectl delete peer "$1"
}

is_scheduled() {
for _ in $(_kubectl -n "$1" get pods -o name -l "$2" --field-selector=status.phase!=Running,status.phase!=Pending); do
return 1;
done
return 0
}

is_ready() {
for pod in $(_kubectl -n "$1" get pods -o name -l "$2"); do
if ! _kubectl -n "$1" get "$pod" | tail -n 1 | grep -q Running; then
return 1;
fi
for _ in $(_kubectl -n "$1" get pods -o name -l "$2" --field-selector=status.phase!=Running); do
return 1;
done
return 0
}
Expand Down Expand Up @@ -126,15 +131,18 @@ create_cluster() {
# Apply Kilo the the cluster.
_kubectl apply -f ../manifests/crds.yaml
_kubectl apply -f kilo-kind-userspace.yaml
if ! block_until_ready_by_name kube-system kilo-userspace; then return 1; fi
_kubectl wait nodes --all --for=condition=Ready
# Wait for CoreDNS.
block_until_ready kube_system k8s-app=kube-dns
block_until_ready_by_name kube-system kilo-userspace || return 1
_kubectl wait nodes --all --for=condition=Ready --timeout=30s || return 1
# Ensure the curl helper is not scheduled on a control-plane node.
# Apply the before the node is untainted.
_kubectl apply -f helper-curl.yaml
block_until_ready_by_name default curl || return 1
# Ensure the pod is scheduled before untainting.
retry 30 5 "some curl pods are not scheduled yet" is_scheduled default curl
_kubectl taint node $KIND_CLUSTER-control-plane node-role.kubernetes.io/control-plane:NoSchedule-
_kubectl apply -f https://raw.githubusercontent.com/kilo-io/adjacency/main/example.yaml
# Wait for workloads.
block_until_ready kube_system k8s-app=kube-dns || return 1
block_until_ready_by_name default curl || return 1
block_until_ready_by_name default adjacency
}

Expand Down
Loading