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

add roundtrip tests #3574

Merged
merged 5 commits into from
Jul 15, 2020
Merged

add roundtrip tests #3574

merged 5 commits into from
Jul 15, 2020

Conversation

vaikas
Copy link
Contributor

@vaikas vaikas commented Jul 13, 2020

Add RoundTrip tests for eventing., messaging., and flows.* resources.

Proposed Changes

  • Add round trip tests and fuzzer for eventing., messaging., and flows.* resources.

Release Note

- 🐛 Fix bug
DeadLetterChannel was being dropped when converting between v1beta1<->v1
Not all the conditions were being properly converted between v1beta1<->v1. Basically only the Ready was.

Docs

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Jul 13, 2020
@knative-prow-robot knative-prow-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Jul 13, 2020
@vaikas
Copy link
Contributor Author

vaikas commented Jul 13, 2020

@dprotaso would you mind taking a looksie?

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vaikas

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 13, 2020
@dprotaso
Copy link
Member

Looks good - you may want to also test round tripping between your hub version and your v1 types

ie.
https://github.com/knative/serving/blob/05db8e3b9b7d81807b35820d61ea2e0b26daccbe/pkg/apis/serving/v1alpha1/roundtrip_test.go#L42-L67

@lgtm-com
Copy link

lgtm-com bot commented Jul 14, 2020

This pull request introduces 1 alert when merging 6e8afa1 into 54e191e - view on LGTM.com

new alerts:

  • 1 for Useless assignment to local variable

var FuzzerFuncs = fuzzer.MergeFuzzerFuncs(
func(codecs serializer.CodecFactory) []interface{} {
return []interface{}{
func(ds *DeliverySpec, c fuzz.Continue) {
Copy link
Member

Choose a reason for hiding this comment

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

This means it won’t fuzz the other fields of the delivery spec - you may want to fuzz it here (no custom) and just override the back off policy after

}

// Test v1 -> v1beta1 -> v1
func TestDeliveryStatuscConversionV1(t *testing.T) {
Copy link
Member

Choose a reason for hiding this comment

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

Typo in func name

Also to confirm you wrote this test so that avoid side-effects failure on the input?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, that was covered by the RT tests. I added these because we really didn't have any tests, so wanted to increase coverage.

@dprotaso
Copy link
Member

I think there are funcs names with other typos

}
},
func(imc *InMemoryChannel, c fuzz.Continue) {
if imc != nil {
Copy link
Member

Choose a reason for hiding this comment

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

likewise - i this won't fuzz the other fields so you'll need FuzzNoCustom on imc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack, also combined the status here so don't need both IMC + IMC.Status. Is that right? I think it is because it uncovered a bug :)

Copy link
Member

Choose a reason for hiding this comment

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

also combined the status here so don't need both IMC + IMC.Status. Is that right?

FuzzNoCustom won't call these supplied fuzzer functions so you'll have to fuzz it yourself. You could use c.Fuzz for nested types if you did need to customize the fuzzing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack, so, is it now right?

Copy link
Member

Choose a reason for hiding this comment

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

FuzzNoCustom won't call these supplied fuzzer functions so you'll have to fuzz it yourself. You could use c.Fuzz for nested types if you did need to customize the fuzzing.

I was wrong about this - by bad

var FuzzerFuncs = fuzzer.MergeFuzzerFuncs(
func(codecs serializer.CodecFactory) []interface{} {
return []interface{}{
func(ch *Channel, c fuzz.Continue) {
Copy link
Member

Choose a reason for hiding this comment

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

likewise - i this won't fuzz the other fields so you'll need FuzzNoCustom on ch

@vaikas
Copy link
Contributor Author

vaikas commented Jul 15, 2020

Thanks @dprotaso !! I think I addressed all the comments, and found / fixed a bug :)

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-eventing-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/duck/v1/fuzzer.go Do not exist 0.0%
pkg/apis/duck/v1beta1/delivery_conversion.go 70.6% 100.0% 29.4
pkg/apis/eventing/v1/fuzzer.go Do not exist 100.0%
pkg/apis/flows/v1/fuzzer.go Do not exist 100.0%
pkg/apis/messaging/v1/fuzzer.go Do not exist 100.0%
pkg/apis/messaging/v1beta1/in_memory_channel_conversion.go 97.4% 97.2% -0.1

@knative-prow-robot
Copy link
Contributor

@vaikas: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
pull-knative-eventing-go-coverage a5ae3fa link /test pull-knative-eventing-go-coverage

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@dprotaso
Copy link
Member

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jul 15, 2020
@knative-prow-robot knative-prow-robot merged commit 4f2f82d into knative:master Jul 15, 2020
@vaikas vaikas deleted the eventing-fuzz branch July 16, 2020 20:52
@vaikas vaikas mentioned this pull request Jul 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants