1
0
mirror of https://github.com/kubernetes-sigs/descheduler.git synced 2026-01-26 05:14:13 +01:00

Merge pull request #340 from damemi/update-e2e

Update e2e script to use Kind setup
This commit is contained in:
Kubernetes Prow Robot
2020-07-13 19:57:20 -07:00
committed by GitHub
2 changed files with 20 additions and 2 deletions

View File

@@ -19,6 +19,7 @@ package e2e
import (
"context"
"math"
"os"
"testing"
"time"
@@ -144,10 +145,11 @@ func TestE2E(t *testing.T) {
// If we have reached here, it means cluster would have been already setup and the kubeconfig file should
// be in /tmp directory as admin.conf.
ctx := context.Background()
clientSet, err := client.CreateClient("/tmp/admin.conf")
clientSet, err := client.CreateClient(os.Getenv("KUBECONFIG"))
if err != nil {
t.Errorf("Error during client creation with %v", err)
}
nodeList, err := clientSet.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
if err != nil {
t.Errorf("Error listing node with %v", err)
@@ -194,7 +196,7 @@ func TestE2E(t *testing.T) {
func TestDeschedulingInterval(t *testing.T) {
ctx := context.Background()
clientSet, err := client.CreateClient("/tmp/admin.conf")
clientSet, err := client.CreateClient(os.Getenv("KUBECONFIG"))
if err != nil {
t.Errorf("Error during client creation with %v", err)
}

View File

@@ -15,5 +15,21 @@
#!/bin/bash
# This just run e2e tests.
if [ -n "$KIND_E2E" ]; then
curl -Lo kubectl https://storage.googleapis.com/kubernetes-release/release/v1.18.2/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/
wget https://github.com/kubernetes-sigs/kind/releases/download/v0.8.1/kind-linux-amd64
chmod +x kind-linux-amd64
mv kind-linux-amd64 kind
export PATH=$PATH:$PWD
kind create cluster --image kindest/node:v1.18.2 --config=./hack/kind_config.yaml
export KUBECONFIG="$(kind get kubeconfig-path)"
docker pull kubernetes/pause
kind load docker-image kubernetes/pause
kind get kubeconfig > /tmp/admin.conf
export KUBECONFIG="/tmp/admin.conf"
mkdir -p ~/gopath/src/sigs.k8s.io/
mv ~/gopath/src/github.com/kubernetes-sigs/descheduler ~/gopath/src/sigs.k8s.io/.
fi
PRJ_PREFIX="sigs.k8s.io/descheduler"
go test ${PRJ_PREFIX}/test/e2e/ -v