From d6c5f6b99598c8e59795d2ceb6c19c8cdc8d73c7 Mon Sep 17 00:00:00 2001 From: Darren Shepherd Date: Mon, 25 Feb 2019 17:21:48 -0700 Subject: [PATCH] Add e2e tests --- e2e/Dockerfile | 6 ++++++ e2e/docker-compose.yml | 31 +++++++++++++++++++++++++++++++ e2e/run-test.sh | 16 ++++++++++++++++ 3 files changed, 53 insertions(+) create mode 100644 e2e/Dockerfile create mode 100644 e2e/docker-compose.yml create mode 100755 e2e/run-test.sh diff --git a/e2e/Dockerfile b/e2e/Dockerfile new file mode 100644 index 0000000000..82a599620c --- /dev/null +++ b/e2e/Dockerfile @@ -0,0 +1,6 @@ +FROM ubuntu:18.04 +RUN apt-get update && \ + apt-get install -y curl +RUN curl -sfL https://github.com/heptio/sonobuoy/releases/download/v0.13.0/sonobuoy_0.13.0_linux_amd64.tar.gz | tar xvzf - -C /usr/bin +COPY run-test.sh /usr/bin +CMD ["/usr/bin/run-test.sh"] diff --git a/e2e/docker-compose.yml b/e2e/docker-compose.yml new file mode 100644 index 0000000000..74ea3500f7 --- /dev/null +++ b/e2e/docker-compose.yml @@ -0,0 +1,31 @@ +version: '3' +services: + server: + image: rancher/k3s:v0.1.0-rc8 + command: server + environment: + - K3S_CLUSTER_SECRET=somethingtotallyrandom + volumes: + - config:/etc/rancher/k3s + tmpfs: + - /run + - /var/run + privileged: true + + node: + image: rancher/k3s:v0.1.0-rc8 + tmpfs: + - /run + - /var/run + privileged: true + environment: + - K3S_URL=https://server:6443 + - K3S_CLUSTER_SECRET=somethingtotallyrandom + + sonobuoy: + build: . + volumes: + - config:/etc/rancher/k3s + +volumes: + config: {} diff --git a/e2e/run-test.sh b/e2e/run-test.sh new file mode 100755 index 0000000000..c18624abac --- /dev/null +++ b/e2e/run-test.sh @@ -0,0 +1,16 @@ +#!/bin/bash +set -e -x + +while [ ! -e /etc/rancher/k3s/k3s.yaml ]; do + echo waiting for config + sleep 1 +done + +mkdir -p /root/.kube +sed 's/localhost/server/g' /etc/rancher/k3s/k3s.yaml > /root/.kube/config +export KUBECONFIG=/root/.kube/config +cat /etc/rancher/k3s/k3s.yaml +cat $KUBECONFIG +sonobuoy run +sleep 15 +sonobuoy logs -f