gluster / gluster-containers

Dockerfiles (CentOS, Fedora, Red Hat) for GlusterFS
https://github.com/gluster/gluster-containers/pkgs/container/gluster-containers
223 stars 135 forks source link

[tests] Add tests for the container images #185

Closed black-dragon74 closed 2 years ago

black-dragon74 commented 2 years ago

Added the basic container tests. Any additions or suggestions are welcome.

We run this on PR only or also on push? I think running it again on push would be redundant as we already would have ran the tests on PR.

I will remove the tests from push action and integrate them here into upcoming action. So here's how GH actions will work (proposed):

On PR:

On Push/Merge:

/cc: @mscherer @nixpanic

Regards

Signed-off-by: black-dragon74 niryadav@redhat.com

mscherer commented 2 years ago

I would build on PR as well, just not push it.

I think it might also be helpful to rebuild the container on a weekly basis, to get the latest fix. I use that to rebuild a container on a schedule + one trick to build on latest Fedora

And I think running on push can be useful, in case someone push without PR.

black-dragon74 commented 2 years ago

I would build on PR as well, just not push it.

We do that already. We lint, build, run and cleanup on PRs. We just build and push to registry on merge.

I think it might also be helpful to rebuild the container on a weekly basis

But wouldn't the action responsible for publishing release on push would already keep the image up to date?

And I think running on push can be useful, in case someone push without PR.

Alright, will add the tests on push too.

Thanks for the input.

Regards

black-dragon74 commented 2 years ago

Sample run (pass):

Running tests for container centos-test, building from ../CentOS
Building image for centos-test
Sending build context to Docker daemon  32.77kB
..... (steps 1-28) .....
Successfully built ec217da65f55
Successfully tagged centos-test:latest
Trying to run the built image
f764ca36d1aafb72da9c4f1e4fe88a992eddfe63a7d8b66a8f32f7310ba6ca27
Container started. Sleeping for 15 seconds to let it boot.
Checking glusterd status in the built image
active
Successfully completed running tests for container centos-test
centos-test
Untagged: centos-test:latest

Sample run (fail):

Running tests for container centos-test, building from ../CentOS
Building image for centos-test
Sending build context to Docker daemon  32.77kB
..... (steps 1-28) .....
Successfully built ec217da65f55
Successfully tagged centos-test:latest
Trying to run the built image
ea3c61903366e9445483eca511dd63dec4f722f27215afa3b2937b03eaaf7f23
Container started. Sleeping for 15 seconds to let it boot.
Checking glusterd status in the built image
inactive
glusterd is not running in the container
Tests for container centos-test failed! Cleaning up.
centos-test
Untagged: centos-test:latest

Regards

black-dragon74 commented 2 years ago

I hope you can easily include this in a GitHub Action so that each PR gets tested.

Sure. That's the next step.

Regards