Happy Friday all. How does everyone handle their t...
# testing
j
Happy Friday all. How does everyone handle their tests as far as version control is concerned? Same repo as the code or a separate repo? If the same, what's the best way to keep the tests out of production? The best I've come up with so far is adding something to our deployment script to just remove the tests directory in prod.
j
The best way varies on your deployment style @joechastain. How does your team deploy code to production? Knowing that would be a great foundation for suggesting possible best practices. ( Personal take: create artifacts that get deployed to servers... don't deploy raw. Using artifacts allows us to see what was deployed and perhaps even serve to log things we may want to go back and look at later. Docker images moved me in this direction. )
j
We're not in containerland yet. We just run a shell script that pulls from the main branch on Gitlab and does a few other odds and ends.
j
What about selectively copy vs delete? Is there a way to do a filtered select?
j
Yeah, that's a good question. I've never tried to do that with a git pull. Not sure if you can exclude directories that way or not. I'll dig into that.
j
P.S. You also can put something in your Application.cfc to not run unless certain parameters are met. The goal, unless it is these environments, ABORT! 🙂 That is a good safety net for having more than one way to prevent production run testing.
t
We keep our tests in the same repo (and I think most people would)--- otherwise it seems like keeping the tests in sync with the code would be super difficult.
But we keep the tests in a separate, mirrored, directory structure. And our deployment scripts don't copy that folder to production.
a
We have them in the same repo, and we deploy everything to prod. The tests aren't reachable from the outside world. This however is a legacy approach, and in a world where I had more time, we'd be taking John's suggested approach: only release to prod what is supposed to be on prod. Test code is not supposed to be on prod.
j
Thanks all. Really appreciate the responses.