Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup the required mocking framework for testing * Code refactoring done to accommodate tests * Revendored test dependencies * Makefile now supports testing of driver * Updated CI scripts and Makefiles Co-Authored-By: Amshuman K R <amshuman.rao.karaya@sap.com>
- Loading branch information
1 parent
3082e9c
commit 6608928
Showing
613 changed files
with
268,862 additions
and
17,572 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright (c) 2019 SAP SE or an SAP affiliate company. 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 | ||
|
||
# For the test step concourse will set the following environment variables: | ||
# SOURCE_PATH - path to component repository root directory. | ||
|
||
if [[ $(uname) == 'Darwin' ]]; then | ||
READLINK_BIN="greadlink" | ||
else | ||
READLINK_BIN="readlink" | ||
fi | ||
|
||
if [[ -z "${SOURCE_PATH}" ]]; then | ||
export SOURCE_PATH="$(${READLINK_BIN} -f $(dirname ${0})/..)" | ||
else | ||
export SOURCE_PATH="$(${READLINK_BIN} -f "${SOURCE_PATH}")" | ||
fi | ||
|
||
# The `go <cmd>` commands requires to see the target repository to be part of a | ||
# Go workspace. Thus, if we are not yet in a Go workspace, let's create one | ||
# temporarily by using symbolic links. | ||
if [[ "${SOURCE_PATH}" != *"src/github.com/gardener/machine-controller-manager-provider-aws" ]]; then | ||
SOURCE_SYMLINK_PATH="${SOURCE_PATH}/tmp/src/github.com/gardener/machine-controller-manager-provider-aws" | ||
if [[ -d "${SOURCE_PATH}/tmp" ]]; then | ||
rm -rf "${SOURCE_PATH}/tmp" | ||
fi | ||
mkdir -p "${SOURCE_PATH}/tmp/src/github.com/gardener" | ||
ln -s "${SOURCE_PATH}" "${SOURCE_SYMLINK_PATH}" | ||
cd "${SOURCE_SYMLINK_PATH}" | ||
|
||
export GOPATH="${SOURCE_PATH}/tmp" | ||
export GOBIN="${SOURCE_PATH}/tmp/bin" | ||
export PATH="${GOBIN}:${PATH}" | ||
fi | ||
|
||
# Install Ginkgo (test framework) to be able to execute the tests. | ||
echo "Fetching Ginkgo frawework" | ||
go get -u github.com/onsi/ginkgo/ginkgo | ||
echo "Successfully fetched Ginkgo frawework" | ||
|
||
############################################################################## | ||
|
||
function test_with_coverage() { | ||
local output_dir=test/output | ||
local coverprofile_file=coverprofile.out | ||
mkdir -p test/output | ||
ginkgo $GINKGO_COMMON_FLAGS --coverprofile ${coverprofile_file} -covermode=set -outputdir ${output_dir} ${TEST_PACKAGES} | ||
|
||
sed -i -e '/mode: set/d' ${output_dir}/${coverprofile_file} | ||
{( echo "mode: set"; cat ${output_dir}/${coverprofile_file} )} > ${output_dir}/${coverprofile_file}.temp | ||
mv ${output_dir}/${coverprofile_file}.temp ${output_dir}/${coverprofile_file} | ||
go tool cover -func ${output_dir}/${coverprofile_file} | ||
} | ||
|
||
############################################################################### | ||
|
||
if [[ "${SKIP_UNIT_TESTS}" != "" ]]; then | ||
echo ">>>>>Skipping unit tests" | ||
else | ||
echo ">>>>> Invoking unit tests" | ||
TEST_PACKAGES="pkg" | ||
GINKGO_COMMON_FLAGS="-r -timeout=1h0m0s --randomizeAllSpecs --randomizeSuites --failOnPending --progress" | ||
test_with_coverage | ||
echo ">>>>> Finished executing unit tests" | ||
fi | ||
|
||
echo "CI tests have passed successfully" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
.note | ||
main | ||
seqdiagram.diag | ||
seqdiagram.diag | ||
cmi-server | ||
*coverprofile.out* |
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# machine-controller-manager maintainers | ||
* @gardener/mcm-maintainers | ||
# machine-controller-manager-provider-aws maintainers | ||
* @gardener/mcm-maintainers |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM alpine:3.6 | ||
|
||
RUN apk add --update bash curl | ||
COPY bin/rel/cmi-server /cmi-server | ||
WORKDIR / | ||
ENTRYPOINT ["/cmi-server"] |
Oops, something went wrong.