Skip to content

Unable to distinguish between CloudEvent input and legacy input #54

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

Closed
jskeet opened this issue Nov 16, 2020 · 6 comments
Closed

Unable to distinguish between CloudEvent input and legacy input #54

jskeet opened this issue Nov 16, 2020 · 6 comments
Assignees

Comments

@jskeet
Copy link
Member

jskeet commented Nov 16, 2020

I'm trying to fix #49, and I don't think I can do so with the current conformance test framework - at least not terribly satisfactorily.

Currently I believe the Functions Framework assumes that the event representations are entirely interchangeable - in other words, that we can convert CloudEvent => Legacy => CloudEvent without data loss. This isn't always the case.

For example, the PubSub CloudEvent has a subscription field in its top-level data message. There's no equivalent of this in the legacy representation, so converters (e.g. in Functions Frameworks) just leave it out. However, it's appropriate to include it in the CloudEvent "input" file, so that the file accurately represents the CloudEvent. But if we have it in the input but not the output, we end up with the "CloudEvent to CloudEvent" tests failing.

I'm not immediately convinced that we need "HTTP to HTTP" or "CloudEvent to CloudEvent" tests, to be honest. If we only talked about legacy to CloudEvent, and CloudEvent to legacy (so four files per event) then we'd be okay.

Assigning to @hdp617 as I assume @juliehockett no longer "owns" this project.

@jskeet
Copy link
Member Author

jskeet commented Nov 16, 2020

Another example of data loss in the other direction: the current proposal for Firebase RTDB and Firestore events does not include any CloudEvent mapping for the "params" part of the legacy event.

@hdp617
Copy link
Contributor

hdp617 commented Nov 19, 2020

I agree the "CloudEvent to CloudEvent" tests are not neccessary. We should update the test data so that we have

  • newevent-legacy-input.json and newevent-cloudevent-output.json validate the legacy to CloudEvent conversion
  • newevent-cloudevent-input.json and newevent-legacy-output.jsonvalidate the CloudEvent to legacy conversion.

And remove the "CloudEvent to CloudEvent" tests so newevent-cloudevent-input.json and newevent-cloudevent-output.json don't have to be the exact same.

@jskeet
Copy link
Member Author

jskeet commented Nov 20, 2020

@hdp617: Great, thanks. I'm happy to adjust the data to match that - are you happy to make the changes in the framework itself?

@hdp617
Copy link
Contributor

hdp617 commented Nov 20, 2020

Yes, that would be great! Thank you.

@hdp617
Copy link
Contributor

hdp617 commented Nov 20, 2020

Also, I don't think we neccessarily need to remove the "CloudEvent to CloudEvent" tests. I'm concerned it might break other frameworks' workflows that depend on this. I can adjust the conformance tool to use the same json files for "CloudEvent to CloudEvent" tests.

hdp617 added a commit that referenced this issue Nov 20, 2020
…vents" tests

As issue #54, this allow modifying the CloudEvent "input" files without breaking the "CloudEvents to CloudEvents" tests.
hdp617 added a commit that referenced this issue Nov 20, 2020
…vents" tests (#55)

* fix: use input data as the expected values for "CloudEvents to CloudEvents" tests

As issue #54, this allow modifying the CloudEvent "input" files without breaking the "CloudEvents to CloudEvents" tests.

* fix: update validators_test.go
@jskeet
Copy link
Member Author

jskeet commented Nov 23, 2020

This was fixed by #55.

@jskeet jskeet closed this as completed Nov 23, 2020
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

No branches or pull requests

2 participants