Skip to content

Commit

Permalink
removes consul,add make target test-e2e-minikube,fix framework canoni…
Browse files Browse the repository at this point in the history
…cal import
  • Loading branch information
Cyril TOVENA committed Aug 3, 2018
1 parent e4f921d commit d4b1cf5
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 25 deletions.
10 changes: 9 additions & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ controller_tag = $(REGISTRY)/agones-controller:$(VERSION)
sidecar_tag = $(REGISTRY)/agones-sdk:$(VERSION)

go_version_flags = -ldflags "-X agones.dev/agones/pkg.Version=$(VERSION)"
DOCKER_RUN ?= docker run --rm $(common_mounts) $(build_tag)
DOCKER_RUN ?= docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag)
# ___ ____ ___ _ _
# / _ \/ ___| |_ _|_ __ ___| |_ _ __| | ___
# | | | \___ \ | || '_ \ / __| | | | |/ _` |/ _ \
Expand Down Expand Up @@ -117,6 +117,7 @@ test-go:
$(agones_package)/sdks/...

# Runs end-to-end tests on the current configured cluster
# For minikube user the minikube-test-e2e targets
test-e2e:
$(DOCKER_RUN) go test -v $(agones_package)/test/e2e/... \
--kubeconfig /root/.kube/config \
Expand Down Expand Up @@ -313,6 +314,8 @@ clean-gcloud-test-cluster: $(ensure-build-image)
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) gcloud \
deployment-manager deployments delete $(GCP_CLUSTER_NAME)

# Creates a gcloud cluster for end-to-end
# it installs also a consul cluster to handle build system concurrency using a distributed lock
gcloud-e2e-test-cluster: $(ensure-build-image)
docker run --rm -it $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) gcloud \
deployment-manager deployments create e2e-test-cluster \
Expand All @@ -323,6 +326,7 @@ gcloud-e2e-test-cluster: $(ensure-build-image)
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) helm init --service-account helm --wait && \
helm install --wait --set Replicas=1,uiService.type=ClusterIP --name consul stable/consul

# Deletes the gcloud e2e cluster and cleanup any left pvc volumes
clean-gcloud-e2e-test-cluster: $(ensure-build-image)
docker run --rm $(common_mounts) $(DOCKER_RUN_ARGS) $(build_tag) \
helm delete --purge consul && kubectl delete pvc -l component=consul-consul
Expand Down Expand Up @@ -402,3 +406,7 @@ minikube-install: minikube-agones-profile
# Use TAG to specify the image to transfer into minikube
minikube-transfer-image:
docker save $(TAG) | ($(MINIKUBE_DOCKER_ENV) && docker load)

# Runs e2e tests against our minikube
minikube-test-e2e: DOCKER_RUN_ARGS=--network=host -v $(minikube_cert_mount)
minikube-test-e2e: minikube-agones-profile test-e2e
14 changes: 1 addition & 13 deletions build/build-image/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ ENV PATH /usr/local/go/bin:/go/bin:/opt/google-cloud-sdk/bin:$PATH

# RUN gcloud components update
RUN gcloud components update

# install kubectl without gcloud as we want the last version
ENV KUBECTL_VER 1.11.0
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/v${KUBECTL_VER}/bin/linux/amd64/kubectl && \
Expand Down Expand Up @@ -92,19 +93,6 @@ RUN wget -q https://static.rust-lang.org/rustup/archive/1.11.0/${RUST_ARCH}/rust
RUN cargo install protobuf-codegen --vers 2.0.2
RUN cargo install grpcio-compiler --vers 0.3.0

# set up Consul.
ENV CONSUL_VERSION=1.2.1
ENV HASHICORP_RELEASES=https://releases.hashicorp.com
RUN mkdir -p /tmp/build && \
wget ${HASHICORP_RELEASES}/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip \
-P /tmp/build/ && \
unzip -d /usr/local/bin/ /tmp/build/consul_${CONSUL_VERSION}_linux_amd64.zip && \
cd /tmp && \
rm -rf /tmp/build && \
chmod go+rx /usr/local/bin/consul && \
# tiny smoke test to ensure the binary we downloaded runs
consul version

# make sure we keep the path to go
RUN echo "export PATH=/usr/local/go/bin:/go/bin/:\$PATH" >> /root/.bashrc
# make nano the editor
Expand Down
2 changes: 1 addition & 1 deletion build/e2e-image/e2e.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2017 Google Inc. All Rights Reserved.
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/e2e-image/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash

# Copyright 2017 Google Inc. All Rights Reserved.
# Copyright 2018 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion build/gke-test-cluster/cluster-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2017 Google Inc. All rights reserved.
# Copyright 2018 Google Inc. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Prerequisites:
- Have kubeconfig file ready.

e2e tests are written as Go test. All go test techniques apply, e.g. picking
what to run, timeout length. Let's say I want to run all tests in "test/e2e/":
what to run, timeout length.

```
$ go test -v ./test/e2e/ --kubeconfig "$HOME/.kube/config" --gameserver-image=gcr.io/agones-images/cpp-simple-server:0.2
make e2e
```
2 changes: 1 addition & 1 deletion test/e2e/framework/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (f *Framework) WaitForGameServerState(gs *v1alpha1.GameServer, state v1alph
var pollErr error
var readyGs *v1alpha1.GameServer

err := wait.Poll(2*time.Second, timeout, func() (bool, error) {
err := wait.PollImmediate(2*time.Second, timeout, func() (bool, error) {
readyGs, pollErr = f.AgonesClient.StableV1alpha1().GameServers(gs.Namespace).Get(gs.Name, v1.GetOptions{})

if pollErr != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/gameserver_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"testing"

"agones.dev/agones/pkg/apis/stable/v1alpha1"
agonesFramework "agones.dev/agones/test/e2e/framework"
e2eframework "agones.dev/agones/test/e2e/framework"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -58,7 +58,7 @@ func TestCreateConnect(t *testing.T) {
assert.NotEmpty(t, readyGs.Status.NodeName)
assert.Equal(t, readyGs.Status.State, v1alpha1.Ready)

reply, err := agonesFramework.PingGameServer("Hello World !", fmt.Sprintf("%s:%d", readyGs.Status.Address,
reply, err := e2eframework.PingGameServer("Hello World !", fmt.Sprintf("%s:%d", readyGs.Status.Address,
readyGs.Status.Ports[0].Port))

if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"path/filepath"
"testing"

agonesFramework "agones.dev/agones/test/e2e/framework"
e2eframework "agones.dev/agones/test/e2e/framework"
)

var framework *agonesFramework.Framework
var framework *e2eframework.Framework

func TestMain(m *testing.M) {
usr, _ := user.Current()
Expand All @@ -41,7 +41,7 @@ func TestMain(m *testing.M) {
exitCode int
)

if framework, err = agonesFramework.New(*kubeconfig, *gsimage); err != nil {
if framework, err = e2eframework.New(*kubeconfig, *gsimage); err != nil {
log.Printf("failed to setup framework: %v\n", err)
os.Exit(1)
}
Expand Down

0 comments on commit d4b1cf5

Please sign in to comment.