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

Fixup cert package tests #1253

Open
wants to merge 2 commits into
base: cert-v2
Choose a base branch
from
Open

Fixup cert package tests #1253

wants to merge 2 commits into from

Conversation

nbrownus
Copy link
Collaborator

This change fixes the old v1 tests and adds new tests for v2.

Most notably it fixes the TestMarshalingCertificateV1Consistency test which needed to be modified. netip.Prefix can not represent netmasks like 255.0.255.0. I went back to f22b4b5 and modified the test details to remove the non conforming netmasks and adjust the timestamps, the resulting expected byte arrays are represented in this test.

There are two spots where I am unsure if we want to panic, v1 and v2 String() calls json.Marshal which can fail. Currently they return a string but panic would be more obvious.

package e2e
package cert

//TODO: this should only be built if performing tests
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I really dont want to require we use a tag to execute tests but it also feels bad to include this in the binary and I don't know of another way to deal with this without just copying these functions all over the place again.

Copy link
Contributor

Choose a reason for hiding this comment

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

can't you define these in a something_helpers_test.go and use them in other *_test.go files?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I desperately want there to be a way but the only thing I can come up with is a build tag much like how e2e works

@nbrownus nbrownus marked this pull request as ready for review October 18, 2024 15:30
@johnmaguire
Copy link
Collaborator

Could knock out #1124 in this too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants