crystal-lang / shards

Dependency manager for the Crystal language
Other
758 stars 99 forks source link

Random spec failures while concurrent building #597

Open deiv opened 10 months ago

deiv commented 10 months ago

Hi,

Running the tests with make -j4 test (-jn > 1 will crash I guess), some specs fails randomly:

make[1]: se sale del directorio '/home/deiv/dev/debian/pkgs/crystal/shards/shards-new'
   dh_auto_test
        make -j4 test
make[1]: se entra en el directorio '/home/deiv/dev/debian/pkgs/crystal/shards/shards-new'
crystal spec ./spec/unit/
crystal spec ./spec/integration/

.Unhandled exception: command failed: git commit --allow-empty --no-gpg-sign -m 'release: v0.2.1': [master  -- fatal: unable to read tree a8d6cf8089e144c969898802a2fa7f9f64a86645
 (FailedCommand)
  from spec/support/factories.cr:378:5 in 'run'
  from spec/support/factories.cr:79:5 in 'create_git_commit'
  from spec/support/factories.cr:61:5 in 'create_git_version_commit'
  from spec/support/factories.cr:66:3 in 'create_git_release'
  from spec/support/factories.cr:35:29 in 'create_git_repository'
  from spec_helper.cr:25:3 in 'setup_repositories'
  from spec/integration/spec_helper.cr:15:3 in '->'
  from /usr/lib/crystal/lib/spec/context.cr:43:32 in 'run_before_all_hooks'
  from /usr/lib/crystal/lib/spec/context.cr:17:7 in 'internal_run'
  from /usr/lib/crystal/lib/spec/context.cr:158:7 in 'run'
  from /usr/lib/crystal/lib/spec/dsl.cr:212:7 in '->'
  from /usr/lib/crystal/lib/crystal/at_exit_handlers.cr:14:19 in 'run'
  from /usr/lib/crystal/lib/crystal/main.cr:64:14 in 'exit'
  from /usr/lib/crystal/lib/crystal/main.cr:59:5 in 'main'
  from /usr/lib/crystal/lib/crystal/main.cr:141:3 in 'main'
  from /lib/x86_64-linux-gnu/libc.so.6 in '??'
  from /lib/x86_64-linux-gnu/libc.so.6 in '__libc_start_main'

Probably because the temporal repositories are deleted between unit and integration tests.

If running each target separated, they work fine:

make $(make_options) test_unit
make $(make_options) test_integration
straight-shoota commented 10 months ago

I think having a global setup for test repositories is pretty bad. We should change that. My goal would be to move the setup code into each example (or example group if multiple ones share the same).