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

Replace badssl.com in tests #2543

Merged
merged 11 commits into from
Aug 9, 2022
Merged

Replace badssl.com in tests #2543

merged 11 commits into from
Aug 9, 2022

Conversation

mstoykov
Copy link
Contributor

fixes #2302

@mstoykov mstoykov added this to the v0.40.0 milestone Jun 13, 2022
@mstoykov mstoykov changed the title WIP Replace badssl.com in tests Jun 15, 2022
@na--
Copy link
Member

na-- commented Jun 28, 2022

#2578 is somewhat connected

@mstoykov
Copy link
Contributor Author

Not really - the problem there really is the fact that the go stdlib doesn't returned typed errors with 1.18 on mac os and apperantly using the system CA roots. Not that the test fail as badssl isn't there or does something wrong.

@mstoykov mstoykov force-pushed the removeBadSSLDependancyIntests branch from 8c8ae6c to 52cb2a9 Compare August 9, 2022 10:18
@mstoykov mstoykov marked this pull request as ready for review August 9, 2022 10:18
@github-actions github-actions bot requested review from codebien and oleiade August 9, 2022 10:19
@mstoykov
Copy link
Contributor Author

mstoykov commented Aug 9, 2022

More or less all of this is really fragile - changing more or less anything breaks one or more of the tests.

Unfortunately we once again have a failing CI due ot badssl renewal problems, so even this more fragile code is better. It also happens to be fairly decoupled from any other tests so it should not fail just because we change something for another test 🤞 .

If this is approved I will open an issue to fix this in the future ™️

@@ -2439,3 +2530,120 @@ func TestBinaryResponseWithStatus0(t *testing.T) {
`)
require.NoError(t, err)
}

func GenerateTLSCertificate(t *testing.T, host string, notBefore time.Time, validFor time.Duration) ([]byte, []byte) {
Copy link
Member

Choose a reason for hiding this comment

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

hmm can you add these helper functions to the go.k6.io/k6/lib/testutils/httpmultibin or go.k6.io/k6/lib/testutils package, then you won't need to copy them in 2 places almost verbatim?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are different so - no we can't :)

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but I compared them and the differences seemed minor enough to parameterize? In any case, not a deal breaker, it can be fixed later or not at all - anything is better than relying on badssl 😅

na--
na-- previously approved these changes Aug 9, 2022
Copy link
Member

@na-- na-- left a comment

Choose a reason for hiding this comment

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

LGTM besides the minor nitpick I mentioned inline. I only skimmed some parts of this PR, so I haven't double-checked if the broken crypto is broken exactly as we want it to 😅 But I don't think it matters all that much, anything is better than having these tests randomly break every few weeks...

na--
na-- previously approved these changes Aug 9, 2022
olegbespalov
olegbespalov previously approved these changes Aug 9, 2022
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

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

👍 great work!

A minor nitpick, maybe is a suggestion to not use domain names like mybadssl.com or tlsv10.com, but explicitly name them bad-ssl-stub.localhost or whatever.

Something that indicates that this is a local/stub/fake domain without digging up.

@mstoykov mstoykov dismissed stale reviews from olegbespalov and na-- via 12adb01 August 9, 2022 11:41
na--
na-- previously approved these changes Aug 9, 2022
@mstoykov mstoykov requested review from na-- and olegbespalov August 9, 2022 13:28
Copy link
Contributor

@olegbespalov olegbespalov left a comment

Choose a reason for hiding this comment

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

💪

@mstoykov mstoykov merged commit ff2b8b8 into master Aug 9, 2022
@mstoykov mstoykov deleted the removeBadSSLDependancyIntests branch August 9, 2022 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove usage of badssl.com in k6 tests
3 participants