-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue03 test and coverage thresholds #28
Open
jhenligne
wants to merge
13
commits into
collegevine:master
Choose a base branch
from
jhenligne:issue03-test-coverage-thresholds
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Issue03 test and coverage thresholds #28
jhenligne
wants to merge
13
commits into
collegevine:master
from
jhenligne:issue03-test-coverage-thresholds
Conversation
This file contains 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
jhenligne
force-pushed
the
issue03-test-coverage-thresholds
branch
from
February 5, 2019 08:53
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)
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.
Integration done, failing test because code coverage under threshold:
@ChrisCoffey This PR is ready for review. |
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-threshold
hpc-threshold utility implements desired behavior.
Setup is straightforward:
$ stack install hpc-threshold
.hpc-threshold
configuration file (threshold already set to 80%)$ stack test :confcrypt-detailed-tests --coverage
stack hpc report --all 2>&1 | hpc-threshold
Results as of February 5, 2019
Report done on last confcrypt commit with one of
Add
test (Issue #10) uncommented:Failed tests threshold
Implementation in
ConsoleReporter.hs
The 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-test
toconfcrypt-detailed-tests
. In the same manner,Tests.hs
module was renamed toDetailedTests.hs
.A new one,
confcrypt-threshold-tests
, is calling a correspondingThresholdTests.hs
module.Usage
To run the existing test suite:
$ stack test :confcrypt-detailed-tests
To 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 test
should 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
Add
test (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.yml
configuration is a mix of CircleCI's commands and bash scripts calls.Not knowing what limitations are imposed on those scripts I updated the
config.yml
file 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-job
job and are to be tested on site (both are running fine on my laptop):threshold-test.sh
runs threshold tests and prepare a hpc report,coverage.sh
outputs the hpc-threshold report in ahpc-threshold.log
file.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-job
job could be rewritten by following the pattern ofthreshold-test.sh
and the choice will be betweentest-job
andthreshold-test-job
within the workflows section.Otherwise, the switch will be done in the
run
command of thetest-job
job and a way to produce the hpc-threshold report will have to be found "à la CircleCI".