When running the test suite locally, it takes 2-5 minutes to complete. This is mostly due to a shards build on this line
crystal specExpected behavior: [What you expect to happen]
The full test suite to run more quickly on local development machine (under a minute, hopefully under 10 seconds)
Actual behavior: [What actually happens]
The full test suite takes several minutes to run.
Reproduces how often: [What percentage of the time does it reproduce?]
Every time you run crystal spec
amber v0.3.0
In gitter we discussed taking the following approach:
Either using an environment variable or option flag.
@eliasjpr @elorest - Please weigh in
That test proves the generated code actually works which I feel is important. Possibly having a flag to turn it off and on is a good idea. Tests take 1:28 minutes to complete as they are on my development box. Usually for development though I just run specific tests while developing and then the complete suite before pushing.
I think it depends on your internet connection:
With build
Finished in 2:25 minutes
336 examples, 0 failures, 0 errors, 0 pending
real 2m38.068s
user 1m28.255s
sys 0m13.785s
Without build:
Finished in 574.5 milliseconds
336 examples, 0 failures, 0 errors, 0 pending
real 0m19.855s
user 0m36.337s
sys 0m3.854s
I got some info from the Crystal gitter about how to possibly do this:
{% if flag?(:slow_test) %} require "./slow/*" {% end %}
and it sounds like -D allows you to pass option flags.
As an extension to this issue, I think isolating a build test file that is separate and isolated is a good idea. We can have it be a large integration test for the CLI - generate a new app, generate at least one of everything possible to generate, then build.
That way, if anything introduces a compile time error, it should show up.
I noticed that the shards build test is compiling not only the test_app but also amber. I spend sometime to try to figure out the reason why is building amber. But maybe someone have insight of this already.
@eliasjpr If you are referring the build target, this is used by docker to build the correct version of amber instead of trying to use a pre-built one and getting version mismatches.
https://github.com/amberframework/amber/blob/master/src/amber/cli/templates/app/Dockerfile.ecr#L16
Check the shard.yml file in a generated app. It has:
targets:
...
amber:
main: lib/amber/src/amber/cli.cr
I'm assuming that triggers a build.
@marksiemers correct
why do we have that? That can be remove no? That does not make sense to have in a generate app since the Amber CLI should be installed by the time the app is generated
Addressed in the following repo and PRs
https://github.com/amberframework/amber-specshards build test_appResolved with #381 #354 #344
Most helpful comment
I think it depends on your internet connection:
With build
Without build: