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: codegen_nonreg_test.go
    path of file: ./repos/go-swagger/hack
    
    the code of the file until where you have to start completion: //go:build ignore

package main

import (
	"flag"
	"fmt"
	"log"
	"os"
	"path/filepath"
	"regexp"
	"strings"
	"testing"
	"time"

	//color "github.com/logrusorgru/aurora"
	"github.com/stretchr/testify/assert"
	"github.com/stretchr/testify/require"
	"gopkg.in/yaml.v3"
	"gotest.tools/icmd"
)

const (
	defaultFixtureFile = "codegen-fixtures.yaml"
	genDir             = "./tmp-gen"
	serverName         = "nrcodegen"

	// run options

	FullFlatten    = "--with-flatten=full"
	MinimalFlatten = "--with-flatten=minimal"
	Expand         = "--with-flatten=expand"
	SkipValidation = "--skip-validation"
)

// skipT indicates known failures to skip in the test suite
type skipT struct {
	// known failures to be skipped
	KnownFailure               bool `yaml:"knownFailure,omitempty"`
	KnownValidationFailure     bool `yaml:"knownValidationFailure,omitempty"`
	KnownClientFailure         bool `yaml:"knownClientFailure,omitempty"`
	KnownServerFailure         bool `yaml:"knownServerFailur
    
func TestCodegen(t *testing.T) {
	repoPath := getRepoPath(t)

	if args.fixtureFile == "" {
		args.fixtureFile = defaultFixtureFile
	}

	fixtures := loadFixtures(t, args.fixtureFile)

	err := os.Chdir(repoPath)
	require.NoError(t, err)

	_ = os.RemoveAll(genDir)

	err = os.MkdirAll(genDir, os.ModeDir|os.ModePerm)
	require.NoError(t, err)
	info(t, "target generation in %s", genDir)

	globalOpts := skipT{
		SkipFullFlatten: args.skipFlatten,
		SkipExpand:      args.skipExpand,
		SkipModel:       args.skipModels,
		SkipClient:      args.skipClients,
		SkipServer:      args.skipServers,
	}

	specMap := buildFixtures(t, fixtures)
	cmdOpts := []icmd.CmdOp{icmd.Dir(repoPath)}

	info(t, "running codegen for %d specs", len(specMap))

	if globalOpts.SkipClient {
		info(t, "configured to skip client generations")
	}
	if globalOpts.SkipServer {
		info(t, "configured to skip server generations")
	}
	if globalOpts.SkipModel {
		info(t, "configured to skip model generation")
	}
	if globalOpts.SkipFullFlatten {
		info(t, "configured to skip full flatten mode from generation runs")
	}
	if globalOpts.SkipExpand {
		info(t, "configured to skip expand mode from generation runs")
	}

	for key, value := range specMap {
		spec := key
		skip := value
		if args.runPattern != "" {
			// include filter on a spec name pattern
			re, err := regexp.Compile(args.runPattern)
			require.NoError(t, err)
			if !re.MatchString(spec) {
				continue
			}
		}
		if args.excludePattern != "" {
			// exclude filter on a spec name pattern
			re, err := regexp.Compile(args.excludePattern)
			require.NoError(t, err)
			if re.MatchString(spec) {
				continue
			}
		}
		t.Run(spec, func(t *testing.T) {
			t.Parallel()
			info(t, "codegen for spec %s", spec)
			runs := buildRuns(t, spec, skip, globalOpts)

			for _, toPin2 := range runs {
				run := toPin2
				if run.Skip {
					warn(t, "%s: not tested against full build because of known codegen issues", spec)
					continue
				}

				t.Run(run.Name, func(t *testing.T) {
					t.Parallel()
					if !run.GenClient && !skip.SkipClient || !run.GenModel && !skip.SkipModel || !run.GenServer && !skip.SkipServer {
						info(t, "%s: some generations skipped ", spec)
					}

					info(t, "run %s for %s", run.Name, spec)

					if run.GenModel {
						t.Run("swagger generate model", func(t *testing.T) {
							generateModel(t, spec, cmdOpts, run.Opts()...)
							buildModel(t, run.Target)
						})
					}

					if run.GenServer {
						t.Run("swagger generate server", func(t *testing.T) {
							generateServer(t, spec, cmdOpts, run.Opts()...)
							buildServer(t, run.Target)
						})
					}

					if run.GenClient {
						if skip.IncludeCLI {
							t.Run("swagger generate cli", func(t *testing.T) {
								generateCLI(t, spec, cmdOpts, run.Opts()...)
								buildCLI(t, run.Target)
							})
						} else {
							t.Run("swagger generate client", func(t *testing.T) {
								generateClient(t, spec, cmdOpts, run.Opts()...)
								buildClient(t, run.Target)
							})
						}
					}
				})
			}
		})
	}
}