-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #977 from satya-gorli/opensdsCI
CI Files for UT, IT and E2E Test
- Loading branch information
Showing
8 changed files
with
267 additions
and
4 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,45 @@ | ||
# Copyright 2019 The OpenSDS 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. | ||
|
||
#unit tests | ||
.PHONY: unit_test | ||
ifeq ($(WHAT),) | ||
TEST_DIR="./pkg/" | ||
else | ||
TEST_DIR=${WHAT} | ||
endif | ||
|
||
export GOARCHAIUS_CONFIG_PATH=$(CURDIR) | ||
test: | ||
find ${TEST_DIR} -name "*_test.go"|xargs -i dirname {}|uniq|xargs -i go test ${T} {} | ||
# verify | ||
.PHONY: verify | ||
verify: | ||
bash -x ./verify.sh | ||
|
||
.PHONY: unit_test | ||
unit_test: | ||
bash -x ./../test/unittest/unittest.sh | ||
|
||
.PHONY: integration_test | ||
integration_test: | ||
#ash test/integration/scripts/execute.sh | ||
bash -x ./../test/integration/integrationtest.sh | ||
.PHONY: e2etest_build | ||
e2etest_build: | ||
bash -x ./../test/e2e/e2etest.sh | ||
|
||
.PHONY: clean | ||
clean: | ||
bash -x hack/clean.sh |
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,35 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Copyright 2019 The OpenSDS 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
ROOTDIR=$( cd "$(dirname "$0")" ; pwd -P )/.. | ||
|
||
cd "$ROOTDIR" | ||
|
||
# The files or packagess we should update gofmt. | ||
find_files() { | ||
find . -not \( \ | ||
\( \ | ||
-wholename './.git' \ | ||
-o -wholename '*/vendor/*' \ | ||
\) -prune \ | ||
\) -name '*.go' | ||
} | ||
|
||
find_files | xargs gofmt -s -w |
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,29 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The OpenSDS 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. | ||
|
||
if ! [ -f "./bin/gometalinter" ]; then echo "Download The files"; | ||
curl -L https://git.io/vp6lP | sh | ||
fi | ||
export PATH=${PATH}:${GOPATH}/bin:${GOPATH}/src/github.com/opensds/opensds/osds/bin | ||
gometalinter --disable-all --enable=gofmt --enable=misspell --enable=golint --exclude=vendor --exclude=test ./../... > golintoutput.txt | ||
if [ $? != 0 ]; then | ||
echo "Please fix the warnings!" | ||
echo "Run ./update-gofmt.sh if any warnings in gofmt" | ||
#exit 1 | ||
else | ||
echo "Gofmt,misspell,golint checks have been passed" | ||
fi | ||
|
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,39 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The OpenSDS 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. | ||
|
||
#set -e errexit | ||
# Keep track of the script directory | ||
TOP_DIR=$(cd $(dirname "$0") && pwd) | ||
# OpenSDS Root directory | ||
OPENSDS_DIR=$(cd $TOP_DIR/../.. && pwd) | ||
|
||
split_line(){ | ||
echo "================================================================================================" | ||
echo $* | ||
echo "================================================================================================" | ||
} | ||
|
||
# Start e2e test | ||
split_line "Start e2e test" | ||
sudo $OPENSDS_DIR/install/devsds/install.sh | ||
ps -ef|grep osds | ||
go test -v github.com/opensds/opensds/test/e2e/... -tags e2e | ||
|
||
# Start e2e flow test | ||
split_line "Start e2e flow test" | ||
go build -o ./test/e2e/volume-connector github.com/opensds/opensds/test/e2e/connector/ | ||
go test -v github.com/opensds/opensds/test/e2e/... -tags e2ef | ||
sudo $OPENSDS_DIR/install/devsds/uninstall.sh |
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,36 @@ | ||
#!/bin/bash | ||
# Copyright 2019 The OpenSDS 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. | ||
|
||
set -o errexit | ||
# Keep track of the script directory | ||
TOP_DIR=$(cd $(dirname "$0") && pwd) | ||
# OpenSDS Root directory | ||
OPENSDS_DIR=$(cd $TOP_DIR/../.. && pwd) | ||
|
||
split_line(){ | ||
echo "================================================================================================" | ||
echo $* | ||
echo "================================================================================================" | ||
} | ||
|
||
|
||
|
||
# Start integration test. | ||
split_line "Start integration test" | ||
sudo $OPENSDS_DIR/test/integration/prepare.sh | ||
go test -v github.com/opensds/opensds/test/integration/... -tags integration | ||
sudo killall -9 osdslet osdsdock | ||
sudo rm /etc/opensds/opensds.conf -rf | ||
|
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,44 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2019 The OpenSDS 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. | ||
|
||
set -o errexit | ||
# Keep track of the script directory | ||
TOP_DIR=$(cd $(dirname "$0") && pwd) | ||
# OpenSDS Root directory | ||
OPENSDS_DIR=$(cd $TOP_DIR/../.. && pwd) | ||
|
||
split_line(){ | ||
echo "================================================================================================" | ||
echo $* | ||
echo "================================================================================================" | ||
} | ||
|
||
|
||
|
||
# Start the openapi-spec validation. | ||
split_line "Start openapi-spec validation" | ||
|
||
wget https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/swagger_linux_amd64 | ||
chmod +x ./swagger_linux_amd64 && ./swagger_linux_amd64 validate --stop-on-error $OPENSDS_DIR/openapi-spec/swagger.yaml | ||
rm ./swagger_linux_amd64 | ||
|
||
# Start unit test. | ||
split_line "Start unit test" | ||
go test -v github.com/opensds/opensds/osdsctl/... -cover | ||
go test -v github.com/opensds/opensds/client/... -cover | ||
go test -v github.com/opensds/opensds/pkg/... -cover | ||
go test -v github.com/opensds/opensds/contrib/... -cover | ||
|