-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
test: Enable specifying flaky tests on fips #16329
Conversation
@komawar thanks! Could you add a "negative control"? a test that fails if
Then add an exception in |
@refack Thanks for your review! Surely, let me look into it / wrap my head around this. |
Just wanted to leave a comment (ease the load on reviewers) on a sample test run which I conducted, here's the commit that details the run and marked tests as flaky (for testing purposes): |
Sure. Take a look at the current status file: node/test/parallel/parallel.status Lines 1 to 22 in c3ae57f
|
@refack Oh I get it now! (I misread what you were saying there). Surely, I was hoping to get a pointer on how to best test this and here it is! perfect, I will add this. |
Maybe a most verbose way to "fail" the test is to use if (common.hasFipsCrypto)
assert.fail(`expected to fail with FIPS enabled`) |
b8ada86
to
5bf0d6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple of thoughts
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | ||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | ||
// USE OR OTHER DEALINGS IN THE SOFTWARE. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copyright is not needed in new files AIUI (cc/ @jasnell for confirmation).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has been removed as per @Trott 's suggestion.
Makefile
Outdated
@@ -505,6 +505,9 @@ test-v8 test-v8-intl test-v8-benchmarks test-v8-all: | |||
"$ git clone https://github.com/nodejs/node.git" | |||
endif | |||
|
|||
test-on-fips: | |||
$(PYTHON) tools/test.py --type=fips |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think a separate command is needed here, we have way too many commands as it is. Also we'd really need to provide a fips option for every make target that includes tools/test.py
. I think what would be helpful is a way to pass arguments to tools/test.py
calls using an environment variable, simillar to CONFIG_FLAGS
. That should be done separately, so I'll raise a separate issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. do you want me to wait until that's been discussed or should we go with something short term here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for that insight. The latest PR excludes these changes.
tools/test.py
Outdated
@@ -1427,6 +1427,9 @@ def BuildOptions(): | |||
result.add_option('--abort-on-timeout', | |||
help='Send SIGABRT instead of SIGTERM to kill processes that time out', | |||
default=False, action="store_true", dest="abort_on_timeout") | |||
result.add_option("--type", | |||
help="Specifies the environment type the tests will run on, for example 'fips'", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So currently this only supports fips
right? I think we should give an exhaustive list of the possible options, so maybe something like:
Specifies the type of build. Options: fips"
That way we can easily expand the list when we add more options (like shared
).
Otherwise the for example
is misleading.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done. ty
// This test will fail on fips. The corresponding line in | ||
// parallel.status file makes sure this is marked as flaky and passes. | ||
'use strict'; | ||
const common = require('../common'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you order these as per the writing tests guide? Basically use strict, require common, comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. thanks for pointing that out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
Thanks for your reviews. I will wait until more comments, confirmations and direction has been discussed to update this. |
BUILDING.md
Outdated
@@ -135,6 +135,15 @@ $ make test | |||
At this point you are ready to make code changes and re-run the tests! | |||
Optionally, continue below. | |||
|
|||
If you wish to run tests on specific systems, say ``fips``: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: FIPS is not a system. (Is it more correct to call it a "configuration"?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has been removed as per your suggestion.
BUILDING.md
Outdated
``` | ||
|
||
This particular command will mark the tests specified in the \*.status files as | ||
flaky. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is confusing. Running make test-on-fips
will not mark tests as flaky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
test/parallel/parallel.status
Outdated
# Sample test (test-negative-on-fips) has been added to check the | ||
# skip-on-fips feature (issue 14746) | ||
[$type==fips] | ||
test-negative-on-fips: PASS,FLAKY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be part of the PR nor the associated test. We don't have permanent entries in the *.status
files. If something is in there, it's because the test is having a problem that needs to be addressed.
I don't believe we generally test the test.py
code directly like this. That may not be a great practice, but trying to introduce it in this PR is probably not the way to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file has been removed as per your suggestion.
This is great and thanks for doing it! I think we only need the changes in All that said, I would be excited to have a working skip-FIPS feature in |
5bf0d6a
to
d867ff3
Compare
@Trott @refack @gibfahn thanks for your reviews. I was hoping that we sort of have a convergence of opinion for this conversation (given the views of three of your differed on the reviews) but in the interest of time, I have avoided the extra commits and the latest PR has just the I will create a different PR indicating that changes to cheers |
tools/test.py
Outdated
@@ -1427,6 +1427,9 @@ def BuildOptions(): | |||
result.add_option('--abort-on-timeout', | |||
help='Send SIGABRT instead of SIGTERM to kill processes that time out', | |||
default=False, action="store_true", dest="abort_on_timeout") | |||
result.add_option("--type", | |||
help="Specifies the type of build. Options: fips" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit (non-blocking): Can we format this more like existing options?
For example, using this as a model:
"The style of progress indicator (verbose, dots, color, mono, tap)"
...this would be:
"Type of build (default, fips)"
...or don't list the options at all if they're not enumerated by this file (which I don't see where they are).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The options are default or fips AFAIK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, the options are default
or fips
.
You don't see the enumeration as there are no more choices and the existing code parses the type = fips
to give you PASS, FAIL, SKIP functionality. It took me some time to figure this out, code is crazy old, pretty complicated to read and I do intend to follow up with a blog entry on this soon(ish), for knowledge sharing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... also this will have to change a bit for shared
case when we might see some enumertaion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Trott (formatting has been done in latest)
There isn't any pre-existing functionality to already skip a test if an entry for [$type==fips]
test-foo-bar: SKIP,FLAKY |
d867ff3
to
fd1c661
Compare
Yes, it should work out-of-the-box for:-
Please see an example test I've created here komawar@4a957ca , (had referenced this before but is hard to find so that's okay). This is one of the reasons I had added the negative sample test here komawar@5bf0d6a as suggested by @refack , itself acts as a bit documentation. But I do agree that we prolly shouldn't change the structure/type of tests in the repo like you mentioned earlier. Maybe we can have a "mock" test for such things but I don't see where it exists for tools/test.py -- ideas appreciated. May be something for future? |
So actually I think what would be really useful is if So instead of having to run You can check that by doing @komawar if you'd be up for implementing that that would be amazing. Let me know if you get stuck anywhere, I did something similar in this file recently, so could help out with it if needed. |
@gibfahn no issues, this looks like a good idea. gonna go at it.. However, I still think we need the |
I think you're right, having the |
fd1c661
to
74654f0
Compare
This has been done. |
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. Fixes: issue 14746
2950653
to
b0c0dee
Compare
@Trott what do you think? |
@gibfahn No objections! |
Landed in f31cf56 |
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. PR-URL: #16329 Fixes: #14746 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
FYI: This change uses For the time being I've updated the workers to use python2.7 and opened #17381 to improve this change. /CC @nodejs/build |
Thanks for fixing @refack , wonder why it didn't fail pre-land CI. |
It did - node-test-commit-linux/14398 was part or the above mentioned node-test-pull-request/11661 |
So apparently it's not simple to upgrade CentOS6 to python2.7, so I'd rather fast-track #17381 then fiddle around with the system config. |
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. PR-URL: #16329 Fixes: #14746 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. PR-URL: #16329 Fixes: #14746 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. PR-URL: #16329 Fixes: #14746 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. PR-URL: #16329 Fixes: #14746 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This would be good to have on |
Adds a way to mark a specified test as 'flaky' on fips compliant systems. Earlier, the ``tools/test.py`` script supported only 'mode', 'system' and 'arch' for test environment specification. This limits the ability to specify the behavior of tests and setting pre-determined behavior of the same on other types of systems. As an example, the feature request below indicates the need to specify certain tests as 'flaky' on fips compliant systems. It hints at future possibility of a shared library, which in turn may need a specifier for running tests. This commit introduces a new item in the ``env`` dict, called ``type`` which defaults to ``simple`` type. It also adds an optional command line argument ``--type``, which inputs strings. Current functionality extends to setting ``simple`` or ``fips`` for this ``type`` variable. However, extending it to further uses is rather simple by adding "if" conditions at appropriate places in the ``tools/test.py`` script. PR-URL: #16329 Fixes: #14746 Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Adds a way to mark a specified test as 'flaky' on fips compliant
systems.
Earlier, the
tools/test.py
script supported only 'mode','system' and 'arch' for test environment specification. This limits the
ability to specify the behavior of tests and setting pre-determined
behavior of the same on other types of systems. As an example, the
feature request below indicates the need to specify certain tests as
'flaky' on fips compliant systems. It hints at future possibility of a
shared library, which in turn may need a specifier for running tests.
This commit introduces a new item in the
env
dict, calledtype
which defaults to
simple
type. It also adds an optional commandline argument
--type
, which inputs strings. Current functionalityextends to setting
simple
orfips
for thistype
variable.However, extending it to further uses is rather simple by adding "if"
conditions at appropriate places in the
tools/test.py
script.Fixes: #14746
Checklist
make -j4 test
(UNIX), orvcbuild test
(Windows) passesAffected core subsystem(s)