Skip to content

Conversation

@gauron99
Copy link
Contributor

@gauron99 gauron99 commented Mar 17, 2025

The unit test got flaky after the auth version bump (im pretty sure) so in attempt to remedy this flakyness I edited the auth test function.

Main changes>

  • certificate generation gets its own function
  • removed the http default transport hack which got created at the startServer and changed it into: create custom http transport on each run and pass it to the called function.

@knative-prow
Copy link

knative-prow bot commented Mar 17, 2025

@gauron99: The label(s) kind/<kind> cannot be applied, because the repository doesn't have them.

Details

In response to this:

Changes

/kind

Fixes #

Release Note


Docs


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.

@knative-prow
Copy link

knative-prow bot commented Mar 17, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@knative-prow knative-prow bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 17, 2025
@knative-prow knative-prow bot requested review from dsimansk and nainaz March 17, 2025 09:30
@knative-prow knative-prow bot added approved Indicates a PR has been approved by an approver from all required OWNERS files. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Mar 17, 2025
@gauron99 gauron99 removed request for dsimansk and nainaz March 17, 2025 09:31
@codecov
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 63.45%. Comparing base (180b1ee) to head (ea89928).
Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2749      +/-   ##
==========================================
+ Coverage   62.58%   63.45%   +0.87%     
==========================================
  Files         131      131              
  Lines       15598    15598              
==========================================
+ Hits         9762     9898     +136     
+ Misses       4908     4743     -165     
- Partials      928      957      +29     
Flag Coverage Δ
e2e-test 35.88% <ø> (ø)
e2e-test-oncluster 34.17% <ø> (+1.39%) ⬆️
e2e-test-oncluster-runtime 28.61% <ø> (?)
e2e-test-runtime-go 26.52% <ø> (?)
e2e-test-runtime-node 25.92% <ø> (?)
e2e-test-runtime-python 25.92% <ø> (?)
e2e-test-runtime-quarkus 26.07% <ø> (?)
e2e-test-runtime-rust 25.03% <ø> (?)
e2e-test-runtime-springboot 25.07% <ø> (?)
e2e-test-runtime-typescript 26.03% <ø> (?)
integration-tests 49.57% <ø> (+1.85%) ⬆️
unit-tests 49.51% <ø> (?)
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.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment on lines +174 to +193
// create trusted certificates pool and add our certificate
certPool := x509.NewCertPool()
certPool.AddCert(cert)

// client transport with the certificate
transport := &http.Transport{
TLSClientConfig: &tls.Config{
RootCAs: certPool,
},
}

dialer := &net.Dialer{}

transport.DialContext = func(ctx context.Context, network, addr string) (net.Conn, error) {
h, p, err := net.SplitHostPort(addr)
if err != nil {
return nil, err
}
if h == "test.io" {
h = "localhost"
}
return dialer.DialContext(ctx, network, net.JoinHostPort(h, p))
Copy link
Contributor Author

@gauron99 gauron99 Mar 17, 2025

Choose a reason for hiding this comment

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

create custom transport and ca pool each run instead of mutating the http.defaultTransport on server creation

})

// generate Certificate
func generateCert(t *testing.T) (tls.Certificate, *x509.Certificate) {
Copy link
Contributor Author

@gauron99 gauron99 Mar 17, 2025

Choose a reason for hiding this comment

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

move certificate gen to separate function

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
certPool.AddCert(cert)

// client transport with the certificate
transport := &http.Transport{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the startServer whichi previously used to handle the http transport mutation gets used by one more function TestCheckAuthEmptyCreds which still uses the default http transport instead of this one but doesnt seem to cause any problems?
Perhaps TestCheckAuthEmptyCreds needs to have the Transport changed as well

@matejvasek
Copy link
Contributor

Looks good!

@gauron99 gauron99 marked this pull request as ready for review March 18, 2025 13:45
@knative-prow knative-prow bot requested review from nainaz and vyasgun March 18, 2025 13:45
@gauron99 gauron99 changed the title [WIP] fix: create custom http transport for each run for Auth tests Mar 18, 2025
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Mar 18, 2025
@matejvasek
Copy link
Contributor

/approve
/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 18, 2025
@knative-prow
Copy link

knative-prow bot commented Mar 18, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

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

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [gauron99,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 817c77b into knative:main Mar 18, 2025
39 checks passed
matejvasek added a commit to openshift-knative/kn-plugin-func that referenced this pull request Oct 6, 2025
picking knative#2749

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
Signed-off-by: Matej Vašek <mvasek@redhat.com>
matejvasek added a commit to openshift-knative/kn-plugin-func that referenced this pull request Oct 6, 2025
* feat: remote storage class

picking knative#2693

Co-authored-by: Luke Kingland <lkinglan@redhat.com>
Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Python Middleware v2 Scaffolding

picking knative#2685

Co-authored-by: Luke Kingland <lkinglan@redhat.com>
Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix Python S2I On-Cluster build

picking knative#2770

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix http port 433 => 443

picking knative#2742

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Trust loopback builders

picking knative#2750

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Add testcase for Go private repositories

picking knative#2748

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Test adjustments

picking knative#2751

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Allow host mounts for build phahse

picking knative#2753

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Use s2i in standard mode, not "as-dockerfile"

picking knative#2764

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Improvements for Go s2i assembler

picking knative#2765

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* S2I (source-to-image) host binds

picking knative#2766

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Make build binds more similar to runtime binds

picking knative#2768

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Add guideline for private Go module usage

picking knative#2771

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Improve Go templates README

picking knative#2848

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix detection of hostname resolution failure

picking knative#2841

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix: Go scaffolding uses correct module name

picking knative#2769

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix non-containerized build/run /w external deps

picking knative#2847

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Tekton 1.0.x fixes

picking #1349

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Fix co-scheduling

picking #1358

Co-authored-by: Jefferson Ramos <jeramos@redhat.com>
Signed-off-by: Matej Vašek <mvasek@redhat.com>

* test: fix gitlab test

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* dapr install upgrade

picking knative#3055

Co-authored-by: David Fridrich <fridrich.david19@gmail.com>
Co-authored-by: Luke Kingland <lkinglan@redhat.com>
Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fixup: go.mod

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fixup: update alpine version

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Migrate golangci-lint config to v2

picking knative#2781

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* Bump golangci-lint version

picking knative#2784

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fix flaky unit test

picking knative#2749

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
Co-authored-by: Luke Kingland <lkinglan@redhat.com>
Co-authored-by: Jefferson Ramos <jeramos@redhat.com>
Co-authored-by: David Fridrich <fridrich.david19@gmail.com>
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/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants