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

Improve socat connection success detection using KMP #2506

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

matejvasek
Copy link
Contributor

@matejvasek matejvasek commented Sep 17, 2024

Changes

It appears that Go's MatchReader() returns true only if two characters are written to the writer after the searched word. Thta's mostly all right because socat actually writes several more lines to stderr. However this new implementation is better it should signal immediately when searched patter is written to the writer.

See: https://pkg.go.dev/github.com/agext/regexp#section-documentation

Note that regular expression matches may need to examine text beyond the text returned by a match, so the methods that match text from a RuneReader may read arbitrarily far into the input before returning.

See also: https://stackoverflow.com/questions/76559206/how-to-match-a-regular-expression-on-a-slow-hanging-io-reader-in-go

KMP: https://en.wikipedia.org/wiki/Knuth%E2%80%93Morris%E2%80%93Pratt_algorithm

@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Sep 17, 2024
@matejvasek matejvasek requested review from matzew, jrangelramos, gauron99 and lkingland and removed request for rhuss and dsimansk September 17, 2024 14:44
@matejvasek
Copy link
Contributor Author

PTAL @lkingland @matzew @gauron99

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 67.11%. Comparing base (42ed4d8) to head (5a58b59).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2506      +/-   ##
==========================================
+ Coverage   61.49%   67.11%   +5.62%     
==========================================
  Files         129      129              
  Lines       15381    11990    -3391     
==========================================
- Hits         9458     8047    -1411     
+ Misses       4989     2972    -2017     
- Partials      934      971      +37     
Flag Coverage Δ
e2e-test 36.48% <0.00%> (-0.13%) ⬇️
e2e-test-oncluster 33.32% <0.00%> (-0.10%) ⬇️
e2e-test-oncluster-runtime 29.68% <100.00%> (?)
e2e-test-runtime-go 26.54% <0.00%> (?)
e2e-test-runtime-node 25.93% <0.00%> (?)
e2e-test-runtime-python 25.93% <0.00%> (?)
e2e-test-runtime-quarkus 26.02% <0.00%> (?)
e2e-test-runtime-rust 25.05% <0.00%> (?)
e2e-test-runtime-springboot 25.11% <0.00%> (?)
e2e-test-runtime-typescript 26.01% <0.00%> (?)
integration-tests 53.20% <100.00%> (+2.52%) ⬆️
unit-tests 51.42% <94.73%> (?)
unit-tests-macos-latest ?
unit-tests-ubuntu-latest ?
unit-tests-windows-latest ?

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@matejvasek
Copy link
Contributor Author

@dsimansk @ReToCode please override codecov/project.

@matejvasek
Copy link
Contributor Author

Also why the hell is codecov/project twice there?

@lkingland
Copy link
Member

Also why the hell is codecov/project twice there?

That might be a GitHub flake, because it only appears twice here in the summary, but once on the "Checks" screen 🤷🏻

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 18, 2024
@lkingland
Copy link
Member

Looks like the codecov double-result is still holding up the merge. Going to retest...

@ReToCode
Copy link
Member

@dsimansk @ReToCode please override codecov/project.

Sorry lost that power again... And David is on PTO. @matzew you still an admin here?

@matejvasek
Copy link
Contributor Author

/override codecov/project

Copy link

knative-prow bot commented Sep 19, 2024

@matejvasek: matejvasek unauthorized: /override is restricted to Repo administrators.

In response to this:

/override codecov/project

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-sigs/prow repository.

It appears that Go's MatchReader() returns true only if some new lines
are written to the writer after the searched word. It mostly all right
because socat actually writes several more lines to stderr. However this
new implementation is better it should signal immediately when searched
patter is written to the writer.

Signed-off-by: Matej Vašek <[email protected]>
@knative-prow knative-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 19, 2024
@matejvasek
Copy link
Contributor Author

@dsimansk @matzew @lkingland PTAL

@matejvasek
Copy link
Contributor Author

PTAL @gauron99

Copy link
Contributor

@gauron99 gauron99 left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Sep 20, 2024
Copy link

knative-prow bot commented Sep 20, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gauron99, 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 [gauron99,lkingland,matejvasek]

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 merged commit 1937499 into knative:main Sep 20, 2024
39 checks passed
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.

4 participants