Fwiw at least xtc and coke can be legally tested in the Netherlands. https://www.drugs-test.nl/en/testlocations/
Also, these tests are set up in a way that they are anonymous in a way that e.g. even if prosecutors could subpoena a test-location or lab to hand over administration, this administration won't contain any PII or even pseudonymous information.
The only thing they don't test are things you can somehow get legally, if I recall correctly (so whatever you can get for any psychological condition).