MCPcopy
hub / github.com/dgraph-io/dgraph / VerifyCurlCmd

Function VerifyCurlCmd

testutil/client.go:629–648  ·  view source on GitHub ↗

VerifyCurlCmd executes the curl command with the given arguments and verifies the result against the expected output.

(t *testing.T, args []string, failureConfig *CurlFailureConfig)

Source from the content-addressed store, hash-verified

627// VerifyCurlCmd executes the curl command with the given arguments and verifies
628// the result against the expected output.
629func VerifyCurlCmd(t *testing.T, args []string, failureConfig *CurlFailureConfig) {
630top:
631 queryCmd := exec.Command("curl", args...)
632 output, err := queryCmd.Output()
633 if len(failureConfig.CurlErrMsg) > 0 {
634 // the curl command should have returned an non-zero code
635 require.Error(t, err, "the curl command should have failed")
636 if ee, ok := err.(*exec.ExitError); ok {
637 require.Contains(t, string(ee.Stderr), failureConfig.CurlErrMsg,
638 "the curl output does not contain the expected output")
639 }
640 } else {
641 require.NoError(t, err, "the curl command should have succeeded")
642 if err := verifyOutput(t, output, failureConfig); err == errRetryCurl {
643 goto top
644 } else {
645 require.NoError(t, err)
646 }
647 }
648}
649
650// AssignUids talks to zero to assign the given number of uids.
651func AssignUids(num uint64) error {

Calls 3

verifyOutputFunction · 0.85
OutputMethod · 0.80
ErrorMethod · 0.45