test: unit tests clean up themselves #810
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/792"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
See #792.
$ABRA_DIRinstead of symlink'd$ABRA_DIR)@ -14,2 +15,2 @@testPkg.MkServerAppRecipe()defer testPkg.RmServerAppRecipe()integration.TestRecipeSetup()defer t.Cleanup(func() {Is the defer still needed?
Oh true, apparently not: https://pkg.go.dev/testing#B.Cleanup
I will check this when I look at it next 🤓 Thanks!
@ -0,0 +11,4 @@func TestRecipeTeardown() {abraDir := os.ExpandEnv("$ABRA_DIR")if abraDir == fmt.Sprintf("%s/.abra", os.Getenv("HOME")) {Why not put this in the setup function? Or maybe put it in both places, just to make sure
I call
TestRecipeTeardownas the first lineTestRecipeSetup, so it already is called twice? Happy to do whatever is clearer. I always end up getting confused by fancy test suite setup/teardowns and would welcome any tips!Ah ok, I overlooked that. It's fine with me then
wip: test: unit tests clean up themselvesto WIP: test: unit tests clean up themselvesebf0989ac2to2081465189WIP: test: unit tests clean up themselvesto test: unit tests clean up themselves2081465189to20cf3d75a720cf3d75a7to612a38df5a612a38df5atoa2708b3ab767f1a34e6dto369325e324369325e324toed1d961d07ed1d961d07to8ea78ee9fc8ea78ee9fctob252743042b252743042tof34d9a1e35f34d9a1e35to66a6aecc5f66a6aecc5ftob519b1984beeb29bb0bfto04d5bd113f04d5bd113fto04895fe7ae04895fe7aetod88b478503Wow, this has been an utterly frustrating experience discovering that we now have a race issue in our unit tests because Go parallelizes tests in a single module. This was causing different tests to try and destroy the only
$ABRA_DIRavailable while other tests were accessing it. I've made the tests not run in parallel which slows them down but Makes Shit Work Again ™️. I'll open an issue to track getting this back to high speed.