Help
cancel
Showing results for 
Search instead for 
Did you mean: 
573
Copilot Lvl 3
Message 1 of 7

redis-server available to redis-cli but not to spec test?

Solved! Go to Solution.

I have set up a workflow that extracts a nix via cachix/install-nix-action@v6 and then in the run step spawns a nix-installed redis-server, sends a ping to that server and starts a nix-build using my project's default.nix.

 

When approaching the spec tests my build fails though saying the redis-server might not be available (https://github.com/573/shorturls/commit/1a17a260a003dcf1dd745efdccb52f7e251d0cd9/checks?check_suite_...)

6 Replies
Highlighted
GitHub Partner
Message 2 of 7

Re: redis-server available to redis-cli but not to spec test?

Can you run your tests successfully in your local machine? If it works, could you please set up a self-hosted agent to run your workflow? Will the self-hosted agent managed to work?  

Also, you could create an issue in https://github.com/cachix/cachix-action/issues.

Highlighted
573
Copilot Lvl 3
Message 3 of 7

Re: redis-server available to redis-cli but not to spec test?

Yes, locally the tests are run well.

I even attempted - locally - to start the redis-server with a redis.conf file of mine to start it in unix sockets mode, which also works - locally and with minor changes to my client code.

When trying to replicate the unix sockets starting approach in github workflow by adding the "CMD override" to the services section / options (see this discussion) I got the same error as before. Maybe the CMD override simply doesn't work as I thought.

 

What do you mean by self-hosted agent ?

 

I already got some feedback on doing integration-testing using nix over at discourse which lead me to believe that the only option I have for now with my sparse knowledge is to try and start redis-server that way I described above.

What do you think it is possible ?

 

Anyway, thank you for your feedback, didn't see it soon enough, as I had notification not yet enabled.

 

 

Highlighted
GitHub Partner
Message 4 of 7

Re: redis-server available to redis-cli but not to spec test?

Sorry for the delay response.

Self-hosted agent is installed on your local machine. You could see more detail information in this document: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/about-self-hosted-ru...

I was working on reproduce your issue in my self-hosted runner in the last few days. I install redis-server in my self-hosted machine and keep it running. But I still got this Newwork.Socket.connect error. I don’t think starting redis-server could resolve this issue.  

socket error .png

I just saw that the last workflow run in your repo 573/nix-github-integration-tests succeeded . Do you still meet the problem which you report in your original post?  

Highlighted
573
Copilot Lvl 3
Message 5 of 7

Re: redis-server available to redis-cli but not to spec test?

573/nix-github-integration-tests is another repo, I was trying to make use of nixos/tests because I initially thought this could lead to a solution which it does not as nixos/tests seems reportedly fitted to run service to service tests only.

I am investigating further in the direction given there and will inform you in case of a result soon.

As far as I can guess the error does seem to have nothing to do with github actions but more with nix not allowing this kind of integration testing approach.

Highlighted
Solution
573
Copilot Lvl 3
Message 6 of 7

Re: redis-server available to redis-cli but not to spec test?

Hello Yanjingzhu,

 

for a solution to my problem described above pls see https://discourse.nixos.org/t/how-can-i-spawn-a-redis-instance-within-a-nix-build/5155/10?u=573 or even my repository.

There is indeed nothing wrong with Github Actions, sorry for the fuzz.

What needed to be done was running the service to be tested against within (ll. 22) the isolated build.

Highlighted
GitHub Partner
Message 7 of 7

Re: redis-server available to redis-cli but not to spec test?

I am so glad to hear that you have resolved your issue. If you have any other Github Actions questions, welcome to github community forum again.