The Ubuntu package comes with a
clickhouse-server.service from the writers of the software itself. It does not do that test. You do that test, and if it fails do not run the commands that start or enable the service in the first place.
The clickhouse doco itself presents this as a standalone test that you do before going further, before proceeding to install the software and then run the service.
Try and build this in to the systemd service, using some sort of helper script or otherwise, and you'll end up with a service that terminates and auto-restarts continually. Note that even the old van Smoorenburg
rc script that the writers of the software supply does not actually abort trying to start the service if the check fails. The
exit has been commented out.