diff --git a/.github/workflows/pythonpackage.yml b/.github/workflows/pythonpackage-linux.yml similarity index 53% rename from .github/workflows/pythonpackage.yml rename to .github/workflows/pythonpackage-linux.yml index 5d05225d0..d8229e0a7 100644 --- a/.github/workflows/pythonpackage.yml +++ b/.github/workflows/pythonpackage-linux.yml @@ -13,10 +13,10 @@ jobs: name: Test on python ${{ matrix.python-version }} and ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: - max-parallel: 4 + max-parallel: 3 matrix: python-version: [2.7, 3.6, 3.7] - os: [ubuntu-latest, windows-latest] + os: [ubuntu-latest] steps: - uses: actions/checkout@v1 @@ -28,6 +28,10 @@ jobs: run: | python -m pip install --upgrade pip pip install urllib3 certifi pytz pyflakes faker nose + - name: Generate TLS certificate + run: | + mkdir -p $HOME/.minio/certs/ + openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout $HOME/.minio/certs/private.key -out $HOME/.minio/certs/public.crt -subj '/CN=localhost' - name: Test with nosetests run: | pyflakes minio/*.py || true @@ -36,4 +40,15 @@ jobs: - name: Test with functional tests env: MINT_MODE: full - run: python tests/functional/tests.py + SERVER_ENDPOINT: localhost:9000 + ACCESS_KEY: minio + SECRET_KEY: minio123 + ENABLE_HTTPS: 1 + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 + run: | + wget -O $HOME/minio https://dl.min.io/server/minio/release/linux-amd64/minio + chmod +x $HOME/minio + $HOME/minio server /tmp/xl/{1..4} & + export SSL_CERT_FILE=$HOME/.minio/certs/public.crt + python tests/functional/tests.py diff --git a/.github/workflows/pythonpackage-windows.yml b/.github/workflows/pythonpackage-windows.yml new file mode 100644 index 000000000..e3ee31ae6 --- /dev/null +++ b/.github/workflows/pythonpackage-windows.yml @@ -0,0 +1,49 @@ +name: Python package + +on: + pull_request: + branches: + - master + push: + branches: + - master + +jobs: + build: + name: Test on python ${{ matrix.python-version }} and ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + max-parallel: 3 + matrix: + python-version: [2.7, 3.6, 3.7] + os: [windows-latest] + + steps: + - uses: actions/checkout@v1 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install urllib3 certifi pytz pyflakes faker nose wget + - name: Test with nosetests + run: | + $ErrorActionPreference = 'continue' + pyflakes minio/*.py + python setup.py install + python setup.py nosetests + - name: Test with functional tests + env: + MINT_MODE: full + SERVER_ENDPOINT: localhost:9000 + ACCESS_KEY: minio + SECRET_KEY: minio123 + ENABLE_HTTPS: 0 + MINIO_ACCESS_KEY: minio + MINIO_SECRET_KEY: minio123 + run: | + Invoke-WebRequest -Uri https://dl.min.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe + Start-Process -NoNewWindow -FilePath "$HOME/minio.exe" -ArgumentList "server", "$env:temp/data/xl/1", "$env:temp/data/xl/2", "$env:temp/data/xl/3", "$env:temp/data/xl/4" + python tests/functional/tests.py diff --git a/tests/functional/tests.py b/tests/functional/tests.py index d1879cf55..ab37c0745 100644 --- a/tests/functional/tests.py +++ b/tests/functional/tests.py @@ -22,6 +22,7 @@ import io import csv import sys +import tempfile from sys import exit import uuid @@ -895,22 +896,25 @@ def test_fget_object(client, log_output, sse=None): # default value for log_output.function attribute is; # log_output.function = "fget_object(bucket_name, object_name, file_path, request_headers)" + tmpfd, tmpfile = tempfile.mkstemp() + os.close(tmpfd) + # Get a unique bucket_name and object_name log_output.args['bucket_name'] = bucket_name = generate_bucket_name() log_output.args['object_name'] = object_name = uuid.uuid4().__str__() - log_output.args['file_path'] = newfile_f = 'newfile-f 新' + log_output.args['file_path'] = tmpfile try: MB_1 = 1024*1024 # 1MiB. MB_1_reader = LimitedRandomReader(MB_1) client.make_bucket(bucket_name) client.put_object(bucket_name, object_name, MB_1_reader, MB_1, sse=sse) # Get/Download a full object and save locally at path - client.fget_object(bucket_name, object_name, newfile_f, sse=sse) + client.fget_object(bucket_name, object_name, tmpfile, sse=sse) except Exception as err: raise Exception(err) finally: try: - os.remove(newfile_f) + os.remove(tmpfile) client.remove_object(bucket_name, object_name) client.remove_bucket(bucket_name) except Exception as err: