Issue03 test and coverage thresholds#28
Open
jhenligne wants to merge 13 commits intocollegevine:masterfrom
Open
Issue03 test and coverage thresholds#28jhenligne wants to merge 13 commits intocollegevine:masterfrom
jhenligne wants to merge 13 commits intocollegevine:masterfrom
Conversation
50bb70d to
e465c0b
Compare
…/jhenligne/confcrypt into issue03-test-coverage-thresholds
…ling pcre-light-0.4.0.4 package. Trying another way.
…tion syntax. Also trying to cache packages install to speed up tests
…e are not typos locally)
Contributor
Author
|
I will try to install CircleCI with Docker locally to debug this install setup. Meanwhile if you know how to fix this problem you are welcome. |
…igne/confcrypt". CircleCI's config.yml cleaned accordingly.
Contributor
Author
|
Integration done, failing test because code coverage under threshold: @ChrisCoffey This PR is ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Here are explanations about thresholds implementation and CircleCI integration.
Test coverage threshold
Use of
hpc-thresholdhpc-threshold utility implements desired behavior.
Setup is straightforward:
$ stack install hpc-threshold.hpc-thresholdconfiguration file (threshold already set to 80%)$ stack test :confcrypt-detailed-tests --coveragestack hpc report --all 2>&1 | hpc-thresholdResults as of February 5, 2019
Report done on last confcrypt commit with one of
Addtest (Issue #10) uncommented:Failed tests threshold
Implementation in
ConsoleReporter.hsThe tasty-ant-xml package gave me a good basis to work out this solution.
Right now the Tasty package API only give access to individual tests while they are run, through the foldTestTree and trivialFold "callback" mechanism.
To ease analysis or format conversions, it would be useful to extend this behavior and provide access to an intermediate representation of results, once tests are completed. It may be that I will submit a PR to Tasty about this feature.
Tests reorganization
We now have 2 test suites.
The original one has been renamed from
confcrypt-testtoconfcrypt-detailed-tests. In the same manner,Tests.hsmodule was renamed toDetailedTests.hs.A new one,
confcrypt-threshold-tests, is calling a correspondingThresholdTests.hsmodule.Usage
To run the existing test suite:
$ stack test :confcrypt-detailed-testsTo run the new one:
$ stack test :confcrypt-threshold-tests$ stack test :confcrypt-threshold-tests --ta "--threshold 90"This new test suite returns an error exit code if the threshold is not reached.
The general command
stack testshould not be used: the same set of tests would be run twice, differing only in their output.Results as of February 5, 2019
Tests run on last confcrypt commit with one of
Addtest (Issue #10) uncommented and threshold set to 90%:CircleCI integration
Context
Not having access to CircleCI's environment, what follows are preparatory steps based on some observations and assumptions.
The actual
config.ymlconfiguration is a mix of CircleCI's commands and bash scripts calls.Not knowing what limitations are imposed on those scripts I updated the
config.ymlfile with both scenarios in mind: 1) using CircleCI' way to run commands, or 2) delegating this task to plain old scripts.Probing
Two scripts are prepared as an alternative to the
test-jobjob and are to be tested on site (both are running fine on my laptop):threshold-test.shruns threshold tests and prepare a hpc report,coverage.shoutputs the hpc-threshold report in ahpc-threshold.logfile.Each script returns an error exit code if the test or the coverage threshold is not reached.
Usage
As explained previously, a test suite has to be chosen; running both would be redundant.
It means one command has to be commented while the other is uncommented.
If scripts are running fine in CircleCI's environment,
test-jobjob could be rewritten by following the pattern ofthreshold-test.shand the choice will be betweentest-jobandthreshold-test-jobwithin the workflows section.Otherwise, the switch will be done in the
runcommand of thetest-jobjob and a way to produce the hpc-threshold report will have to be found "à la CircleCI".