1
0
mirror of https://github.com/rancher/os.git synced 2025-09-19 00:59:53 +00:00

Don't pull an image that is already local

Signed-off-by: Sven Dowideit <SvenDowideit@home.org.au>
This commit is contained in:
Sven Dowideit
2017-07-20 22:28:18 +10:00
parent 0ecdfff839
commit 3de5a836c9
3 changed files with 57 additions and 5 deletions

View File

@@ -5,10 +5,11 @@ import . "gopkg.in/check.v1"
func (s *QemuSuite) TestRosLocalService(c *C) {
s.RunQemu(c)
// System-docker
s.CheckCall(c, `echo "FROM $(sudo system-docker images --format '{{.Repository}}:{{.Tag}}' | grep os-base)" > Dockerfile
sudo system-docker build -t testimage .
sudo system-docker build -t testimage .`)
echo "test:" > test.yml
s.CheckCall(c, `echo "test:" > test.yml
echo " image: testimage" >> test.yml
echo " entrypoint: ls" >> test.yml
echo " labels:" >> test.yml
@@ -18,7 +19,29 @@ echo " io.rancher.os.after: console" >> test.yml
s.CheckCall(c, `sudo cp test.yml /var/lib/rancher/conf/test.yml`)
s.CheckCall(c, `sudo ros service enable /var/lib/rancher/conf/test.yml`)
s.CheckCall(c, `sudo ros service up /var/lib/rancher/conf/test.yml`)
s.CheckCall(c, `sudo ros service up test`)
s.CheckCall(c, `sudo ros service logs test | grep bin`)
}
func (s *QemuSuite) TestRosLocalServiceUser(c *C) {
s.RunQemu(c)
// User-docker
s.CheckCall(c, `echo "FROM alpine" > Dockerfile
sudo docker build -t testimage .`)
s.CheckCall(c, `echo "test:" > test.yml
echo " image: testimage" >> test.yml
echo " entrypoint: ls" >> test.yml
echo " labels:" >> test.yml
echo " io.rancher.os.scope: user" >> test.yml
echo " io.rancher.os.after: console" >> test.yml
`)
s.CheckCall(c, `sudo cp test.yml /var/lib/rancher/conf/test.yml`)
s.CheckCall(c, `sudo ros service enable /var/lib/rancher/conf/test.yml`)
s.CheckCall(c, `sudo ros service up test`)
s.CheckCall(c, `sudo ros service logs test | grep bin`)
}