compose icon indicating copy to clipboard operation
compose copied to clipboard

Add Codecov

Open ulyssessouza opened this issue 3 years ago • 5 comments

What I did Add code coverage

Related issue

(not mandatory) A picture of a cute animal, if possible in relation with what you did

ulyssessouza avatar Sep 08 '22 16:09 ulyssessouza

@glours Hmmm... In the end, what happens is that e2e tests need to connect to the docker socket and I get an error: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

The thing is that we cannot mount it during the build. The other target can use it because it only runs unit tests. I even tried a RUN --mount=target=/var/run/docker.sock,rw but it doesn't work.

There is the solution of baking an e2e image and running it with -v /var/run/docker.sock:/var/run/docker.sock to be able to access it. But I think that would go around all the idea of having buildx set up.

ulyssessouza avatar Sep 14 '22 12:09 ulyssessouza

@crazy-max any idea ☝️ Do you have the same kind of e2e tests on the buildx side and if yes how did you address this issue?

glours avatar Sep 14 '22 13:09 glours

test-coverage in Dockerfile is just for unit test but yeah sandboxed unit test makes sense so this step could output coverage like we do in buildx: https://github.com/docker/buildx/blob/294421db9c3087561f44ff5a8dcdefde758e3c22/Dockerfile#L41-L45. See also bake target: https://github.com/docker/buildx/blob/294421db9c3087561f44ff5a8dcdefde758e3c22/docker-bake.hcl#L97-L101.

e2e tests need a runnable container so can't do this during build. Also mounting sockets is not supported atm on BuildKit afaik.

crazy-max avatar Sep 14 '22 15:09 crazy-max

@glours I think that in this case we can stay the way it is. WDYT?

ulyssessouza avatar Sep 16 '22 17:09 ulyssessouza

We can either keep it as is, or change the test-coverage Dockerfile target to run some other step without the e2e, it doesn't make sense to run the end-to-end tests just for test coverage.

laurazard avatar Sep 16 '22 18:09 laurazard

@laurazard Actually test-coverage doesn't run e2e tests, only unit tests. What we need to decide here is to what are we interested in mesuring.

ulyssessouza avatar Sep 29 '22 09:09 ulyssessouza