forked from docker-archive/classicswarm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bats
53 lines (40 loc) · 1.12 KB
/
build.bats
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env bats
load ../helpers
function teardown() {
swarm_manage_cleanup
stop_docker
}
@test "docker build" {
start_docker 2
swarm_manage
run docker_swarm images -q
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 0 ]
docker_swarm build -t test $TESTDATA/build
run docker_swarm images -q
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 1 ]
}
@test "docker build with arg" {
start_docker_with_busybox 2
swarm_manage
run docker_swarm build -t test_args --build-arg="greeting=Hello Args" $TESTDATA/build_with_args
[ "$status" -eq 0 ]
run docker_swarm run --rm test_args
[ "$status" -eq 0 ]
[[ "$output" == "Hello Args"* ]]
}
# Older versions of Docker daemons do not return the correct error message when
# building Windows images on Linux boxes
# See https://github.com/docker/swarm/issues/2689
@test "docker build with wrong OS" {
skip
start_docker 2
swarm_manage
run docker_swarm images -q
[ "$status" -eq 0 ]
[ "${#lines[@]}" -eq 0 ]
docker_swarm build -t testwin -f $TESTDATA/build/Dockerfile.win $TESTDATA/build
[ "$status" -eq 1 ]
[[ "$output" == *"Consider using --build-arg 'constraint:ostype==windows'"* ]]
}