ros_services.go 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package integration
  2. import check "gopkg.in/check.v1"
  3. func (s *QemuSuite) TestRosLocalService(c *check.C) {
  4. s.RunQemu(c)
  5. // System-docker
  6. s.CheckCall(c, `echo "FROM $(sudo system-docker images --format '{{.Repository}}:{{.Tag}}' | grep os-base)" > Dockerfile
  7. sudo system-docker build -t testimage .`)
  8. s.CheckCall(c, `echo "test:" > test.yml
  9. echo " image: testimage" >> test.yml
  10. echo " entrypoint: ls" >> test.yml
  11. echo " labels:" >> test.yml
  12. echo " io.rancher.os.scope: system" >> test.yml
  13. echo " io.rancher.os.after: console" >> test.yml
  14. `)
  15. s.CheckCall(c, `sudo cp test.yml /var/lib/rancher/conf/test.yml`)
  16. s.CheckCall(c, `sudo ros service enable /var/lib/rancher/conf/test.yml`)
  17. s.CheckCall(c, `sudo ros service up test`)
  18. s.CheckCall(c, `sudo ros service logs test | grep bin`)
  19. }
  20. func (s *QemuSuite) TestRosLocalServiceUser(c *check.C) {
  21. s.RunQemu(c)
  22. // User-docker
  23. s.CheckCall(c, `echo "FROM alpine" > Dockerfile
  24. sudo docker build -t testimage .`)
  25. s.CheckCall(c, `echo "test:" > test.yml
  26. echo " image: testimage" >> test.yml
  27. echo " entrypoint: ls" >> test.yml
  28. echo " labels:" >> test.yml
  29. echo " io.rancher.os.scope: user" >> test.yml
  30. echo " io.rancher.os.after: console" >> test.yml
  31. `)
  32. s.CheckCall(c, `sudo cp test.yml /var/lib/rancher/conf/test.yml`)
  33. s.CheckCall(c, `sudo ros service enable /var/lib/rancher/conf/test.yml`)
  34. s.CheckCall(c, `sudo ros service up test`)
  35. s.CheckCall(c, `sudo ros service logs test | grep bin`)
  36. }