twt::do_request (public)

 twt::do_request page_url

Defined in packages/acs-automated-testing/tcl/tclwebtest-procs.tcl

Takes a URL and invokes tclwebtest::do_request. Will retry the request a number of times if it fails because of a socket connect problem.

Parameters:
page_url (required)

Partial Call Graph (max 5 caller/called nodes):
%3 faq::twt::delete faq::twt::delete (private) twt::do_request twt::do_request faq::twt::delete->twt::do_request faq::twt::delete_Q_A faq::twt::delete_Q_A (private) faq::twt::delete_Q_A->twt::do_request faq::twt::disable_enable faq::twt::disable_enable (private) faq::twt::disable_enable->twt::do_request faq::twt::edit_Q_A faq::twt::edit_Q_A (private) faq::twt::edit_Q_A->twt::do_request faq::twt::edit_one faq::twt::edit_one (private) faq::twt::edit_one->twt::do_request aa_log aa_log (public) twt::do_request->aa_log acs::test::url acs::test::url (public) twt::do_request->acs::test::url twt::log twt::log (public) twt::do_request->twt::log

Testcases:
No testcase defined.
Source code:
    aa_log "twt::do_request $page_url"

    # Qualify page_url if necessary
    if { [regexp {^/} $page_url] } {
        set page_url [acs::test::url]${page_url}
    }

    set retry_count 0
    set retry_max 10
    set error_p 0
    while { [catch {::tclwebtest::do_request $page_url} errmsg] } {
        set error_p 1

        if { $retry_count < $retry_max } {
            switch -regexp -- $errmsg {
                {unreachable} - {refused} {
                    ::twt::log "Failed to connect to server with error \"$errmsg\" - retrying"
                    incr retry_count
                    ns_sleep 5s
                    set error_p 0
                    continue
                }
                default {
                    ::twt::log "Failed to connect to server with error \"$errmsg\" - giving up"
                    break
                }
            }
        } else {
            break
        }
    }

    if { $error_p } {
        # Either some non-socket error, or a socket problem occurring with more than
        # $retry_max times. Propagate the error while retaining the stack trace
        aa_log "twt::do_request failed with error=\"$errmsg\" response_url=\"[tclwebtest::response url]\". See error log for the HTML response body"
        ns_log Error "twt::do_request failed with error=\"$errmsg\" response_url=\"[tclwebtest::response url]\" response_body=\"[tclwebtest::response body]\""
        error $errmsg $::errorInfo
    }
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: