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

OCPBUGS-18776: [sig-instrumentation] tests fail due to JSON parsing error. #28320

Merged
merged 1 commit into from Nov 8, 2023

Conversation

raptorsun
Copy link
Contributor

Replace shell call of curl with net/http implementation in Prometheus helper functions.
So that timeout requests will not get truncated and reassembled responses.

@openshift-ci-robot openshift-ci-robot added jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Oct 11, 2023
@openshift-ci-robot
Copy link

@raptorsun: This pull request references Jira Issue OCPBUGS-18776, which is invalid:

  • expected the bug to target the "4.15.0" version, but no target version was set

Comment /jira refresh to re-evaluate validity if changes to the Jira bug are made, or edit the title of this pull request to link to a different bug.

The bug has been updated to refer to the pull request using the external bug tracker.

In response to this:

Replace shell call of curl with net/http implementation in Prometheus helper functions.
So that timeout requests will not get truncated and reassembled responses.

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.

@raptorsun
Copy link
Contributor Author

/jira refresh

@openshift-ci-robot openshift-ci-robot added jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. and removed jira/invalid-bug Indicates that a referenced Jira bug is invalid for the branch this PR is targeting. labels Oct 11, 2023
@openshift-ci-robot
Copy link

@raptorsun: This pull request references Jira Issue OCPBUGS-18776, which is valid. The bug has been moved to the POST state.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target version (4.15.0) matches configured target version for branch (4.15.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, POST)

Requesting review from QA contact:
/cc @gpei

In response to this:

/jira refresh

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.

@openshift-ci openshift-ci bot requested a review from gpei October 11, 2023 15:51
@raptorsun
Copy link
Contributor Author

/retest

@jan--f
Copy link
Contributor

jan--f commented Oct 12, 2023

/lgtm

@openshift-ci openshift-ci bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 12, 2023
@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Oct 12, 2023
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Oct 12, 2023
@raptorsun
Copy link
Contributor Author

/retest-required

@raptorsun
Copy link
Contributor Author

/retest


const maxRetries = 2
var resp *http.Response = nil
for retries := 0; retries < maxRetries; retries++ {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd recommend using wait.PollUntilContextTimeout() from the k8s.io/apimachinery/pkg/util/wait package.

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 retry loop is replaced by the functionwait.PollUntilContextTimeout(). Meanwhile the timeout limit is increased to 60 seconds with retry interval of 10 seconds.

@raptorsun
Copy link
Contributor Author

/retest

@raptorsun
Copy link
Contributor Author

/retest-required

@raptorsun
Copy link
Contributor Author

/retest

1 similar comment
@raptorsun
Copy link
Contributor Author

/retest

@raptorsun
Copy link
Contributor Author

Thanks for the review :D @simonpasquier
The PR has been updated accordingly. The deprecated function wait.PollImmediate is replaced with wait.PollUntilContextTimeout, too.

@raptorsun
Copy link
Contributor Author

raptorsun commented Nov 2, 2023 via email

@simonpasquier
Copy link
Contributor

https://prow.ci.openshift.org/view/gs/origin-ci-test/pr-logs/pull/28320/pull-ci-openshift-origin-master-e2e-aws-ovn-fips/1719974869644349440 fails with an error that looks to be triggered by this change:

{  fail [github.com/openshift/origin/test/extended/prometheus/prometheus.go:405]: Unexpected error:
    <*fmt.wrapErrors | 0xc00307e360>: 
    Get "https:/prometheus-k8s-openshift-monitoring.apps.ci-op-wl3xfyw5-3182b.aws-2.ci.openshift.org/api/v1/targets": http: no Host in request URL: %!w(<nil>)
    {
        msg: "Get \"https:/prometheus-k8s-openshift-monitoring.apps.ci-op-wl3xfyw5-3182b.aws-2.ci.openshift.org/api/v1/targets\": http: no Host in request URL: %!w(<nil>)",
        errs: [
            <*url.Error | 0xc00307e330>{
                Op: "Get",
                URL: "https:/prometheus-k8s-openshift-monitoring.apps.ci-op-wl3xfyw5-3182b.aws-2.ci.openshift.org/api/v1/targets",
                Err: <*errors.errorString | 0xc001556190>{
                    s: "http: no Host in request URL",
                },
            },
        ],
    }
occurred
Ginkgo exit error 1: exit with code 1}

@simonpasquier
Copy link
Contributor

I suspect that you'll have to create the http.Request in the condition function.

@raptorsun
Copy link
Contributor Author

Thanks for the quick review :D @simonpasquier
The problem comes from the path.Join function, it cut the https://xxx to https:/xxx by eliminating a slash, causing the HTTP request fails.


// url.JoinPath but with no error checks
func JoinUrl(base string, paths ...string) string {
path, _ := url.JoinPath(base, paths...)
Copy link
Contributor

Choose a reason for hiding this comment

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

For safety, it would better to panic if an error is returned (which should never happen)

Suggested change
path, _ := url.JoinPath(base, paths...)
path, err := url.JoinPath(base, paths...)
if err != nil {
panic(err)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, like a throw() :D

@raptorsun
Copy link
Contributor Author

/retest-required

@raptorsun
Copy link
Contributor Author

/retest

1 similar comment
@raptorsun
Copy link
Contributor Author

/retest

@raptorsun
Copy link
Contributor Author

/unhold

@openshift-ci openshift-ci bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 8, 2023
@raptorsun
Copy link
Contributor Author

Thank you for the timely review. @simonpasquier
PR updated accordingly :)

@simonpasquier
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Nov 8, 2023
Copy link
Contributor

openshift-ci bot commented Nov 8, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jan--f, raptorsun, simonpasquier

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

@openshift-ci-robot
Copy link

/retest-required

Remaining retests: 0 against base HEAD 01db63c and 2 for PR HEAD 3b61545 in total

Copy link
Contributor

openshift-ci bot commented Nov 8, 2023

@raptorsun: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
ci/prow/e2e-metal-ipi-ovn-ipv6 3b61545 link false /test e2e-metal-ipi-ovn-ipv6
ci/prow/e2e-gcp-csi 3b61545 link false /test e2e-gcp-csi
ci/prow/e2e-openstack-ovn 3b61545 link false /test e2e-openstack-ovn
ci/prow/e2e-metal-ipi-sdn 3b61545 link false /test e2e-metal-ipi-sdn
ci/prow/e2e-aws-ovn-single-node-upgrade 3b61545 link false /test e2e-aws-ovn-single-node-upgrade
ci/prow/e2e-aws-ovn-single-node-serial 3b61545 link false /test e2e-aws-ovn-single-node-serial

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 29ad128 into openshift:master Nov 8, 2023
17 of 23 checks passed
@openshift-ci-robot
Copy link

@raptorsun: Jira Issue OCPBUGS-18776: All pull requests linked via external trackers have merged:

Jira Issue OCPBUGS-18776 has been moved to the MODIFIED state.

In response to this:

Replace shell call of curl with net/http implementation in Prometheus helper functions.
So that timeout requests will not get truncated and reassembled responses.

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.

condition := func(ctx context.Context) (bool, error) {
resp, err := client.Do(req)
if err != nil {
return false, err
Copy link
Contributor

Choose a reason for hiding this comment

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

we missed here that the error should be captured in lastErr and the function should return false, nil.

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. jira/severity-moderate Referenced Jira bug's severity is moderate for the branch this PR is targeting. jira/valid-bug Indicates that a referenced Jira bug is valid for the branch this PR is targeting. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants