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

Plain JSON body in func invoke with HTTP #1039

Merged
merged 1 commit into from
Jun 8, 2022

Conversation

matejvasek
Copy link
Contributor

@matejvasek matejvasek commented Jun 7, 2022

Changes

Using plain JSON body in func invoke with HTTP instead of form encoding.

Fixes: #1038

Changes the invoke command for HTTP functions to use standard HTTP POST with JSON instead of multi-part form encoding

@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jun 7, 2022
@matejvasek matejvasek requested a review from zroubalik June 7, 2022 16:13
@lance
Copy link
Member

lance commented Jun 7, 2022

/lgtm
However
/hold for test fixes

@knative-prow knative-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 7, 2022
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 7, 2022
invoke.go Outdated Show resolved Hide resolved
@matejvasek
Copy link
Contributor Author

I see how could I cause test breakage, but I don't see how could I have cause race.

@matejvasek
Copy link
Contributor Author

I see how could I cause test breakage, but I don't see how could I have cause race.

I think the race must have been there all along and it only manifest when assert fails.

@knative-prow knative-prow bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 7, 2022
@matejvasek
Copy link
Contributor Author

Another weird thing var invoked bool is being writen and read from different goroutines but race is not reported, what the hell.

client_test.go Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Jun 7, 2022

Codecov Report

Merging #1039 (472ea95) into main (5e26510) will increase coverage by 0.00%.
The diff coverage is 57.14%.

@@           Coverage Diff           @@
##             main    #1039   +/-   ##
=======================================
  Coverage   46.70%   46.70%           
=======================================
  Files          59       59           
  Lines        7730     7736    +6     
=======================================
+ Hits         3610     3613    +3     
- Misses       3775     3777    +2     
- Partials      345      346    +1     
Impacted Files Coverage Δ
invoke.go 47.82% <57.14%> (+0.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5e26510...472ea95. Read the comment docs.

@matejvasek
Copy link
Contributor Author

@lance PTAL

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

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

/lgtm
But we should address the race condition

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 7, 2022
Do not use form encoding.

Signed-off-by: Matej Vasek <mvasek@redhat.com>
@knative-prow knative-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 7, 2022
@matejvasek
Copy link
Contributor Author

@lance ok I fixed potential race, plz final lgtm

@matejvasek
Copy link
Contributor Author

CI is flaking more than usual.

Copy link
Member

@lkingland lkingland left a comment

Choose a reason for hiding this comment

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

I prefer this as well 👍🏻

I am perplexed why the tests would throw a race error now and not earlier, however.

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jun 8, 2022
@knative-prow
Copy link

knative-prow bot commented Jun 8, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lkingland, matejvasek

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:
  • OWNERS [lkingland,matejvasek]

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

@matejvasek
Copy link
Contributor Author

@lkingland

I am perplexed why the tests would throw a race error now and not earlier, however.

You cannot call t.Fatal() outside the main test goroutine (t.Error() seems to be ok).

@matejvasek
Copy link
Contributor Author

/unhold

@knative-prow knative-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 8, 2022
@knative-prow knative-prow bot merged commit afe8a95 into knative:main Jun 8, 2022
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. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The func invoke -f=http sub-command uses from encoding not JSON.
3 participants