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: dir_root_scan_regression_test.go
    path of file: ./repos/syft/test/cli
    
    the code of the file until where you have to start completion: package cli

import (
	"os/exec"
	"testing"
	"time"
)

func TestDirectoryScanCompletesWithinTimeout(t *testing.T) {
	image := "alpine:latest"

	// we want to pull the image ahead of the test as to not affect the timeout value
	pullDockerImage(t, image)

	var cmd *exec.Cmd
	var stdout, stderr string
	done := make(chan struct{})
	go func() {
		defer close(done)
		cmd, stdout, stderr = runSyftI
    
func TestDirectoryScanCompletesWithinTimeout(t *testing.T) {
	image := "alpine:latest"

	// we want to pull the image ahead of the test as to not affect the timeout value
	pullDockerImage(t, image)

	var cmd *exec.Cmd
	var stdout, stderr string
	done := make(chan struct{})
	go func() {
		defer close(done)
		cmd, stdout, stderr = runSyftInDocker(t, nil, image, "dir:/", "-vv")
	}()

	select {
	case <-done:
		break
	case <-time.After(10 * time.Second):
		t.Fatalf("directory scan is taking too long")
	}

	assertions := []traitAssertion{
		assertTableReport,
		assertSuccessfulReturnCode,
	}

	for _, traitFn := range assertions {
		traitFn(t, stdout, stderr, cmd.ProcessState.ExitCode())
	}

	logOutputOnFailure(t, cmd, stdout, stderr)

}