From 08bf9b1cb4734ae96fe63d55a14a12644a3b816b Mon Sep 17 00:00:00 2001 From: Steffen Vogel Date: Fri, 16 Jul 2021 12:37:41 +0200 Subject: [PATCH] e2e: add tests for HTTP handlers --- Makefile | 2 +- e2e/handlers.sh | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 e2e/handlers.sh diff --git a/Makefile b/Makefile index f7d02f2..9ec640a 100644 --- a/Makefile +++ b/Makefile @@ -209,7 +209,7 @@ $(BASH_UNIT): chmod +x $@ e2e: container $(KIND_BINARY) $(KUBECTL_BINARY) $(BASH_UNIT) bin/$(OS)/$(ARCH)/kgctl - KILO_IMAGE=$(IMAGE):$(ARCH)-$(VERSION) KIND_BINARY=$(KIND_BINARY) KUBECTL_BINARY=$(KUBECTL_BINARY) KGCTL_BINARY=$(shell pwd)/bin/$(OS)/$(ARCH)/kgctl $(BASH_UNIT) $(BASH_UNIT_FLAGS) ./e2e/setup.sh ./e2e/full-mesh.sh ./e2e/location-mesh.sh ./e2e/multi-cluster.sh ./e2e/teardown.sh + KILO_IMAGE=$(IMAGE):$(ARCH)-$(VERSION) KIND_BINARY=$(KIND_BINARY) KUBECTL_BINARY=$(KUBECTL_BINARY) KGCTL_BINARY=$(shell pwd)/bin/$(OS)/$(ARCH)/kgctl $(BASH_UNIT) $(BASH_UNIT_FLAGS) ./e2e/setup.sh ./e2e/full-mesh.sh ./e2e/location-mesh.sh ./e2e/multi-cluster.sh ./e2e/handlers.sh ./e2e/teardown.sh header: .header @HEADER=$$(cat .header); \ diff --git a/e2e/handlers.sh b/e2e/handlers.sh new file mode 100644 index 0000000..0252558 --- /dev/null +++ b/e2e/handlers.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +# shellcheck disable=SC1091 +. lib.sh + +setup_suite() { + # shellcheck disable=SC2016 + _kubectl patch ds -n kube-system kilo -p '{"spec": {"template":{"spec":{"containers":[{"name":"kilo","args":["--hostname=$(NODE_NAME)","--create-interface=false","--kubeconfig=/etc/kubernetes/kubeconfig","--mesh-granularity=full"]}]}}}}' + 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() { + assert "curl_pod http://10.4.0.1:1107/graph?format=svg&layout=circo | grep -q '