Skip to content

Commit

Permalink
Makefile: add tests target (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurugana authored Dec 8, 2020
1 parent f251575 commit b1cc95a
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 59 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ var/
.#*
.vscode
#*
tests/functional/.*
tests/functional/minio*
7 changes: 3 additions & 4 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Fork [minio-py upstream](https://github.com/minio/minio-py/fork) source reposito
```sh
$ git clone [email protected]:minio/minio-py
$ cd minio-py
$ pip install urllib3 certifi pyflakes faker twine
$ pip install --user --upgrade twine
```

### Modify package version
Expand All @@ -23,10 +23,9 @@ __version__ = '2.2.5'
```

### Build and verify
Run `./tests/unit_test.sh` and `./tests/functional_test.sh` to verify the SDK.
```sh
$ ./tests/unit_test.sh
$ ./tests/functional_test.sh all
$ make
$ python setup.py register
$ python setup.py sdist bdist bdist_wheel
```

Expand Down
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
.PHONY: examples tests publish
.PHONY: default
default: tests

getdeps:
@pip install --user --upgrade pylint autopep8
@echo "Installing required dependencies"
@pip install --user --upgrade autopep8 certifi configparser mock nose pylint urllib3

check: getdeps
@echo "Running checks"
@pylint --reports=no --score=no --disable=R0401,R0801 minio/*py
@pylint --reports=no --score=no minio/credentials tests/functional
@isort --diff .
Expand All @@ -13,9 +16,8 @@ apply: getdeps
@isort .
@find . -name "*.py" -exec autopep8 --in-place {} +

publish:
python setup.py register
python setup.py sdist bdist bdist_wheel upload

tests:
python setup.py nosetests
tests: check
@echo "Running unit tests"
@nosetests
@echo "Running functional tests"
@(env bash run_functional_tests.sh)
51 changes: 51 additions & 0 deletions run_functional_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash
#
# MinIO Python Library for Amazon S3 Compatible Cloud Storage, (C) 2020 MinIO, Inc.
#
# 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.
#

function run_minio_server() {
if [ ! -f tests/functional/minio ]; then
wget --quiet -output-document tests/functional/minio https://dl.min.io/server/minio/release/linux-amd64/minio
chmod +x tests/functional/minio
fi

export MINIO_ACCESS_KEY=minio
export MINIO_SECRET_KEY=minio123
export MINIO_KMS_KES_ENDPOINT=https://play.min.io:7373
export MINIO_KMS_KES_KEY_FILE=tests/functional/play.min.io.kes.root.key
export MINIO_KMS_KES_CERT_FILE=tests/functional/play.min.io.kes.root.cert
export MINIO_KMS_KES_KEY_NAME=my-minio-key
export MINIO_NOTIFY_WEBHOOK_ENABLE_miniopytest=on
export MINIO_NOTIFY_WEBHOOK_ENDPOINT_miniopytest=http://example.org/
export SQS_ARN="arn:minio:sqs::miniopytest:webhook"
tests/functional/minio server --config-dir tests/functional/.cfg tests/functional/.d{1...4} >tests/functional/minio.log 2>&1 &
}

if [ -z ${SERVER_ENDPOINT+x} ]; then
run_minio_server
MINIO_PID=$!
trap "kill -9 $MINIO_PID" INT

export MINT_MODE=full
export SERVER_ENDPOINT=localhost:9000
export ACCESS_KEY=minio
export SECRET_KEY=minio123
export ENABLE_HTTPS=0
fi

PYTHONPATH=$PWD python tests/functional/tests.py
if [ -n "$MINIO_PID" ]; then
kill -9 "$MINIO_PID"
fi
9 changes: 9 additions & 0 deletions tests/functional/play.min.io.kes.root.cert
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
-----BEGIN CERTIFICATE-----
MIIBKDCB26ADAgECAhB6vebGMUfKnmBKyqoApRSOMAUGAytlcDAbMRkwFwYDVQQD
DBByb290QHBsYXkubWluLmlvMB4XDTIwMDQzMDE1MjIyNVoXDTI1MDQyOTE1MjIy
NVowGzEZMBcGA1UEAwwQcm9vdEBwbGF5Lm1pbi5pbzAqMAUGAytlcAMhALzn735W
fmSH/ghKs+4iPWziZMmWdiWr/sqvqeW+WwSxozUwMzAOBgNVHQ8BAf8EBAMCB4Aw
EwYDVR0lBAwwCgYIKwYBBQUHAwIwDAYDVR0TAQH/BAIwADAFBgMrZXADQQDZOrGK
b2ATkDlu2pTcP3LyhSBDpYh7V4TvjRkBTRgjkacCzwFLm+mh+7US8V4dBpIDsJ4u
uWoF0y6vbLVGIlkG
-----END CERTIFICATE-----
3 changes: 3 additions & 0 deletions tests/functional/play.min.io.kes.root.key
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-----BEGIN PRIVATE KEY-----
MC4CAQAwBQYDK2VwBCIEID9E7FSYWrMD+VjhI6q545cYT9YOyFxZb7UnjEepYDRc
-----END PRIVATE KEY-----
30 changes: 0 additions & 30 deletions tests/functional_test.sh

This file was deleted.

17 changes: 0 additions & 17 deletions tests/unit_test.sh

This file was deleted.

0 comments on commit b1cc95a

Please sign in to comment.