Running Redis on Travis CI

只愿长相守 提交于 2019-12-07 20:09:43

问题


I just included a Redis Store in my Express application and got it to work.

I wanted to include this Redis Store in Travis CI for my code to keep working there. I read in the Travis Documentation that it is possible to start Redis, with the factory settings.

In my project, I don't use the factory settings, I wrote my own redis.conf file which specifies the port and the password.

So I added the following line to my .travis.yml file:

services:
  - redis-server --port 6380 --requirepass 'secret'

But this returns the following on Travis CI:

$ sudo service redis-server\ --port\ 6380\ --requirepass\ \'secret\' start
  redis-server --port 6380 --requirepass 'secret': unrecognized service

Is there any way to fix this?


回答1:


If you want to customize the option for Redis on Travis CI, I'd suggest not using the services section, but rather do this:

before_script: sudo redis-server /etc/redis/redis.conf --port 6380 --requirepass 'secret'

The services section runs services using their init/upstart scripts, which may not support the options you've added in there. The command is also escaped for security reasons, hence the documentation only hinting that you can list normal service names in that section.



来源:https://stackoverflow.com/questions/27297703/running-redis-on-travis-ci

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!