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: wfengine_test.go
    path of file: ./repos/dapr/pkg/runtime/wfengine
    
    the code of the file until where you have to start completion: //go:build unit
// +build unit

/*
Copyright 2023 The Dapr Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

	http://www.apache.org/licenses/LICENSE-2.0

Unless require
    
func TestRetryActivityOnTimeout(t *testing.T) {
	r := task.NewTaskRegistry()
	r.AddOrchestratorN("FlakyWorkflow", func(ctx *task.OrchestrationContext) (any, error) {
		var output int
		err := ctx.CallActivity("FlakyActivity").Await(&output)
		return output, err
	})

	const expectedCallCount = 3
	actualCallCount := atomic.Int32{}

	r.AddActivityN("FlakyActivity", func(ctx task.ActivityContext) (any, error) {
		// update this global counter each time the activity gets invoked
		acc := actualCallCount.Add(1)
		if acc < expectedCallCount {
			// simulate a hang for the first two calls
			time.Sleep(5 * time.Minute)
		}
		return acc, nil
	})

	ctx := context.Background()
	client, engine := startEngine(ctx, t, r)

	abe, _ := engine.Backend.(*actorsbe.ActorBackend)

	// Set a really short timeout to override the default activity timeout (1 hour at the time of writing)
	// so that we can exercise the timeout handling codepath in a short period of time.
	abe.SetActivityTimeout(1 * time.Second)

	// Set a really short reminder interval to retry activities immediately after they time out.
	abe.SetActorReminderInterval(1 * time.Millisecond)

	for _, opt := range GetTestOptions() {
		t.Run(opt(engine), func(t *testing.T) {
			actualCallCount.Store(0)

			id, err := client.ScheduleNewOrchestration(ctx, "FlakyWorkflow")
			require.NoError(t, err)
			// Add a 5 second timeout so that the test doesn't take forever if something isn't working
			timeoutCtx, cancel := context.WithTimeout(ctx, 5*time.Second)
			defer cancel()

			metadata, err := client.WaitForOrchestrationCompletion(timeoutCtx, id)
			require.NoError(t, err)
			assert.True(t, metadata.IsComplete())
			assert.Equal(t, strconv.Itoa(expectedCallCount), metadata.SerializedOutput)
		})
	}
}