Skip to content

Commit

Permalink
Merge pull request #269 from arangodb/bug-fix/skip-lb-test-if-unavail
Browse files Browse the repository at this point in the history
Skip LoadBalancer Test
  • Loading branch information
neunhoef committed Oct 23, 2018
2 parents 11a0274 + b1c9d70 commit 8be2b30
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,20 @@ GOVERSION := 1.10.0-alpine
PULSAR := $(GOBUILDDIR)/bin/pulsar$(shell go env GOEXE)
GOASSETSBUILDER := $(GOBUILDDIR)/bin/go-assets-builder$(shell go env GOEXE)

DOCKERFILE := Dockerfile
DOCKERFILE := Dockerfile
DOCKERTESTFILE := Dockerfile.test
DOCKERDURATIONTESTFILE := tests/duration/Dockerfile

ifndef LOCALONLY
ifndef LOCALONLY
PUSHIMAGES := 1
IMAGESHA256 := true
else
IMAGESHA256 := false
endif

ifdef IMAGETAG
ifdef IMAGETAG
IMAGESUFFIX := :$(IMAGETAG)
else
else
IMAGESUFFIX := :dev
endif

Expand Down Expand Up @@ -84,8 +84,8 @@ TESTBINNAME := $(PROJECT)_test
TESTBIN := $(BINDIR)/$(TESTBINNAME)
DURATIONTESTBINNAME := $(PROJECT)_duration_test
DURATIONTESTBIN := $(BINDIR)/$(DURATIONTESTBINNAME)
RELEASE := $(GOBUILDDIR)/bin/release
GHRELEASE := $(GOBUILDDIR)/bin/github-release
RELEASE := $(GOBUILDDIR)/bin/release
GHRELEASE := $(GOBUILDDIR)/bin/github-release

TESTLENGTHOPTIONS := -test.short
TESTTIMEOUT := 20m
Expand All @@ -94,7 +94,7 @@ ifeq ($(LONG), 1)
TESTTIMEOUT := 180m
endif
ifdef VERBOSE
TESTVERBOSEOPTIONS := -v
TESTVERBOSEOPTIONS := -v
endif

SOURCES := $(shell find $(SRCDIR) -name '*.go' -not -path './test/*')
Expand Down Expand Up @@ -176,7 +176,7 @@ update-vendor:
# Manually restore arangosync vendor with: git checkout deps/github.com/arangodb/arangosync

.PHONY: update-generated
update-generated: $(GOBUILDDIR)
update-generated: $(GOBUILDDIR)
@docker build $(SRCDIR)/tools/codegen --build-arg GOVERSION=$(GOVERSION) -t k8s-codegen
docker run \
--rm \
Expand Down Expand Up @@ -232,7 +232,7 @@ ifdef PUSHIMAGES
docker push $(OPERATORIMAGE)
endif

# Manifests
# Manifests

.PHONY: manifests
manifests: $(GOBUILDDIR)
Expand Down Expand Up @@ -268,7 +268,7 @@ run-unit-tests: $(GOBUILDDIR) $(SOURCES)
$(REPOPATH)/pkg/util/k8sutil \
$(REPOPATH)/pkg/util/k8sutil/test \
$(REPOPATH)/pkg/util/probe \
$(REPOPATH)/pkg/util/validation
$(REPOPATH)/pkg/util/validation

$(TESTBIN): $(GOBUILDDIR) $(SOURCES)
@mkdir -p $(BINDIR)
Expand Down Expand Up @@ -376,20 +376,20 @@ $(RELEASE): $(GOBUILDDIR) $(SOURCES) $(GHRELEASE)
.PHONY: build-ghrelease
build-ghrelease: $(GHRELEASE)

$(GHRELEASE): $(GOBUILDDIR)
$(GHRELEASE): $(GOBUILDDIR)
GOPATH=$(GOBUILDDIR) go build -o $(GHRELEASE) github.com/aktau/github-release

.PHONY: release-patch
release-patch: $(RELEASE)
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=patch
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=patch

.PHONY: release-minor
release-minor: $(RELEASE)
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=minor

.PHONY: release-major
release-major: $(RELEASE)
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=major
GOPATH=$(GOBUILDDIR) $(RELEASE) -type=major

## Kubernetes utilities

Expand All @@ -410,4 +410,4 @@ redeploy-operator: delete-operator manifests
kubectl apply -f $(MANIFESTPATHDEPLOYMENT)
kubectl apply -f $(MANIFESTPATHDEPLOYMENTREPLICATION)
kubectl apply -f $(MANIFESTPATHTEST)
kubectl get pods
kubectl get pods
3 changes: 3 additions & 0 deletions tests/load_balancer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ func loadBalancingCursorSubtest(t *testing.T, useVst bool) {
t.Fatalf("Deployment not running in time: %v", err)
}

// check if the deployment got a load balancer, otherwise skip this test
isEaLoadBalancerOrSkip(depl.GetName(), t)

// Create a database client
ctx := context.Background()
clOpts := &DatabaseClientOptions{
Expand Down
15 changes: 15 additions & 0 deletions tests/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,21 @@ func getEnterpriseImageOrSkip(t *testing.T) string {
return image
}

// isEaLoadBalancerOrSkip checks it the deployment
func isEaLoadBalancerOrSkip(deploymentName string, t *testing.T) {
kubecli := mustNewKubeClient(t)
ns := getNamespace(t)
eaServiceName := k8sutil.CreateDatabaseExternalAccessServiceName(deploymentName)
svcs := k8sutil.NewServiceCache(kubecli.CoreV1().Services(ns))
if existing, err := svcs.Get(eaServiceName, metav1.GetOptions{}); err == nil {
if existing.Spec.Type == v1.ServiceTypeLoadBalancer {
return
}
}

t.Skip("No load balancer deployed")
}

// shouldCleanDeployments returns true when deployments created
// by tests should be removed, even when the test fails.
func shouldCleanDeployments() bool {
Expand Down

0 comments on commit 8be2b30

Please sign in to comment.