Skip to content

Commit

Permalink
test(blackbox): Add stress and pull/push tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanilves committed May 21, 2018
1 parent 8d11923 commit 294649a
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,12 @@ before_script:
- git remote set-url --push origin https://${GITHUB_TOKEN}@github.com/ivanilves/lstags.git

script:
- make build
- make coverage
- if [[ "${TRAVIS_PULL_REQUEST}" == "false" ]]; then make blackbox-integration-test; fi
- make lint
- make vet
- make build
- make coverage
- make blackbox-integration-test
- make stress-test CONCURRENT_REQUESTS=96
- make docker-image DOCKER_TAG=release

after_script:
Expand Down
32 changes: 27 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
API_VERSION:=$(shell cat API_VERSION)

.PHONY: default clean offline prepare dep test unit-test whitebox-integration-test coverage \
blackbox-integration-test shell-test-alpine shell-test-wrong-image shell-test-docker-socket shell-test-docker-tcp \
lint vet fail-on-errors docker-image build xbuild changelog release validate-release deploy deploy-github deploy-docker \
poc-app wrapper install
.PHONY: default PHONY clean offline prepare dep test unit-test whitebox-integration-test coverage blackbox-integration-test \
shell-test-alpine shell-test-wrong-image shell-test-docker-socket shell-test-docker-tcp shell-test-pullpush start-local-registry stop-local-registry push-to-local-registry \
stress-test lint vet fail-on-errors docker-image build xbuild changelog release validate-release deploy deploy-github deploy-docker poc-app wrapper install

default: prepare dep test lint vet build

PHONY:
@egrep "^[0-9a-zA-Z_\-]+:( |$$)" Makefile | cut -d":" -f1 | uniq | tr '\n' ' ' | sed 's/^/.PHONY: /;s/$$/\n/'

clean:
rm -rf ./lstags ./dist/ *.log *.pid

Expand Down Expand Up @@ -42,7 +44,8 @@ coverage:
overalls -project=${PROJECT} -covermode=count \
&& if [[ -n "${COVERALLS_TOKEN}" ]]; then goveralls -coverprofile=overalls.coverprofile -service ${SERVICE}; fi

blackbox-integration-test: shell-test-alpine shell-test-wrong-image shell-test-docker-socket shell-test-docker-tcp
blackbox-integration-test: shell-test-alpine shell-test-wrong-image \
shell-test-docker-socket shell-test-docker-tcp shell-test-pullpush

shell-test-alpine:
./lstags alpine | egrep "\salpine:latest"
Expand All @@ -57,6 +60,25 @@ shell-test-docker-tcp: DOCKER_HOST:=tcp://127.0.0.1:2375
shell-test-docker-tcp:
./lstags nginx~/stable/

shell-test-pullpush: start-local-registry push-to-local-registry stop-local-registry

start-local-registry: REGISTRY_PORT:=5757
start-local-registry:
docker run -d -p ${REGISTRY_PORT}:5000 --name registry-lstags registry:2

stop-local-registry:
docker rm -f registry-lstags || true

push-to-local-registry: REPOSITORIES:=alpine:latest busybox:latest
push-to-local-registry: REGISTRY_PORT:=5757
push-to-local-registry:
./lstags --push-registry=localhost:${REGISTRY_PORT} ${REPOSITORIES}

stress-test: YAML_CONFIG:=./fixtures/config/config-stress.yaml
stress-test: CONCURRENT_REQUESTS:=64
stress-test:
./lstags --yaml-config=${YAML_CONFIG} --concurrent-requests=${CONCURRENT_REQUESTS}

lint: ERRORS=$(shell find . -name "*.go" ! -path "./vendor/*" | xargs -I {} golint {} | tr '`' '|')
lint: fail-on-errors

Expand Down

0 comments on commit 294649a

Please sign in to comment.