Skip to content
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

Criterion integrationv2 python changes #3534

Merged
merged 18 commits into from
Jan 10, 2023
Merged

Conversation

dougch
Copy link
Contributor

@dougch dougch commented Oct 4, 2022

Resolved issues:

One of three final PRs for #3130

Description of changes:

Changes to the integrationv2 test frame work to allow an optional criterion benchmark to be inserted into the test, instead of s2nc. The PR for changes to CodeBuild will be in a separate PR.

Delta's from previous PR:

  • All test specific changes moved up into the fixture, including selection the Criterion provider and adjusting the timeout.
  • Added an endpoint exception to allow skipping endpoints when using criterion (with one entry).

Call-outs:

  • An ad-hoc Integration job with all the criterion flags set will now be in a separate PR.

Testing:

How is this change tested (unit tests, fuzz tests, etc.)? CI

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Oct 4, 2022
@dougch dougch marked this pull request as ready for review October 10, 2022 22:40
@dougch dougch requested a review from a team as a code owner October 10, 2022 22:40
@dougch dougch requested a review from goatgoose October 10, 2022 22:41
Copy link
Contributor

@goatgoose goatgoose left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just wondering - what caused this to break the sslyze tests? And how does this PR fix it?

@dougch dougch requested review from goatgoose and toidiu October 24, 2022 19:28
@dougch
Copy link
Contributor Author

dougch commented Oct 24, 2022

Added the diffs from the original PR in the description

@crypto-transport-libs-ci-bot crypto-transport-libs-ci-bot force-pushed the criterion_tests branch 2 times, most recently from 1800996 to 305fd14 Compare November 8, 2022 19:53
@dougch dougch enabled auto-merge (squash) November 8, 2022 23:21
@dougch dougch requested a review from lrstewart November 9, 2022 19:12
@dougch dougch force-pushed the criterion_tests branch 4 times, most recently from 90d21c8 to ae6d0bf Compare November 17, 2022 00:11
@dougch dougch requested a review from lrstewart November 17, 2022 00:12
Comment on lines 371 to 372

# Copy the command arguments to an environment variable for the harness to read.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why can't the harness accept the arguments as arguments? Is the environment variable necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was unable to find a way to access the arguments in the handler, the env. variable seemed the cleanest at the time.

@dougch dougch requested review from lrstewart and maruthiaws January 6, 2023 01:23
Comment on lines 108 to 109
# TODO: Understand the failure with criterion and this endpoint.
if get_flag(S2N_USE_CRITERION) != "off" and 'www.netflix.com' in endpoint:
Copy link
Contributor

@lrstewart lrstewart Jan 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little paranoid that if we get the disabling / default value of this flag wrong, we would always skip netflix. Like if you change "off" to "disable" but forget to update this line. Hardcoded strings are dangerous, particularly if you're only checking "!=".

Can you put CriterionS2N's criterion_off somewhere accessible to this logic, as well as everywhere else you have "off" hardcoded? So they're all guaranteed to use the same value? Or maybe add a "is_criterion_enabled" type method.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a choices option to the pytest arguments to cause pytest to fail if the criterion flag is unexpected and moved the "is it off" logic into a function in global_flags.

Comment on lines +18 to 19
-o log_cli=true --log-cli-level=INFO \
--provider-version={env:S2N_LIBCRYPTO} \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why add log_cli?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it was helpful for early development, with only one xdist worker and cli-level increased

@@ -105,6 +105,10 @@
if get_flag(S2N_FIPS_MODE) is True:
client_options.trust_store = TRUST_STORE_TRUSTED_BUNDLE

# TODO: Understand the failure with criterion and this endpoint.
if is_criterion_on() and 'www.netflix.com' in endpoint:

Check failure

Code scanning / CodeQL

Incomplete URL substring sanitization

The string [www.netflix.com](1) may be at an arbitrary position in the sanitized URL.
@@ -2,8 +2,10 @@
import pytest
import subprocess

from global_flags import get_flag, is_criterion_on, S2N_USE_CRITERION

Check notice

Code scanning / CodeQL

Unused import

Import of 'get_flag' is not used. Import of 'S2N_USE_CRITERION' is not used.
from configuration import PROTOCOLS
from common import ProviderOptions, Ciphers, pq_enabled
from fixtures import managed_process # lgtm [py/unused-import]
from global_flags import get_flag, S2N_FIPS_MODE
from global_flags import get_flag, is_criterion_on, S2N_FIPS_MODE, S2N_USE_CRITERION

Check notice

Code scanning / CodeQL

Unused import

Import of 'S2N_USE_CRITERION' is not used.
@dougch dougch requested review from lrstewart and removed request for maruthiaws January 10, 2023 01:22
@dougch dougch merged commit 4a73919 into aws:main Jan 10, 2023
@dougch dougch deleted the criterion_tests branch January 13, 2023 23:51
jmayclin pushed a commit to jmayclin/s2n-tls that referenced this pull request Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants