Skip to content

Commit 85cb81c

Browse files
committed
tests: More fixes for better support of Github CI
1. Explicity create and pass temporary directories in tests 2. Download Minio binary for both Linux & Windows and avoid testing directly against Play server
1 parent 80f5a24 commit 85cb81c

File tree

5 files changed

+122
-6
lines changed

5 files changed

+122
-6
lines changed

.github/workflows/pythonpackage.yml renamed to .github/workflows/pythonpackage-linux.yml

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
name: Test on python ${{ matrix.python-version }} and ${{ matrix.os }}
1414
runs-on: ${{ matrix.os }}
1515
strategy:
16-
max-parallel: 4
16+
max-parallel: 3
1717
matrix:
1818
python-version: [2.7, 3.6, 3.7]
19-
os: [ubuntu-latest, windows-latest]
19+
os: [ubuntu-latest]
2020

2121
steps:
2222
- uses: actions/checkout@v1
@@ -36,4 +36,17 @@ jobs:
3636
- name: Test with functional tests
3737
env:
3838
MINT_MODE: full
39-
run: python tests/functional/tests.py
39+
SERVER_ENDPOINT: localhost:9000
40+
ACCESS_KEY: minio
41+
SECRET_KEY: minio123
42+
ENABLE_HTTPS: 1
43+
MINIO_ACCESS_KEY: minio
44+
MINIO_SECRET_KEY: minio123
45+
SSL_CERT_FILE: /tmp/minio-config/certs/public.crt
46+
run: |
47+
wget -O /tmp/minio https://dl.min.io/server/minio/release/linux-amd64/minio
48+
chmod +x /tmp/minio
49+
mkdir -p /tmp/minio-config/certs/
50+
cp tests/certs/* /tmp/minio-config/certs/
51+
/tmp/minio -C /tmp/minio-config server /tmp/fs/ &
52+
python tests/functional/tests.py
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Python package
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
push:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
name: Test on python ${{ matrix.python-version }} and ${{ matrix.os }}
14+
runs-on: ${{ matrix.os }}
15+
strategy:
16+
max-parallel: 3
17+
matrix:
18+
python-version: [2.7, 3.6, 3.7]
19+
os: [windows-latest]
20+
21+
steps:
22+
- uses: actions/checkout@v1
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v1
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
pip install urllib3 certifi pytz pyflakes faker nose
31+
- name: Test with nosetests
32+
run: |
33+
$ErrorActionPreference = 'continue'
34+
pyflakes minio/*.py
35+
python setup.py install
36+
python setup.py nosetests
37+
- name: Test with functional tests
38+
env:
39+
MINT_MODE: full
40+
SERVER_ENDPOINT: localhost:9000
41+
ACCESS_KEY: minio
42+
SECRET_KEY: minio123
43+
ENABLE_HTTPS: 1
44+
MINIO_ACCESS_KEY: minio
45+
MINIO_SECRET_KEY: minio123
46+
SSL_CERT_FILE: "$env:temp/minio-config/certs/public.crt"
47+
run: |
48+
New-Item -ItemType Directory -Path "$env:temp/minio-config/certs/"
49+
Copy-Item -Path tests\certs\* -Destination "$env:temp/minio-config/certs/"
50+
Invoke-WebRequest -Uri https://dl.min.io/server/minio/release/windows-amd64/minio.exe -OutFile $HOME/minio.exe
51+
Start-Process -NoNewWindow -FilePath "$HOME/minio.exe" -ArgumentList "-C", "$env:temp/minio-config", "server", "$env:temp/fs"
52+
python tests/functional/tests.py

tests/certs/private.key

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
-----BEGIN PRIVATE KEY-----
2+
MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQC3G9IiC+adjf0p
3+
i/2KYc+4dizeuzUFN7wraSdhiOMdQgCnu9Dc3t2YEsQhNdrARjOTyXd36KeM3TwI
4+
rPJ61dRGQSuN12l+mzngFJQjE0sysZHUJOLQC3rVvIrHSQ57utPg8ifxt/SunlPY
5+
fhcUcq03onMGq44yOfE6mIhoe0Y9wcPQ3RjjNNS44bgmXiXwa+Do0h2hEn6/essq
6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h9Y+kzfHQJrK51nO9lEvkCgYBi
22+
BuKWle1gzAcJdnhDHRoJMIJJtQbVDYhFnBMALXJAmu1lcFzGe0GlMq1PKqCfXr6I
23+
eiXawQmZtJJP1LPPBmOsd2U06KQGHcS00xucvQmVCOrjSdnZ/3SqxsqbH8DOgj+t
24+
ZUzXLwHA+N99rJEK9Hob4kfh7ECjpgobPnIXfKKazQKBgQChAuiXHtf/Qq18hY3u
25+
x48zFWjGgfd6GpOBZYkXOwGdCJgnYjZbE26LZEnYbwPh8ZUA2vp7mgHRJkD5e3Fj
26+
ERuJLCw86WqyYZmLEuBciYGjCZqR5nbavfwsziWD00jeNruds2ZwKxRfFm4V7o2S
27+
WLd/RUatd2Uu9f3B2J78OUdnxg==
28+
-----END PRIVATE KEY-----

tests/certs/public.crt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIIDCzCCAfOgAwIBAgIUaIUOMI78LCu+r1zl0mmFHK8n5/AwDQYJKoZIhvcNAQEL
3+
BQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MCAXDTE5MTAyNDE5NTMxOVoYDzIxMTkw
4+
OTMwMTk1MzE5WjAUMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEB
5+
AQUAA4IBDwAwggEKAoIBAQC3G9IiC+adjf0pi/2KYc+4dizeuzUFN7wraSdhiOMd
6+
QgCnu9Dc3t2YEsQhNdrARjOTyXd36KeM3TwIrPJ61dRGQSuN12l+mzngFJQjE0sy
7+
sZHUJOLQC3rVvIrHSQ57utPg8ifxt/SunlPYfhcUcq03onMGq44yOfE6mIhoe0Y9
8+
wcPQ3RjjNNS44bgmXiXwa+Do0h2hEn6/essq5KjHL8WW2vGg7G9edpYdxINA/A2f
9+
dLtr8BwPNrZhOx84eee2XcUNdBuTtUUxE+0L9yRqItqddriRxJFwOXb5OPW8xx2W
10+
GaV2a0wbE4gB2PTwwDvfo72mo9HXHZUHM1A84TD/RXMbAgMBAAGjUzBRMB0GA1Ud
11+
DgQWBBSEWXQ2JRD+OK7/KTmlD+OW16pGmzAfBgNVHSMEGDAWgBSEWXQ2JRD+OK7/
12+
KTmlD+OW16pGmzAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCF
13+
0zYRaabB3X0jzGI9/Lr3Phrb90GvoL1DFLRuiOuTlDkz0vrm/HrZskwHCgMNrkCj
14+
OTD9Vpas4D1QZBbQbRzfnf3OOoG4bgmcCwLFZl3dy27yIDAhrmbUP++g9l1Jmy4v
15+
vBR/M4lt2scQ8LcZYEPqhEaE5EzFQEjtaxDcKdWDNKY9W1NUzSIABhF9eHiAUNdH
16+
AFNJlYeBlCHxcWIeqgon184Dqp/CsvKtz3z3Ni+rlwPM/zuJCFHh1VF+z++0LJjG
17+
roBCV0Tro4XyiEz9yp7Cb5kQYMaj1KL9TqBG0tZx0pmv7y+lXc4TT6DEllXz6USy
18+
rbIba9/uUet3BqeIMTqj
19+
-----END CERTIFICATE-----

tests/functional/tests.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import io
2323
import csv
2424
import sys
25+
import tempfile
2526

2627
from sys import exit
2728
import uuid
@@ -895,22 +896,25 @@ def test_fget_object(client, log_output, sse=None):
895896
# default value for log_output.function attribute is;
896897
# log_output.function = "fget_object(bucket_name, object_name, file_path, request_headers)"
897898

899+
tmpfd, tmpfile = tempfile.mkstemp()
900+
os.close(tmpfd)
901+
898902
# Get a unique bucket_name and object_name
899903
log_output.args['bucket_name'] = bucket_name = generate_bucket_name()
900904
log_output.args['object_name'] = object_name = uuid.uuid4().__str__()
901-
log_output.args['file_path'] = newfile_f = 'newfile-f 新'
905+
log_output.args['file_path'] = tmpfile
902906
try:
903907
MB_1 = 1024*1024 # 1MiB.
904908
MB_1_reader = LimitedRandomReader(MB_1)
905909
client.make_bucket(bucket_name)
906910
client.put_object(bucket_name, object_name, MB_1_reader, MB_1, sse=sse)
907911
# Get/Download a full object and save locally at path
908-
client.fget_object(bucket_name, object_name, newfile_f, sse=sse)
912+
client.fget_object(bucket_name, object_name, tmpfile, sse=sse)
909913
except Exception as err:
910914
raise Exception(err)
911915
finally:
912916
try:
913-
os.remove(newfile_f)
917+
os.remove(tmpfile)
914918
client.remove_object(bucket_name, object_name)
915919
client.remove_bucket(bucket_name)
916920
except Exception as err:

0 commit comments

Comments
 (0)