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

Remove deprecated httpclient msgsender #7018

Merged

Conversation

g1rjeevan
Copy link
Contributor

@g1rjeevan g1rjeevan commented Jun 13, 2023

Proposed Changes

Removed the legacy http client go, message sender go and respective test files, Since the functionality are handled in http client new and message sender new go

Issue related : #6995

  • 🗑️ Remove feature or internal logic

Pre-review Checklist

  • At least 80% unit test coverage
  • E2E tests for any new behavior
  • Docs PR for any user-facing impact
  • Spec PR for any new API feature
  • Conformance test for any change to the spec

Release Note


Docs

📖 #6995

@knative-prow knative-prow bot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jun 13, 2023
@knative-prow knative-prow bot requested review from creydr and lberk June 13, 2023 14:01
@knative-prow
Copy link

knative-prow bot commented Jun 13, 2023

Hi @g1rjeevan. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@@ -222,7 +222,10 @@ func main() {

// maybeQuitIstioProxy shuts down Istio's proxy when available.
func maybeQuitIstioProxy() {
_, err := http.DefaultClient.Get("http://localhost:15020/quitquitquit")
req, _ := http.NewRequest(http.MethodPost, "http://localhost:15020/quitquitquit", nil)
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason why we are switching from making a GET request to making a POST request here?

Copy link
Contributor Author

@g1rjeevan g1rjeevan Jun 15, 2023

Choose a reason for hiding this comment

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

Actually, This is the code after taking merge from main, It must be already in the main branch since it mentioned as outdated. Can you confirm once?

Copy link
Member

Choose a reason for hiding this comment

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

Good point, I was looking at an outdated diff - sorry for the confusion!

@@ -31,7 +31,10 @@ func main() {
}

func maybeQuitIstioProxy() {
_, err := http.DefaultClient.Get("http://localhost:15020/quitquitquit")
req, _ := http.NewRequest(http.MethodPost, "http://localhost:15020/quitquitquit", nil)
Copy link
Member

Choose a reason for hiding this comment

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

Same here, should this also be a GET request still?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here as the other one.

@Cali0707
Copy link
Member

Thanks for the contribution @g1rjeevan! Welcome! 🎉

@Cali0707
Copy link
Member

/ok-to-test

@knative-prow knative-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 14, 2023
@Cali0707
Copy link
Member

Hey @g1rjeevan it looks like the ingress handler and some of the tests need to be updated to reflect removing the httpclient msgsender:

pkg/broker/ingress/ingress_handler.go:56:24: undefined: kncloudevents.HTTPMessageSender
pkg/inmemorychannel/message_dispatcher_benchmark_test.go:80:35: undefined: kncloudevents.NewHTTPMessageSenderWithTarget
pkg/inmemorychannel/message_dispatcher_test.go:262:35: undefined: kncloudevents.NewHTTPMessageSenderWithTarget
pkg/kncloudevents/http_client_new_test.go:91:23: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:113:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:114:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:124:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:125:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:141:79: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:142:86: undefined: castToTransport

@g1rjeevan
Copy link
Contributor Author

Hey @g1rjeevan it looks like the ingress handler and some of the tests need to be updated to reflect removing the httpclient msgsender:

pkg/broker/ingress/ingress_handler.go:56:24: undefined: kncloudevents.HTTPMessageSender
pkg/inmemorychannel/message_dispatcher_benchmark_test.go:80:35: undefined: kncloudevents.NewHTTPMessageSenderWithTarget
pkg/inmemorychannel/message_dispatcher_test.go:262:35: undefined: kncloudevents.NewHTTPMessageSenderWithTarget
pkg/kncloudevents/http_client_new_test.go:91:23: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:113:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:114:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:124:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:125:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:141:79: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:142:86: undefined: castToTransport

@g1rjeevan g1rjeevan closed this Jun 21, 2023
@g1rjeevan g1rjeevan reopened this Jun 21, 2023
@g1rjeevan
Copy link
Contributor Author

Hey @g1rjeevan it looks like the ingress handler and some of the tests need to be updated to reflect removing the httpclient msgsender:

pkg/broker/ingress/ingress_handler.go:56:24: undefined: kncloudevents.HTTPMessageSender
pkg/inmemorychannel/message_dispatcher_benchmark_test.go:80:35: undefined: kncloudevents.NewHTTPMessageSenderWithTarget
pkg/inmemorychannel/message_dispatcher_test.go:262:35: undefined: kncloudevents.NewHTTPMessageSenderWithTarget
pkg/kncloudevents/http_client_new_test.go:91:23: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:113:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:114:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:124:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:125:25: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:141:79: undefined: castToTransport
pkg/kncloudevents/http_client_new_test.go:142:86: undefined: castToTransport

In order to change these tests cases, there are pre-tasks that need to be completed.
Pre-Tasks:

  1. Eventing TLS: support creating TLS server for mt-broker-ingress #6876
  2. Eventing TLS: support creating TLS server for mt-broker-filter #6877

@creydr
Copy link
Member

creydr commented Jul 10, 2023

Hey @g1rjeevan,
the mt-broker-ingress component migrated to the new package too. So there should be no usages of the old HTTMessagSender left (besides of one unit test (pkg/inmemorychannel/message_dispatcher_test.go). Can you rebase your PR to get the latest changes and remove the last usage in the unit test?

httpsender, err := kncloudevents.NewHTTPMessageSenderWithTarget(channelAProxy.URL)
if err != nil {
t.Fatal(err)
}
req, err := httpsender.NewCloudEventRequest(context.Background())
if err != nil {
t.Fatal(err)
}
event := test.FullEvent()
_ = protocolhttp.WriteRequest(context.Background(), binding.ToMessage(&event), req)
res, err := httpsender.Send(req)

@g1rjeevan
Copy link
Contributor Author

Hey @g1rjeevan, the mt-broker-ingress component migrated to the new package too. So there should be no usages of the old HTTMessagSender left (besides of one unit test (pkg/inmemorychannel/message_dispatcher_test.go). Can you rebase your PR to get the latest changes and remove the last usage in the unit test?

httpsender, err := kncloudevents.NewHTTPMessageSenderWithTarget(channelAProxy.URL)
if err != nil {
t.Fatal(err)
}
req, err := httpsender.NewCloudEventRequest(context.Background())
if err != nil {
t.Fatal(err)
}
event := test.FullEvent()
_ = protocolhttp.WriteRequest(context.Background(), binding.ToMessage(&event), req)
res, err := httpsender.Send(req)

Sure. Will push the update.

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

@linux-foundation-easycla
Copy link

CLA Missing ID CLA Not Signed

Removed message sender usage from message dispatcher test

Removed message sender usage from message dispatcher test
@g1rjeevan g1rjeevan force-pushed the remove-deprecated-httpclient-msgsender branch from 2d23659 to a2b7256 Compare July 13, 2023 09:43
Copy link
Member

@Cali0707 Cali0707 left a comment

Choose a reason for hiding this comment

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

Looks like the tests are now passing!
/lgtm
/cc @creydr

@knative-prow knative-prow bot requested a review from creydr July 20, 2023 14:52
@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 20, 2023
@knative-prow knative-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Jul 21, 2023
@g1rjeevan
Copy link
Contributor Author

/cc @creydr @Cali0707 @lberk

@knative-prow knative-prow bot requested a review from Cali0707 July 21, 2023 02:40
@g1rjeevan
Copy link
Contributor Author

/assign @g1rjeevan

@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.13% ⚠️

Comparison is base (6911db0) 78.34% compared to head (54abccc) 78.21%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7018      +/-   ##
==========================================
- Coverage   78.34%   78.21%   -0.13%     
==========================================
  Files         250      248       -2     
  Lines       13320    13245      -75     
==========================================
- Hits        10435    10360      -75     
  Misses       2355     2355              
  Partials      530      530              
Files Changed Coverage Δ
pkg/kncloudevents/http_client_new.go 60.33% <ø> (-0.33%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

Besides of the comments I have, I am wondering if we should wait with merging this for after the release cut (in a few days), just to make sure if any of the subprojects is using this, they have time with fixing it (IIRC rabbitmq-broker was using it).

pkg/inmemorychannel/message_dispatcher_benchmark_test.go Outdated Show resolved Hide resolved
@Cali0707
Copy link
Member

Btw @g1rjeevan unless there are merge conflicts between this branch and the main branch, you don't need to worry about merging main into your branch - the Prow bot will take care of it when it goes to merge the PR

Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

@g1rjeevan Thanks for your work so far 👍
Could you fix the lint errors in pkg/kncloudevents/http_client_new_test.go too? You can see the issues, when you're on the "Files changed" tab on your PR and then check on the annotations.

Copy link
Member

@creydr creydr left a comment

Choose a reason for hiding this comment

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

Thanks a lot for your work @g1rjeevan and your patience!
/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jul 27, 2023
@knative-prow
Copy link

knative-prow bot commented Jul 27, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Cali0707, creydr, g1rjeevan

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 knative-prow bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 27, 2023
@creydr
Copy link
Member

creydr commented Jul 27, 2023

/retest

@knative-prow knative-prow bot merged commit ffa5915 into knative:main Jul 27, 2023
25 of 28 checks passed
@g1rjeevan
Copy link
Contributor Author

Thanks a lot for your work @g1rjeevan and your patience! /lgtm

@creydr @Cali0707 @lberk Thank you for your assistance in the contribution, and I am eager to engage further with Knative.

@creydr
Copy link
Member

creydr commented Jul 31, 2023

@creydr @Cali0707 @lberk Thank you for your assistance in the contribution, and I am eager to engage further with Knative.

That is great to hear @g1rjeevan 🎉 Most of our projects have issues labeled with good-first-issue or kind/good-first-issue (e.g. in eventing) and the "community" section on our website (https://knative.dev/docs/community/) are good starts for new contributors.
Also feel free (as you've done already 😃) to reach out to us on Slack or in one of our Workgroup meetings.
Welcome 👋 😃

pierDipi pushed a commit to pierDipi/eventing that referenced this pull request Jan 17, 2024
## Proposed Changes
Removed the legacy http client go, message sender go and respective test
files, Since the functionality are handled in http client new and
message sender new go

Issue related : knative#6995
 
- 🗑️ Remove feature or internal logic

-
-
-

### Pre-review Checklist

- [x] **At least 80% unit test coverage**
- [ ] **E2E tests** for any new behavior
- [ ] **Docs PR** for any user-facing impact
- [ ] **Spec PR** for any new API feature
- [ ] **Conformance test** for any change to the spec

**Release Note**
 
```release-note

```


**Docs**
 
📖 knative#6995

---------

Co-authored-by: Christoph Stäbler <[email protected]>
openshift-merge-bot bot pushed a commit to openshift-knative/eventing that referenced this pull request Jan 17, 2024
* Remove deprecated httpclient msgsender (knative#7018)

## Proposed Changes
Removed the legacy http client go, message sender go and respective test
files, Since the functionality are handled in http client new and
message sender new go

Issue related : knative#6995
 
- 🗑️ Remove feature or internal logic

-
-
-

### Pre-review Checklist

- [x] **At least 80% unit test coverage**
- [ ] **E2E tests** for any new behavior
- [ ] **Docs PR** for any user-facing impact
- [ ] **Spec PR** for any new API feature
- [ ] **Conformance test** for any change to the spec

**Release Note**
 
```release-note

```


**Docs**
 
📖 knative#6995

---------

Co-authored-by: Christoph Stäbler <[email protected]>

* Refactor kncloudevents and add `SendEvent` function (knative#7092)

Adds a function (`SendEvent`) to the kncloudevents package to Send
events. This function:
* configures the client (e.g. for TLS)
* has option to send replies
* has option to send to a DLS
* has option to add additional transformers

This allows e.g. for use cases like the following:
```
kncloudevents.SendEvent(ctx, event, sub.Subscriber,
	kncloudevents.WithHeader(additionalHeaders),
	kncloudevents.WithReply(sub.Reply),
	kncloudevents.WithDeadLetterSink(sub.DeadLetter),
	kncloudevents.WithRetryConfig(sub.RetryConfig))
```

The `SendMessage` function is provided to make integration with existing
packages easier (e.g. in dependent projects).

Also migrated the usages of kncloudevents.NewCloudEventRequest() to the
new SendEvent() function (mt-broker-filter and mt-broker-ingress):
* 74c1552
* 9728713
* 958722d

* Remove deprecated kncloudevents.CloudEventsRequest (knative#7146)

* Remove kncloudevents.CloudEventsRequest

* Run hack/update-codegen.sh

* Add unit tests for generateBackoffFn()

* Fix event dispatcher library data race (knative#7280)

Fix dispatcher data race

Signed-off-by: Pierangelo Di Pilato <[email protected]>

---------

Signed-off-by: Pierangelo Di Pilato <[email protected]>
Co-authored-by: Jeevan <[email protected]>
Co-authored-by: Christoph Stäbler <[email protected]>
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants