forked from plexsystems/sinker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
acceptance.bats
87 lines (67 loc) · 3.21 KB
/
acceptance.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bats
@test "[CHECK] Using manifest returns newer image" {
run ./sinker check --manifest example
[[ "$output" =~ "New versions for" ]]
}
@test "[CHECK] Using --images flag returns newer versions" {
run ./sinker check --images plexsystems/sinker-test:0.0.1
[[ "$output" =~ "New versions for" ]]
}
@test "[CREATE] New manifest with autodetection creates example manifest" {
run ./sinker create example/bundle.yaml --target mycompany.com/myrepo --manifest example/output.yaml
cmp -s "example/.images.yaml" "example/output.yaml"
rm -f example/output.yaml
}
@test "[CREATE] New manifest with autodetection image host different from target" {
run ./sinker create test/create/bundle.yaml --target myhost.com --output test/create/output.yaml
cmp -s "test/create/expected-images.yaml" "test/create/output.yaml"
rm -f test/create/output.yaml
}
@test "[UPDATE] Updating manifest matches expected manifest" {
run ./sinker update test/update/bundle.yaml --manifest test/update/original.yaml --output test/update/expected.yaml
git diff --quiet -- test/update/expected.yaml
}
@test "[LIST] List of source images matches example source list" {
run ./sinker list source --manifest example --output example/source.txt
git diff --quiet -- example/source.txt
}
@test "[LIST] List of target images matches example target list" {
run ./sinker list target --manifest example --output example/target.txt
git diff --quiet -- example/target.txt
}
@test "[LIST] List of source images matches expected output when target repository does not support nested repos" {
run ./sinker list source --manifest test/list --output test/list/expected-source.txt
git diff --quiet -- test/list/expected-source.txt
}
@test "[LIST] List of target images matches expected output when target repository does not support nested repos" {
run ./sinker list target --manifest test/list --output test/list/expected-target.txt
git diff --quiet -- test/list/expected-target.txt
}
@test "[PUSH] Using --dryrun flag lists missing images" {
run ./sinker push --dryrun --manifest test/push
[[ "$output" =~ "Image busybox:latest would be pushed as plexsystems/busybox:latest" ]]
}
@test "[PUSH] Using manifest all latest images successfully pushed" {
run ./sinker push --manifest test/push
[[ "$output" =~ "All images have been pushed!" ]]
}
@test "[PUSH] Using --images flag all latest images successfully pushed" {
run ./sinker push --images busybox:latest --target plexsystems
[[ "$output" =~ "All images have been pushed!" ]]
}
@test "[PULL] Using manifest pulls all images" {
docker rmi plexsystems/sinker-test:latest -f
docker rmi plexsystems/sinker-test:1.0.0 -f
run ./sinker pull target --manifest test/pull
[[ "$output" =~ "All images have been pulled!" ]]
docker inspect plexsystems/sinker-test:latest
docker inspect plexsystems/sinker-test:1.0.0
}
@test "[PULL] Using --images flag pulls all images" {
docker rmi plexsystems/sinker-test:latest -f
docker rmi plexsystems/sinker-test:1.0.0 -f
run ./sinker pull --images plexsystems/sinker-test:latest,plexsystems/sinker-test:1.0.0
[[ "$output" =~ "All images have been pulled!" ]]
docker inspect plexsystems/sinker-test:latest
docker inspect plexsystems/sinker-test:1.0.0
}