From c8c2e8b7f6097dbeaf7039b94f656fd30aba8945 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Mon, 16 Jan 2017 18:22:51 +0100 Subject: [PATCH 1/5] Dockerfile for running tests --- script/test_in_container/Dockerfile | 46 +++++++++++++++++++++++++++++ script/test_in_container/run.sh | 25 ++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 script/test_in_container/Dockerfile create mode 100755 script/test_in_container/run.sh diff --git a/script/test_in_container/Dockerfile b/script/test_in_container/Dockerfile new file mode 100644 index 00000000..6d8c09d5 --- /dev/null +++ b/script/test_in_container/Dockerfile @@ -0,0 +1,46 @@ +# Copyright 2016 The Kubernetes Authors. +# +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# This Dockefile creates image where all Kompose tests can be run + +FROM registry.centos.org/centos/centos:7 + +RUN yum install -y epel-release +RUN yum install -y golang make git jq &&\ + yum -y clean all + +ENV GOPATH="/opt/go" \ + # KOMPOSE_TMP_SRC is where kompose source will be mounted from host + KOMPOSE_TMP_SRC="/opt/tmp/kompose" + +ENV PATH="$PATH:$GOPATH/bin" \ + # KOMPOSE_SRC is where kompose source will be copied when container starts (by run.sh script) + # this is to ensure that we won't write anything to host volume mount + KOMPOSE_SRC="$GOPATH/src/github.com/kubernetes-incubator/kompose" + +RUN go get github.com/Masterminds/glide &&\ + go get github.com/sgotti/glide-vc &&\ + go get github.com/golang/lint/golint + +WORKDIR $KOMPOSE_SRC +# This image can be run as any user +RUN chmod -R ugo+rw $GOPATH + + +COPY run.sh /opt/tools/ +ENTRYPOINT ["/opt/tools/run.sh"] + + + diff --git a/script/test_in_container/run.sh b/script/test_in_container/run.sh new file mode 100755 index 00000000..892222b0 --- /dev/null +++ b/script/test_in_container/run.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +# Copyright 2017 The Kubernetes Authors. +# +# 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 +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + + +# Container should be started with Kompose source mounted as read-only volume $KOMPOSE_TMP_SRC +# Copy Kompose sources to another directory after container starts. +# We can be sure that this container won't modify any files on hosts disk. +cp -r $KOMPOSE_TMP_SRC/ $(dirname $KOMPOSE_SRC) + +make test-all From f68be75d60b6fc20f68428cde072ba7972d83541 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Mon, 16 Jan 2017 18:23:10 +0100 Subject: [PATCH 2/5] Add make rules for building and running test image --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Makefile b/Makefile index 76c54bce..0815fd96 100644 --- a/Makefile +++ b/Makefile @@ -24,6 +24,8 @@ KOMPOSE_ENVS := \ BIND_DIR := bundles +TEST_IMAGE = "tomaskral/kompose-test:latest" + default: bin all: validate @@ -57,3 +59,11 @@ gofmt: check-vendor: ./script/make.sh check-vendor + +# build docker image that is used for running travis test localy +build-test-image: + docker build -t $(TEST_IMAGE) -f script/tests_in_container/Dockerfile . + +# run travis test localy using docker image (build by build-test-image target) +test-docker: + docker run -v `pwd`:/opt/tmp/kompose:ro -it $(TEST_IMAGE) From f530f99f023a107885bf9d7c5e864e0c1efe8387 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 19 Jan 2017 13:01:56 +0100 Subject: [PATCH 3/5] Fix CreateLocalGitDirectory for tests. If you didn't setup user.email and user.name `git commit` fails. This configures user.email and user.name for newly created temporary git repo. --- pkg/testutils/git.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pkg/testutils/git.go b/pkg/testutils/git.go index e446ebff..b89c0a29 100644 --- a/pkg/testutils/git.go +++ b/pkg/testutils/git.go @@ -26,9 +26,12 @@ func CreateLocalDirectory(t *testing.T) string { func CreateLocalGitDirectory(t *testing.T) string { dir := CreateLocalDirectory(t) cmd := NewCommand( - `git init && touch README && - git add README && - git commit -m 'testcommit'`) + `git init && + git config user.email "you@example.com" && + git config user.name "Your Name" && + touch README && + git add README && + git commit --no-gpg-sign -m 'testcommit'`) cmd.Dir = dir _, err := cmd.Output() if err != nil { From 20b844d6e948925cdcbca116f2eb84274f9632a9 Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Thu, 19 Jan 2017 19:38:07 +0100 Subject: [PATCH 4/5] Clean up Makefile and scripts in scripts dir. If command is simple command call it from Makefile, there is no need to have them in separate shell scripts. --- .travis.yml | 13 +--- Makefile | 91 +++++++++++++++-------- script/.build | 19 ----- script/.validate | 18 ----- script/bash_autocomplete | 28 ------- script/binary | 36 --------- script/binary-cross | 42 ----------- script/{validate-gofmt => check-gofmt.sh} | 5 +- script/{validate-lint => check-lint.sh} | 3 +- script/{check-vendor => check-vendor.sh} | 7 +- script/make.sh | 46 ------------ script/test-cmd | 17 ----- script/test-unit | 21 ------ script/test-unit-cover | 27 ------- script/validate-git-marks | 58 --------------- script/validate-vet | 21 ------ 16 files changed, 67 insertions(+), 385 deletions(-) delete mode 100644 script/.build delete mode 100644 script/.validate delete mode 100644 script/bash_autocomplete delete mode 100755 script/binary delete mode 100644 script/binary-cross rename script/{validate-gofmt => check-gofmt.sh} (92%) rename script/{validate-lint => check-lint.sh} (93%) rename script/{check-vendor => check-vendor.sh} (93%) delete mode 100755 script/make.sh delete mode 100755 script/test-cmd delete mode 100755 script/test-unit delete mode 100755 script/test-unit-cover delete mode 100755 script/validate-git-marks delete mode 100755 script/validate-vet diff --git a/.travis.yml b/.travis.yml index 091098a5..fbd0f1f1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,18 +20,7 @@ install: - true script: - - make check-vendor - - make validate - - make test-unit-cover + - make test-all # gover collects all .coverprofile files and saves it to one file gover.coverprofile - gover - goveralls -coverprofile=gover.coverprofile -service=travis-ci - - # make test-cmd requires kompose binary - - make bin - - # $GOPATH/bin is in $PATH - - mkdir -p $GOPATH/bin - - cp kompose $GOPATH/bin/ - - - make test-cmd diff --git a/Makefile b/Makefile index 0815fd96..26e35bea 100644 --- a/Makefile +++ b/Makefile @@ -13,57 +13,86 @@ # See the License for the specific language governing permissions and # limitations under the License. -.PHONY: all -KOMPOSE_ENVS := \ - -e OS_PLATFORM_ARG \ - -e OS_ARCH_ARG \ - -e TESTDIRS \ - -e TESTFLAGS \ - -e TESTVERBOSE - -BIND_DIR := bundles - -TEST_IMAGE = "tomaskral/kompose-test:latest" +GITCOMMIT := $(shell git rev-parse --short HEAD) +BUILD_FLAGS := -ldflags="-w -X github.com/kubernetes-incubator/kompose/version.GITCOMMIT=$(GITCOMMIT)" +PKGS := $(shell glide novendor) +TEST_IMAGE := kompose/tests:latest default: bin -all: validate - CGO_ENABLED=1 ./script/make.sh +.PHONY: all +all: bin +.PHONY: bin bin: - CGO_ENABLED=1 ./script/make.sh binary + go build ${BUILD_FLAGS} -o kompose main.go +.PHONY: install +install: + go install ${BUILD_FLAGS} + +# kompile kompose for multiple platforms +.PHONY: cross cross: - # CGO_ENABLED=1 ./script/make.sh binary-cross - ./script/make.sh binary-cross + gox -os="darwin linux windows" -arch="386 amd64" -output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" $(BUILD_FLAGS) +.PHONY: clean clean: - ./script/make.sh clean + rm -f kompose + rm -r -f bundles +.PHONY: test-unit test-unit: - ./script/make.sh test-unit -test-cmd: - ./script/make.sh test-cmd -test-unit-cover: - ./script/make.sh test-unit-cover + go test $(BUILD_FLAGS) -race -cover -v $(PKGS) +# Run unit tests and collect coverage +.PHONY: test-unit-cover +test-unit-cover: + # First install packages that are dependencies of the test. + go test -i -race -cover $(PKGS) + # go test doesn't support colleting coverage across multiple packages, + # generate go test commands using go list and run go test for every package separately + go list -f '"go test -race -cover -v -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"' github.com/kubernetes-incubator/kompose/... | grep -v "vendor" | xargs -L 1 -P4 sh -c + +# run commandline tests +.PHONY: test-cmd +test-cmd: + ./script/test/cmd/tests.sh + +# run all validation tests +.PHONY: validate validate: gofmt vet lint +.PHONY: vet vet: - ./script/make.sh validate-vet + go vet $(PKGS) + +.PHONY: lint lint: - ./script/make.sh validate-lint + ./script/check-lint.sh + +.PHONY: gofmt gofmt: - ./script/make.sh validate-gofmt + ./script/check-gofmt.sh +# Checks if there are nested vendor dirs inside Kompose vendor and if vendor was cleaned by glide-vc +.PHONY: check-vendor check-vendor: - ./script/make.sh check-vendor + ./script/check-vendor.sh -# build docker image that is used for running travis test localy -build-test-image: - docker build -t $(TEST_IMAGE) -f script/tests_in_container/Dockerfile . +# Run all tests +.PHONY: test-all +test-all: check-vendor validate test-unit-cover install test-cmd -# run travis test localy using docker image (build by build-test-image target) -test-docker: +# build docker image that is used for running all test localy +.PHONY: test-image +test-image: + docker build -t $(TEST_IMAGE) -f script/test_in_container/Dockerfile script/test_in_container/ + +# run all test localy in docker image (image can be build by by build-test-image target) +.PHONY: test +test: docker run -v `pwd`:/opt/tmp/kompose:ro -it $(TEST_IMAGE) + + diff --git a/script/.build b/script/.build deleted file mode 100644 index 0c0de213..00000000 --- a/script/.build +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -GITCOMMIT=$(git rev-parse --short HEAD) - -BUILD_FLAGS=(-ldflags="-w -X github.com/kubernetes-incubator/kompose/version.GITCOMMIT=${GITCOMMIT}") diff --git a/script/.validate b/script/.validate deleted file mode 100644 index 6730c9ab..00000000 --- a/script/.validate +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# all Kompose packages (skip vendor dir) -PKGS=$( go list -e ./... | grep -v '/vendor/' ) diff --git a/script/bash_autocomplete b/script/bash_autocomplete deleted file mode 100644 index 3af2531d..00000000 --- a/script/bash_autocomplete +++ /dev/null @@ -1,28 +0,0 @@ -#! /bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -: ${PROG:=$(basename ${BASH_SOURCE})} - -_cli_bash_autocomplete() { - local cur opts base - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion ) - COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) - return 0 - } - - complete -F _cli_bash_autocomplete $PROG diff --git a/script/binary b/script/binary deleted file mode 100755 index 08fbab54..00000000 --- a/script/binary +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -source "$(dirname "$BASH_SOURCE")/.build" - -OUT_FILE="./kompose" - -# Get rid of existing binary -rm -f $OUT_FILE - -# Build binary -go build \ - "${BUILD_FLAGS[@]}" \ - -o $OUT_FILE \ - main.go - -if [ $? -eq 0 ]; then - echo "Build successful. Program saved as ${OUT_FILE}" -else - echo "Build failed." -fi diff --git a/script/binary-cross b/script/binary-cross deleted file mode 100644 index 761d912b..00000000 --- a/script/binary-cross +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -source "$(dirname "$BASH_SOURCE")/.build" - -if [ -z "$1" ]; then - OS_PLATFORM_ARG=(-os="darwin linux windows") -else - OS_PLATFORM_ARG=($1) -fi - -if [ -z "$2" ]; then - OS_ARCH_ARG=(-arch="386 amd64") -else - OS_ARCH_ARG=($2) -fi - -GITCOMMIT=$(git rev-parse --short HEAD) - -# Get rid of existing binaries -rm -f kompose* - -# Build binaries -gox "${OS_PLATFORM_ARG[@]}" "${OS_ARCH_ARG[@]}" \ - -output="bundles/kompose_{{.OS}}-{{.Arch}}/kompose" \ - "${BUILD_FLAGS[@]}" \ - . diff --git a/script/validate-gofmt b/script/check-gofmt.sh similarity index 92% rename from script/validate-gofmt rename to script/check-gofmt.sh index 4455fc36..fc23949f 100755 --- a/script/validate-gofmt +++ b/script/check-gofmt.sh @@ -14,11 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. -source "$(dirname "$BASH_SOURCE")/.validate" + +# This checks if all go source files in current directory are format using gofmt GO_FILES=$(find . -path ./vendor -prune -o -name '*.go' -print ) - for file in $GO_FILES; do gofmtOutput=$(gofmt -l "$file") if [ "$gofmtOutput" ]; then @@ -27,7 +27,6 @@ for file in $GO_FILES; do done - if [ ${#errors[@]} -eq 0 ]; then echo "gofmt OK" else diff --git a/script/validate-lint b/script/check-lint.sh similarity index 93% rename from script/validate-lint rename to script/check-lint.sh index f22ddbc3..d6123933 100755 --- a/script/validate-lint +++ b/script/check-lint.sh @@ -15,9 +15,8 @@ set -e # See the License for the specific language governing permissions and # limitations under the License. -source "$(dirname "$BASH_SOURCE")/.validate" -for pkg in $PKGS; do +for pkg in $(glide novendor); do lintOutput=$(golint "$pkg") # if lineOutput is not empty, save it to errros array if [ "$lintOutput" ]; then diff --git a/script/check-vendor b/script/check-vendor.sh similarity index 93% rename from script/check-vendor rename to script/check-vendor.sh index f4e4c6a0..1339a4ee 100755 --- a/script/check-vendor +++ b/script/check-vendor.sh @@ -14,12 +14,11 @@ # See the License for the specific language governing permissions and # limitations under the License. - - # Check if there are nested vendor dirs inside Kompose vendor. # All dependencies should be flattened and there shouldn't be vendor in inside vendor. + function check_nested_vendor() { - echo "Checking if there are nested vendor dirs" + echo "Checking for nested vendor dirs" # count all vendor directories inside Kompose vendor NO_NESTED_VENDORS=$(find vendor/ -type d | sed 's/^[^/]*.//g' | grep -E "vendor$" | grep -v _vendor | wc -l) @@ -41,7 +40,7 @@ function check_glide-vc() { echo "Checking if vendor was cleaned using glide-vc." # dry run glide-vc and count how many could be deleted. - NO_DELETED_FILES=$($GOPATH/bin/glide-vc --only-code --no-tests --dryrun | wc -l) + NO_DELETED_FILES=$(glide-vc --only-code --no-tests --dryrun | wc -l) if [ $NO_DELETED_FILES -ne 0 ]; then echo "ERROR" diff --git a/script/make.sh b/script/make.sh deleted file mode 100755 index efd3c6ca..00000000 --- a/script/make.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -export KOMPOSE_PKG='github.com/kubernetes-incubator/kompose' - -# List of bundles to create when no argument is passed -DEFAULT_BUNDLES=( - validate-gofmt - validate-git-marks - validate-lint - validate-vet - binary -) -bundle() { - local bundle="$1"; shift - echo "---> Making bundle: $(basename "$bundle") (in $DEST)" - source "script/$bundle" "$@" -} - -if [ $# -lt 1 ]; then - bundles=(${DEFAULT_BUNDLES[@]}) -else - bundles=($@) -fi -for bundle in ${bundles[@]}; do - export DEST=. - ABS_DEST="$(cd "$DEST" && pwd -P)" - bundle "$bundle" - echo -done - diff --git a/script/test-cmd b/script/test-cmd deleted file mode 100755 index fd2b1d00..00000000 --- a/script/test-cmd +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -./script/test/cmd/tests.sh diff --git a/script/test-unit b/script/test-unit deleted file mode 100755 index 8349dc7e..00000000 --- a/script/test-unit +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -e - -source "$(dirname "$BASH_SOURCE")/.build" - -go test "${BUILD_FLAGS[@]}" -race -cover -v $( go list github.com/kubernetes-incubator/kompose/... | grep -v '/vendor/' ) diff --git a/script/test-unit-cover b/script/test-unit-cover deleted file mode 100755 index c0365c7c..00000000 --- a/script/test-unit-cover +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - - -source "$(dirname "$BASH_SOURCE")/.build" - - -# Install packages that are dependencies of the test. (this will speed up go test runs) -go test -i -race -cover $( go list github.com/kubernetes-incubator/kompose/... | grep -v '/vendor/' ) - -# go test doesn't support colleting coverage across multiple packages, -# so this is why this runs go test for each package separately -# generate go test commands using go list and run tests -go list -f '"go test -race -cover -v -coverprofile={{.Dir}}/.coverprofile {{.ImportPath}}"' github.com/kubernetes-incubator/kompose/... | grep -v "vendor" | xargs -L 1 -P4 sh -c diff --git a/script/validate-git-marks b/script/validate-git-marks deleted file mode 100755 index 9397e24e..00000000 --- a/script/validate-git-marks +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -source "$(dirname "$BASH_SOURCE")/.validate" - -# folders=$(find * -type d | egrep -v '^Godeps|bundles|.git') - -IFS=$'\n' -files=( $(validate_diff --diff-filter=ACMR --name-only -- '*' | grep -v '^vendor/' || true) ) -unset IFS - -badFiles=() -for f in "${files[@]}"; do - if [ $(grep -r "^<<<<<<<" $f) ]; then - badFiles+=( "$f" ) - continue - fi - - if [ $(grep -r "^>>>>>>>" $f) ]; then - badFiles+=( "$f" ) - continue - fi - - if [ $(grep -r "^=======$" $f) ]; then - badFiles+=( "$f" ) - continue - fi - set -e -done - - -if [ ${#badFiles[@]} -eq 0 ]; then - echo 'Congratulations! There is no conflict.' -else - { - echo "There is trace of conflict(s) in the following files :" - for f in "${badFiles[@]}"; do - echo " - $f" - done - echo - echo 'Please fix the conflict(s) commit the result.' - echo - } >&2 - false -fi diff --git a/script/validate-vet b/script/validate-vet deleted file mode 100755 index 0625823a..00000000 --- a/script/validate-vet +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash -set -e - -# Copyright 2016 The Kubernetes Authors 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 -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -source "$(dirname "$BASH_SOURCE")/.validate" - -go vet $PKGS; - \ No newline at end of file From 0b1b7f3c357a6e5769f6862341594e19a5947f9d Mon Sep 17 00:00:00 2001 From: Tomas Kral Date: Mon, 23 Jan 2017 15:04:29 +0100 Subject: [PATCH 5/5] Rename some make targests: test->test-container test-all->test --- .travis.yml | 2 +- Makefile | 8 ++++---- script/test_in_container/run.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index fbd0f1f1..19c568f7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,7 +20,7 @@ install: - true script: - - make test-all + - make test # gover collects all .coverprofile files and saves it to one file gover.coverprofile - gover - goveralls -coverprofile=gover.coverprofile -service=travis-ci diff --git a/Makefile b/Makefile index 26e35bea..c166adcc 100644 --- a/Makefile +++ b/Makefile @@ -82,8 +82,8 @@ check-vendor: ./script/check-vendor.sh # Run all tests -.PHONY: test-all -test-all: check-vendor validate test-unit-cover install test-cmd +.PHONY: test +test: check-vendor validate test-unit-cover install test-cmd # build docker image that is used for running all test localy .PHONY: test-image @@ -91,8 +91,8 @@ test-image: docker build -t $(TEST_IMAGE) -f script/test_in_container/Dockerfile script/test_in_container/ # run all test localy in docker image (image can be build by by build-test-image target) -.PHONY: test -test: +.PHONY: test-container +test-container: docker run -v `pwd`:/opt/tmp/kompose:ro -it $(TEST_IMAGE) diff --git a/script/test_in_container/run.sh b/script/test_in_container/run.sh index 892222b0..df2a3e97 100755 --- a/script/test_in_container/run.sh +++ b/script/test_in_container/run.sh @@ -22,4 +22,4 @@ set -e # We can be sure that this container won't modify any files on hosts disk. cp -r $KOMPOSE_TMP_SRC/ $(dirname $KOMPOSE_SRC) -make test-all +make test