aboutsummaryrefslogtreecommitdiff
path: root/test/kpod_pull.bats
blob: 4cad2390f0f6099230cf7caf203d5410ac6604ea (plain)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#!/usr/bin/env bats

load helpers

IMAGE="alpine:latest"

function teardown() {
  cleanup_test
}

@test "kpod pull from docker with tag" {
	run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian:6.0.10
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull from docker without tag" {
	run ${KPOD_BINARY} $KPOD_OPTIONS pull debian
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi debian
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull from a non-docker registry with tag" {
	run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora:rawhide
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora:rawhide
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull from a non-docker registry without tag" {
	run ${KPOD_BINARY} $KPOD_OPTIONS pull registry.fedoraproject.org/fedora
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi registry.fedoraproject.org/fedora
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull using digest" {
	run ${KPOD_BINARY} $KPOD_OPTIONS pull alpine@sha256:1072e499f3f655a032e88542330cf75b02e7bdf673278f701d7ba61629ee3ebe
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi alpine:latest
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull from a non existent image" {
	run ${KPOD_BINARY} $KPOD_OPTIONS pull umohnani/get-started
	echo "$output"
	[ "$status" -ne 0 ]
}

@test "kpod pull from docker with shortname" {
	run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:latest
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull from docker with shortname and tag" {
	run ${KPOD_BINARY} ${KPOD_OPTIONS} pull debian:6.0.10
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} $KPOD_OPTIONS rmi docker.io/debian:6.0.10
	echo "$output"
	[ "$status" -eq 0 ]
}

@test "kpod pull from docker-archive" {
	run ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save -o alp.tar alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull docker-archive:alp.tar
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
	echo "$output"
	[ "$status" -eq 0 ]
	rm -f alp.tar
}

@test "kpod pull from oci-archive" {
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} save --format oci-archive -o oci-alp.tar alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull oci-archive:oci-alp.tar
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
	echo "$output"
	[ "$status" -eq 0 ]
	rm -f oci-alp.tar
}

@test "kpod pull from local directory" {
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run mkdir test_pull_dir
	echo "$output"
    [ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} push alpine dir:test_pull_dir
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi alpine
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} pull dir:test_pull_dir
	echo "$output"
	[ "$status" -eq 0 ]
	run bash -c ${KPOD_BINARY} ${KPOD_OPTIONS} rmi test_pull_dir
	echo "$output"
	[ "$status" -eq 0 ]
	rm -rf test_pull_dir
}