You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: operations_test.go
    path of file: ./repos/heketi/apps/glusterfs
    
    the code of the file until where you have to start completion: package glusterfs

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"net/http/httptest"
	"os"
	"strings"
	"testing"
	"time"

	"github.com/heketi/heketi/v10/executors"
	"github.com/heketi/heketi/v10/pkg/glusterfs/api"

	"github.com/boltdb/bolt"
	"github.com/heketi/tests"

	"github.com/gorilla/mux"
)

type testOperation struct {
	label    string
	rurl     string
	
    
func TestAsyncHttpOperationExecFailure(t *testing.T) {
	o := &testOperation{}
	o.rurl = "/myresource"
	o.exec = func() error {
		return fmt.Errorf("execfail")
	}
	testAsyncHttpOperation(t, o, func(t *testing.T, url string) {
		client := &http.Client{
			CheckRedirect: func(req *http.Request, via []*http.Request) error {
				return http.ErrUseLastResponse
			},
		}
		r, err := client.Get(url + "/app")
		tests.Assert(t, err == nil, "expected err == nil, got", err)
		tests.Assert(t, r.StatusCode == http.StatusAccepted)
		location, err := r.Location()
		tests.Assert(t, err == nil)

		for done := false; !done; {
			time.Sleep(time.Millisecond)
			r, err = client.Get(location.String())
			tests.Assert(t, err == nil, "expected err == nil, got", err)
			switch r.StatusCode {
			case http.StatusSeeOther:
				location, err = r.Location()
				tests.Assert(t, err == nil, "expected err == nil, got", err)
				tests.Assert(t, strings.Contains(location.String(), "/myresource"),
					`expected trings.Contains(location.String(), "/myresource") got:`,
					location.String())
			case http.StatusInternalServerError:
				if r.ContentLength > 0 {
					body, err := ioutil.ReadAll(r.Body)
					r.Body.Close()
					tests.Assert(t, err == nil)
					s := string(body)
					tests.Assert(t, strings.Contains(s, "execfail"),
						`expected strings.Contains(s, "execfail"), got:`, s)
					done = true
				} else {
					t.Fatalf("unexpected content length %v", r.ContentLength)
				}
			default:
				t.Fatalf("unexpected http return code %v", r.StatusCode)
			}
		}
	})
}