test: unit tests clean up themselves #810

Merged
decentral1se merged 1 commits from fix/792 into main 2026-04-01 08:55:07 +00:00
Owner

See #792.

  • Unit tests clean up and teardown themselves
  • Unit test helper imports are not circular anymore
  • Test recipe/server are copied into $ABRA_DIR instead of symlink'd
  • De-parallelize the tests to reduce flakiness (race issue accessing a single $ABRA_DIR)
See https://git.coopcloud.tech/toolshed/abra/issues/792. - [x] Unit tests clean up and teardown themselves - [x] Unit test helper imports are not circular anymore - [x] Test recipe/server are copied into `$ABRA_DIR` instead of symlink'd - [x] De-parallelize the tests to reduce flakiness (race issue accessing a single `$ABRA_DIR`)
decentral1se added 1 commit 2026-03-29 17:58:09 +00:00
wip: test: unit tests clean up themselves
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing
ebf0989ac2
See #792
p4u1 reviewed 2026-03-30 09:46:29 +00:00
@ -14,2 +15,2 @@
testPkg.MkServerAppRecipe()
defer testPkg.RmServerAppRecipe()
integration.TestRecipeSetup()
defer t.Cleanup(func() {
Owner

Is the defer still needed?

Is the defer still needed?
Author
Owner

Oh true, apparently not: https://pkg.go.dev/testing#B.Cleanup

I will check this when I look at it next 🤓 Thanks!

Oh true, apparently not: https://pkg.go.dev/testing#B.Cleanup I will check this when I look at it next 🤓 Thanks!
decentral1se marked this conversation as resolved
p4u1 reviewed 2026-03-30 09:48:42 +00:00
@ -0,0 +11,4 @@
func TestRecipeTeardown() {
abraDir := os.ExpandEnv("$ABRA_DIR")
if abraDir == fmt.Sprintf("%s/.abra", os.Getenv("HOME")) {
Owner

Why not put this in the setup function? Or maybe put it in both places, just to make sure

Why not put this in the setup function? Or maybe put it in both places, just to make sure
Author
Owner

I call TestRecipeTeardown as the first line TestRecipeSetup, 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!

I call `TestRecipeTeardown` as the first line `TestRecipeSetup`, 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!
Owner

Ah ok, I overlooked that. It's fine with me then

Ah ok, I overlooked that. It's fine with me then
decentral1se marked this conversation as resolved
decentral1se changed title from wip: test: unit tests clean up themselves to WIP: test: unit tests clean up themselves 2026-03-30 14:34:55 +00:00
decentral1se force-pushed fix/792 from ebf0989ac2 to 2081465189 2026-04-01 07:20:09 +00:00 Compare
decentral1se changed title from WIP: test: unit tests clean up themselves to test: unit tests clean up themselves 2026-04-01 07:20:18 +00:00
decentral1se force-pushed fix/792 from 2081465189 to 20cf3d75a7 2026-04-01 07:25:57 +00:00 Compare
decentral1se force-pushed fix/792 from 20cf3d75a7 to 612a38df5a 2026-04-01 07:32:02 +00:00 Compare
decentral1se force-pushed fix/792 from 612a38df5a to a2708b3ab7 2026-04-01 07:40:02 +00:00 Compare
decentral1se added 1 commit 2026-04-01 07:47:45 +00:00
WIP: wtf drone
Some checks failed
continuous-integration/drone/push Build is failing
67f1a34e6d
decentral1se force-pushed fix/792 from 67f1a34e6d to 369325e324 2026-04-01 07:51:32 +00:00 Compare
decentral1se force-pushed fix/792 from 369325e324 to ed1d961d07 2026-04-01 07:53:47 +00:00 Compare
decentral1se force-pushed fix/792 from ed1d961d07 to 8ea78ee9fc 2026-04-01 07:55:16 +00:00 Compare
decentral1se force-pushed fix/792 from 8ea78ee9fc to b252743042 2026-04-01 07:59:16 +00:00 Compare
decentral1se force-pushed fix/792 from b252743042 to f34d9a1e35 2026-04-01 08:08:10 +00:00 Compare
decentral1se force-pushed fix/792 from f34d9a1e35 to 66a6aecc5f 2026-04-01 08:15:00 +00:00 Compare
decentral1se force-pushed fix/792 from 66a6aecc5f to b519b1984b 2026-04-01 08:25:03 +00:00 Compare
decentral1se added 1 commit 2026-04-01 08:31:10 +00:00
WIP: moar wtf drone
All checks were successful
continuous-integration/drone/push Build is passing
eeb29bb0bf
decentral1se force-pushed fix/792 from eeb29bb0bf to 04d5bd113f 2026-04-01 08:34:48 +00:00 Compare
decentral1se force-pushed fix/792 from 04d5bd113f to 04895fe7ae 2026-04-01 08:46:01 +00:00 Compare
decentral1se force-pushed fix/792 from 04895fe7ae to d88b478503 2026-04-01 08:48:00 +00:00 Compare
Author
Owner

Wow, 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_DIR available 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.

Wow, 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_DIR` available 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.
decentral1se merged commit d88b478503 into main 2026-04-01 08:55:07 +00:00
decentral1se deleted branch fix/792 2026-04-01 08:55:56 +00:00
Sign in to join this conversation.
No description provided.