Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
docker-py
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
docker-py
Commits
c6d1c2dc
Kaydet (Commit)
c6d1c2dc
authored
Ara 09, 2016
tarafından
Joffrey F
Kaydeden (comit)
GitHub
Ara 09, 2016
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Sade Fark
Merge pull request #1342 from docker/jenkinsfile
Add Jenkinsfile for integration tests matrix
üst
d024b1bd
48c5cd82
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
121 additions
and
19 deletions
+121
-19
Jenkinsfile
Jenkinsfile
+88
-0
helpers.py
tests/helpers.py
+4
-0
api_service_test.py
tests/integration/api_service_test.py
+1
-1
api_swarm_test.py
tests/integration/api_swarm_test.py
+13
-15
base.py
tests/integration/base.py
+6
-0
models_nodes_test.py
tests/integration/models_nodes_test.py
+3
-1
models_services_test.py
tests/integration/models_services_test.py
+1
-1
models_swarm_test.py
tests/integration/models_swarm_test.py
+5
-1
No files found.
Jenkinsfile
0 → 100644
Dosyayı görüntüle @
c6d1c2dc
#
!
groovy
def
imageNameBase
=
"dockerbuildbot/docker-py"
def
imageNamePy2
def
imageNamePy3
def
images
=
[:]
def
dockerVersions
=
[
"1.12.0"
,
"1.13.0-rc3"
]
def
buildImage
=
{
name
,
buildargs
,
pyTag
->
img
=
docker
.
image
(
name
)
try
{
img
.
pull
()
}
catch
(
Exception
exc
)
{
img
=
docker
.
build
(
name
,
buildargs
)
img
.
push
()
}
images
[
pyTag
]
=
img
.
id
}
def
buildImages
=
{
->
wrappedNode
(
label:
"ubuntu && !zfs && amd64"
,
cleanWorkspace:
true
)
{
stage
(
"build image"
)
{
checkout
(
scm
)
imageNamePy2
=
"${imageNameBase}:py2-${gitCommit()}"
imageNamePy3
=
"${imageNameBase}:py3-${gitCommit()}"
buildImage
(
imageNamePy2
,
"."
,
"py2.7"
)
buildImage
(
imageNamePy3
,
"-f Dockerfile-py3 ."
,
"py3.5"
)
}
}
}
def
runTests
=
{
Map
settings
->
def
dockerVersion
=
settings
.
get
(
"dockerVersion"
,
null
)
def
pythonVersion
=
settings
.
get
(
"pythonVersion"
,
null
)
def
testImage
=
settings
.
get
(
"testImage"
,
null
)
if
(!
testImage
)
{
throw
new
Exception
(
"Need test image object, e.g.: `runTests(testImage: img)`"
)
}
if
(!
dockerVersion
)
{
throw
new
Exception
(
"Need Docker version to test, e.g.: `runTests(dockerVersion: '1.12.3')`"
)
}
if
(!
pythonVersion
)
{
throw
new
Exception
(
"Need Python version being tested, e.g.: `runTests(pythonVersion: 'py2.7')`"
)
}
{
->
wrappedNode
(
label:
"ubuntu && !zfs && amd64"
,
cleanWorkspace:
true
)
{
stage
(
"test python=${pythonVersion} / docker=${dockerVersion}"
)
{
checkout
(
scm
)
def
dindContainerName
=
"dpy-dind-\$BUILD_NUMBER-\$EXECUTOR_NUMBER"
def
testContainerName
=
"dpy-tests-\$BUILD_NUMBER-\$EXECUTOR_NUMBER"
try
{
sh
"""docker run -d --name ${dindContainerName} -v /tmp --privileged \\
dockerswarm/dind:${dockerVersion} docker daemon -H tcp://0.0.0.0:2375
"""
sh
"""docker run \\
--name ${testContainerName} --volumes-from ${dindContainerName} \\
-e 'DOCKER_HOST=tcp://docker:2375' \\
--link=${dindContainerName}:docker \\
${testImage} \\
py.test -v -rxs tests/integration
"""
}
finally
{
sh
"""
docker stop ${dindContainerName} ${testContainerName}
docker rm -vf ${dindContainerName} ${testContainerName}
"""
}
}
}
}
}
buildImages
()
def
testMatrix
=
[
failFast:
false
]
for
(
imgKey
in
new
ArrayList
(
images
.
keySet
()))
{
for
(
version
in
dockerVersions
)
{
testMatrix
[
"${imgKey}_${version}"
]
=
runTests
([
testImage:
images
[
imgKey
],
dockerVersion:
version
,
pythonVersion:
imgKey
])
}
}
parallel
(
testMatrix
)
tests/helpers.py
Dosyayı görüntüle @
c6d1c2dc
...
@@ -74,3 +74,7 @@ def force_leave_swarm(client):
...
@@ -74,3 +74,7 @@ def force_leave_swarm(client):
continue
continue
else
:
else
:
return
return
def
swarm_listen_addr
():
return
'0.0.0.0:{0}'
.
format
(
random
.
randrange
(
10000
,
25000
))
tests/integration/api_service_test.py
Dosyayı görüntüle @
c6d1c2dc
...
@@ -10,7 +10,7 @@ class ServiceTest(BaseAPIIntegrationTest):
...
@@ -10,7 +10,7 @@ class ServiceTest(BaseAPIIntegrationTest):
def
setUp
(
self
):
def
setUp
(
self
):
super
(
ServiceTest
,
self
)
.
setUp
()
super
(
ServiceTest
,
self
)
.
setUp
()
self
.
client
.
leave_swarm
(
force
=
True
)
self
.
client
.
leave_swarm
(
force
=
True
)
self
.
client
.
init_swarm
(
'eth0'
)
self
.
init_swarm
(
)
def
tearDown
(
self
):
def
tearDown
(
self
):
super
(
ServiceTest
,
self
)
.
tearDown
()
super
(
ServiceTest
,
self
)
.
tearDown
()
...
...
tests/integration/api_swarm_test.py
Dosyayı görüntüle @
c6d1c2dc
...
@@ -17,39 +17,37 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -17,39 +17,37 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_init_swarm_simple
(
self
):
def
test_init_swarm_simple
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_init_swarm_force_new_cluster
(
self
):
def
test_init_swarm_force_new_cluster
(
self
):
pytest
.
skip
(
'Test stalls the engine on 1.12.0'
)
pytest
.
skip
(
'Test stalls the engine on 1.12.0'
)
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
version_1
=
self
.
client
.
inspect_swarm
()[
'Version'
][
'Index'
]
version_1
=
self
.
client
.
inspect_swarm
()[
'Version'
][
'Index'
]
assert
self
.
client
.
init_swarm
(
'eth0'
,
force_new_cluster
=
True
)
assert
self
.
client
.
init_swarm
(
force_new_cluster
=
True
)
version_2
=
self
.
client
.
inspect_swarm
()[
'Version'
][
'Index'
]
version_2
=
self
.
client
.
inspect_swarm
()[
'Version'
][
'Index'
]
assert
version_2
!=
version_1
assert
version_2
!=
version_1
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_init_already_in_cluster
(
self
):
def
test_init_already_in_cluster
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
with
pytest
.
raises
(
docker
.
errors
.
APIError
):
with
pytest
.
raises
(
docker
.
errors
.
APIError
):
self
.
client
.
init_swarm
(
'eth0'
)
self
.
init_swarm
(
)
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_init_swarm_custom_raft_spec
(
self
):
def
test_init_swarm_custom_raft_spec
(
self
):
spec
=
self
.
client
.
create_swarm_spec
(
spec
=
self
.
client
.
create_swarm_spec
(
snapshot_interval
=
5000
,
log_entries_for_slow_followers
=
1200
snapshot_interval
=
5000
,
log_entries_for_slow_followers
=
1200
)
)
assert
self
.
client
.
init_swarm
(
assert
self
.
init_swarm
(
swarm_spec
=
spec
)
advertise_addr
=
'eth0'
,
swarm_spec
=
spec
)
swarm_info
=
self
.
client
.
inspect_swarm
()
swarm_info
=
self
.
client
.
inspect_swarm
()
assert
swarm_info
[
'Spec'
][
'Raft'
][
'SnapshotInterval'
]
==
5000
assert
swarm_info
[
'Spec'
][
'Raft'
][
'SnapshotInterval'
]
==
5000
assert
swarm_info
[
'Spec'
][
'Raft'
][
'LogEntriesForSlowFollowers'
]
==
1200
assert
swarm_info
[
'Spec'
][
'Raft'
][
'LogEntriesForSlowFollowers'
]
==
1200
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_leave_swarm
(
self
):
def
test_leave_swarm
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
with
pytest
.
raises
(
docker
.
errors
.
APIError
)
as
exc_info
:
with
pytest
.
raises
(
docker
.
errors
.
APIError
)
as
exc_info
:
self
.
client
.
leave_swarm
()
self
.
client
.
leave_swarm
()
exc_info
.
value
.
response
.
status_code
==
500
exc_info
.
value
.
response
.
status_code
==
500
...
@@ -61,7 +59,7 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -61,7 +59,7 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_update_swarm
(
self
):
def
test_update_swarm
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
swarm_info_1
=
self
.
client
.
inspect_swarm
()
swarm_info_1
=
self
.
client
.
inspect_swarm
()
spec
=
self
.
client
.
create_swarm_spec
(
spec
=
self
.
client
.
create_swarm_spec
(
snapshot_interval
=
5000
,
log_entries_for_slow_followers
=
1200
,
snapshot_interval
=
5000
,
log_entries_for_slow_followers
=
1200
,
...
@@ -92,7 +90,7 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -92,7 +90,7 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_update_swarm_name
(
self
):
def
test_update_swarm_name
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
swarm_info_1
=
self
.
client
.
inspect_swarm
()
swarm_info_1
=
self
.
client
.
inspect_swarm
()
spec
=
self
.
client
.
create_swarm_spec
(
spec
=
self
.
client
.
create_swarm_spec
(
node_cert_expiry
=
7776000000000000
,
name
=
'reimuhakurei'
node_cert_expiry
=
7776000000000000
,
name
=
'reimuhakurei'
...
@@ -110,7 +108,7 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -110,7 +108,7 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_list_nodes
(
self
):
def
test_list_nodes
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
nodes_list
=
self
.
client
.
nodes
()
nodes_list
=
self
.
client
.
nodes
()
assert
len
(
nodes_list
)
==
1
assert
len
(
nodes_list
)
==
1
node
=
nodes_list
[
0
]
node
=
nodes_list
[
0
]
...
@@ -129,7 +127,7 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -129,7 +127,7 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_inspect_node
(
self
):
def
test_inspect_node
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
nodes_list
=
self
.
client
.
nodes
()
nodes_list
=
self
.
client
.
nodes
()
assert
len
(
nodes_list
)
==
1
assert
len
(
nodes_list
)
==
1
node
=
nodes_list
[
0
]
node
=
nodes_list
[
0
]
...
@@ -139,7 +137,7 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -139,7 +137,7 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_update_node
(
self
):
def
test_update_node
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
nodes_list
=
self
.
client
.
nodes
()
nodes_list
=
self
.
client
.
nodes
()
node
=
nodes_list
[
0
]
node
=
nodes_list
[
0
]
orig_spec
=
node
[
'Spec'
]
orig_spec
=
node
[
'Spec'
]
...
@@ -162,7 +160,7 @@ class SwarmTest(BaseAPIIntegrationTest):
...
@@ -162,7 +160,7 @@ class SwarmTest(BaseAPIIntegrationTest):
@requires_api_version
(
'1.24'
)
@requires_api_version
(
'1.24'
)
def
test_remove_main_node
(
self
):
def
test_remove_main_node
(
self
):
assert
self
.
client
.
init_swarm
(
'eth0'
)
assert
self
.
init_swarm
(
)
nodes_list
=
self
.
client
.
nodes
()
nodes_list
=
self
.
client
.
nodes
()
node_id
=
nodes_list
[
0
][
'ID'
]
node_id
=
nodes_list
[
0
][
'ID'
]
with
pytest
.
raises
(
docker
.
errors
.
NotFound
):
with
pytest
.
raises
(
docker
.
errors
.
NotFound
):
...
...
tests/integration/base.py
Dosyayı görüntüle @
c6d1c2dc
...
@@ -5,6 +5,7 @@ import docker
...
@@ -5,6 +5,7 @@ import docker
from
docker.utils
import
kwargs_from_env
from
docker.utils
import
kwargs_from_env
import
six
import
six
from
..
import
helpers
BUSYBOX
=
'busybox:buildroot-2014.02'
BUSYBOX
=
'busybox:buildroot-2014.02'
...
@@ -90,3 +91,8 @@ class BaseAPIIntegrationTest(BaseIntegrationTest):
...
@@ -90,3 +91,8 @@ class BaseAPIIntegrationTest(BaseIntegrationTest):
msg
=
"Expected `{}` to exit with code {} but returned {}:
\n
{}"
.
format
(
msg
=
"Expected `{}` to exit with code {} but returned {}:
\n
{}"
.
format
(
" "
.
join
(
cmd
),
exit_code
,
actual_exit_code
,
output
)
" "
.
join
(
cmd
),
exit_code
,
actual_exit_code
,
output
)
assert
actual_exit_code
==
exit_code
,
msg
assert
actual_exit_code
==
exit_code
,
msg
def
init_swarm
(
self
,
**
kwargs
):
return
self
.
client
.
init_swarm
(
'eth0'
,
listen_addr
=
helpers
.
swarm_listen_addr
(),
**
kwargs
)
tests/integration/models_nodes_test.py
Dosyayı görüntüle @
c6d1c2dc
import
unittest
import
unittest
import
docker
import
docker
from
..
import
helpers
from
..
import
helpers
...
@@ -12,7 +14,7 @@ class NodesTest(unittest.TestCase):
...
@@ -12,7 +14,7 @@ class NodesTest(unittest.TestCase):
def
test_list_get_update
(
self
):
def
test_list_get_update
(
self
):
client
=
docker
.
from_env
()
client
=
docker
.
from_env
()
client
.
swarm
.
init
()
client
.
swarm
.
init
(
listen_addr
=
helpers
.
swarm_listen_addr
()
)
nodes
=
client
.
nodes
.
list
()
nodes
=
client
.
nodes
.
list
()
assert
len
(
nodes
)
==
1
assert
len
(
nodes
)
==
1
assert
nodes
[
0
]
.
attrs
[
'Spec'
][
'Role'
]
==
'manager'
assert
nodes
[
0
]
.
attrs
[
'Spec'
][
'Role'
]
==
'manager'
...
...
tests/integration/models_services_test.py
Dosyayı görüntüle @
c6d1c2dc
...
@@ -11,7 +11,7 @@ class ServiceTest(unittest.TestCase):
...
@@ -11,7 +11,7 @@ class ServiceTest(unittest.TestCase):
def
setUpClass
(
cls
):
def
setUpClass
(
cls
):
client
=
docker
.
from_env
()
client
=
docker
.
from_env
()
helpers
.
force_leave_swarm
(
client
)
helpers
.
force_leave_swarm
(
client
)
client
.
swarm
.
init
()
client
.
swarm
.
init
(
listen_addr
=
helpers
.
swarm_listen_addr
()
)
@classmethod
@classmethod
def
tearDownClass
(
cls
):
def
tearDownClass
(
cls
):
...
...
tests/integration/models_swarm_test.py
Dosyayı görüntüle @
c6d1c2dc
import
unittest
import
unittest
import
docker
import
docker
from
..
import
helpers
from
..
import
helpers
...
@@ -12,7 +14,9 @@ class SwarmTest(unittest.TestCase):
...
@@ -12,7 +14,9 @@ class SwarmTest(unittest.TestCase):
def
test_init_update_leave
(
self
):
def
test_init_update_leave
(
self
):
client
=
docker
.
from_env
()
client
=
docker
.
from_env
()
client
.
swarm
.
init
(
snapshot_interval
=
5000
)
client
.
swarm
.
init
(
snapshot_interval
=
5000
,
listen_addr
=
helpers
.
swarm_listen_addr
()
)
assert
client
.
swarm
.
attrs
[
'Spec'
][
'Raft'
][
'SnapshotInterval'
]
==
5000
assert
client
.
swarm
.
attrs
[
'Spec'
][
'Raft'
][
'SnapshotInterval'
]
==
5000
client
.
swarm
.
update
(
snapshot_interval
=
10000
)
client
.
swarm
.
update
(
snapshot_interval
=
10000
)
assert
client
.
swarm
.
attrs
[
'Spec'
][
'Raft'
][
'SnapshotInterval'
]
==
10000
assert
client
.
swarm
.
attrs
[
'Spec'
][
'Raft'
][
'SnapshotInterval'
]
==
10000
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment