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: serviceprofiles_test.go
    path of file: ./repos/linkerd2/test/integration/viz/serviceprofiles
    
    the code of the file until where you have to start completion: package serviceprofiles

import (
	"context"
	"errors"
	"fmt"
	"os"
	"strings"
	"testing"
	"time"

	sp "github.com/linkerd/linkerd2/controller/gen/apis/serviceprofile/v1alpha2"
	"github.com/linkerd/linkerd2/testutil"
	cmd2 "github.com/linkerd/linkerd2/viz/cmd"
	"sigs.k8s.io/yaml"
)

var TestHelper *testutil.TestHelper

type testCase struct {
	args           []string
	deployName     string
	expectedRoutes []string
	namespace      string
	sourceName     string
	spName         string
}

func TestMain(m *testing.M) {
	TestHelp
    
func testMetrics(t *testing.T) {
	var (
		testNamespace        = TestHelper.GetTestNamespace("serviceprofile-test")
		testSP               = "world-svc"
		testDownstreamDeploy = "deployment/world"
		testUpstreamDeploy   = "deployment/hello"
		testYAML             = "testdata/hello_world.yaml"
	)

	out, err := TestHelper.LinkerdRun("inject", "--manual", testYAML)
	if err != nil {
		testutil.AnnotatedError(t, "'linkerd inject' command failed", err)
	}

	out, err = TestHelper.KubectlApply(out, testNamespace)
	if err != nil {
		testutil.AnnotatedErrorf(t, "'kubectl apply' command failed",
			"'kubectl apply' command failed\n%s", out)
	}

	cmd := []string{
		"profile",
		"--namespace",
		testNamespace,
		"--open-api",
		"testdata/world.swagger",
		testSP,
	}

	out, err = TestHelper.LinkerdRun(cmd...)
	if err != nil {
		testutil.AnnotatedError(t, fmt.Sprintf("'linkerd %s' command failed", cmd), err)
	}

	_, err = TestHelper.KubectlApply(out, testNamespace)
	if err != nil {
		testutil.AnnotatedErrorf(t, "'kubectl apply' command failed",
			"'kubectl apply' command failed\n%s", err)
	}

	assertRouteStat(testUpstreamDeploy, testNamespace, testDownstreamDeploy, t, func(stat *cmd2.JSONRouteStats) error {
		if !(*stat.ActualSuccess > 0.00 && *stat.ActualSuccess < 100.00) {
			return fmt.Errorf("expected Actual Success to be greater than 0%% and less than 100%% due to pre-seeded failure rate. But got %0.2f", *stat.ActualSuccess)
		}
		return nil
	})

	profile := &sp.ServiceProfile{}

	// Grab the output and convert it to a service profile object for modification
	err = yaml.Unmarshal([]byte(out), profile)
	if err != nil {
		testutil.AnnotatedErrorf(t, "unable to unmarshal YAML",
			"unable to unmarshal YAML: %s", err)
	}

	// introduce retry in the service profile
	for _, route := range profile.Spec.Routes {
		if route.Name == "GET /testpath" {
			route.IsRetryable = true
			break
		}
	}

	bytes, err := yaml.Marshal(profile)
	if err != nil {
		testutil.AnnotatedErrorf(t, "error marshalling service profile",
			"error marshalling service profile: %s", bytes)
	}

	out, err = TestHelper.KubectlApply(string(bytes), testNamespace)
	if err != nil {
		testutil.AnnotatedErrorf(t, "'kubectl apply' command failed",
			"'kubectl apply' command failed:\n%s :%s", err, out)
	}

	assertRouteStat(testUpstreamDeploy, testNamespace, testDownstreamDeploy, t, func(stat *cmd2.JSONRouteStats) error {
		if *stat.EffectiveSuccess < 0.95 {
			return fmt.Errorf("expected Effective Success to be at least 95%% with retries enabled. But got %.2f", *stat.EffectiveSuccess)
		}
		return nil
	})
}