diff --git a/blob_test.go b/blob_test.go index 5d086ba..e50236c 100644 --- a/blob_test.go +++ b/blob_test.go @@ -24,6 +24,7 @@ import ( ) func TestBlobGet(t *testing.T) { + t.Parallel() blobRepo := "/proj/repo" privateRepo := "/proj/private" ctx := context.Background() @@ -299,6 +300,7 @@ func TestBlobGet(t *testing.T) { } func TestBlobPut(t *testing.T) { + t.Parallel() blobRepo := "/proj/repo" // privateRepo := "/proj/private" ctx := context.Background() @@ -736,6 +738,7 @@ func TestBlobPut(t *testing.T) { } func TestBlobCopy(t *testing.T) { + t.Parallel() blobRepoA := "/proj/repo-a" blobRepoB := "/proj/repo-b" ctx := context.Background() diff --git a/cmd/regbot/root.go b/cmd/regbot/root.go index 4caae61..3f5ddd6 100644 --- a/cmd/regbot/root.go +++ b/cmd/regbot/root.go @@ -33,7 +33,7 @@ type rootCmd struct { format string // for Go template formatting of various commands } -// TODO: remove these globals +// TODO: remove globals, configure tests with t.Parallel var ( conf *Config log *logrus.Logger diff --git a/cmd/regctl/root.go b/cmd/regctl/root.go index 70a26ef..9ce5684 100644 --- a/cmd/regctl/root.go +++ b/cmd/regctl/root.go @@ -22,6 +22,7 @@ More details at https://github.com/regclient/regclient` UserAgent = "regclient/regctl" ) +// TODO: remove global, configure tests with t.Parallel var ( log *logrus.Logger ) diff --git a/cmd/regsync/root.go b/cmd/regsync/root.go index 4746a85..faf8e0b 100644 --- a/cmd/regsync/root.go +++ b/cmd/regsync/root.go @@ -55,7 +55,7 @@ type rootCmd struct { missing bool } -// TODO: remove globals +// TODO: remove globals, configure tests with t.Parallel var ( conf *Config log *logrus.Logger diff --git a/config/credhelper_test.go b/config/credhelper_test.go index 5a9516b..1319c01 100644 --- a/config/credhelper_test.go +++ b/config/credhelper_test.go @@ -7,6 +7,7 @@ import ( ) func TestCredHelper(t *testing.T) { + // cannot run cred helper in parallel because of OS working directory race conditions tests := []struct { name string host string diff --git a/config/docker_test.go b/config/docker_test.go index 7d33cc1..13dc89c 100644 --- a/config/docker_test.go +++ b/config/docker_test.go @@ -9,6 +9,7 @@ import ( ) func TestDocker(t *testing.T) { + // cannot run cred helper in parallel because of OS working directory race conditions curPath := os.Getenv("PATH") pwd, err := os.Getwd() if err != nil { @@ -122,6 +123,7 @@ func TestDocker(t *testing.T) { } func TestLoadMissing(t *testing.T) { + // cannot run cred helper in parallel because of OS working directory race conditions cf := conffile.New(conffile.WithFullname("testdata/missing.json")) h, err := dockerParse(cf) if err != nil { diff --git a/config/host_test.go b/config/host_test.go index d684f45..685b046 100644 --- a/config/host_test.go +++ b/config/host_test.go @@ -12,6 +12,7 @@ import ( ) func TestConfig(t *testing.T) { + // cannot run cred helper in parallel because of OS working directory race conditions cwd, err := os.Getwd() if err != nil { t.Errorf("failed checking current directory: %v", err) @@ -439,5 +440,4 @@ func TestConfig(t *testing.T) { } }) } - } diff --git a/image_test.go b/image_test.go index 6189ab5..36cd1f6 100644 --- a/image_test.go +++ b/image_test.go @@ -14,6 +14,7 @@ import ( ) func TestImageCheckBase(t *testing.T) { + t.Parallel() ctx := context.Background() fsOS := rwfs.OSNew("") fsMem := rwfs.MemNew() @@ -62,7 +63,7 @@ func TestImageCheckBase(t *testing.T) { return } - tests := []struct { + tt := []struct { name string opts []ImageOpts r ref.Ref @@ -112,14 +113,14 @@ func TestImageCheckBase(t *testing.T) { }, } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - err := rc.ImageCheckBase(ctx, tt.r, tt.opts...) - if tt.expectErr != nil { + for _, tc := range tt { + t.Run(tc.name, func(t *testing.T) { + err := rc.ImageCheckBase(ctx, tc.r, tc.opts...) + if tc.expectErr != nil { if err == nil { t.Errorf("check base did not fail") - } else if err.Error() != tt.expectErr.Error() && !errors.Is(err, tt.expectErr) { - t.Errorf("error mismatch, expected %v, received %v", tt.expectErr, err) + } else if err.Error() != tc.expectErr.Error() && !errors.Is(err, tc.expectErr) { + t.Errorf("error mismatch, expected %v, received %v", tc.expectErr, err) } } else { if err != nil { @@ -131,6 +132,7 @@ func TestImageCheckBase(t *testing.T) { } func TestCopy(t *testing.T) { + t.Parallel() ctx := context.Background() // create regclient delayInit, _ := time.ParseDuration("0.05s") @@ -212,6 +214,7 @@ func TestCopy(t *testing.T) { } func TestExportImport(t *testing.T) { + t.Parallel() ctx := context.Background() // copy testdata images into memory fsOS := rwfs.OSNew("") diff --git a/internal/ascii/ascii_test.go b/internal/ascii/ascii_test.go index cb13566..1ad5e11 100644 --- a/internal/ascii/ascii_test.go +++ b/internal/ascii/ascii_test.go @@ -6,6 +6,7 @@ import ( ) func TestIsWriterTerminal(t *testing.T) { + t.Parallel() b := make([]byte, 10) buf := bytes.NewBuffer(b) if IsWriterTerminal(buf) { diff --git a/internal/ascii/lines_test.go b/internal/ascii/lines_test.go index e2a90a5..67a55cf 100644 --- a/internal/ascii/lines_test.go +++ b/internal/ascii/lines_test.go @@ -7,6 +7,7 @@ import ( ) func TestLinesWidthZero(t *testing.T) { + t.Parallel() b := make([]byte, 0, 1024) buf := bytes.NewBuffer(b) l := NewLines(buf) @@ -70,6 +71,7 @@ func TestLinesWidthZero(t *testing.T) { } func TestLinesWidthSet(t *testing.T) { + t.Parallel() b := make([]byte, 0, 1024) buf := bytes.NewBuffer(b) l := NewLines(buf) diff --git a/internal/ascii/progress_test.go b/internal/ascii/progress_test.go index b608c1b..10912fb 100644 --- a/internal/ascii/progress_test.go +++ b/internal/ascii/progress_test.go @@ -6,6 +6,7 @@ import ( ) func TestProgress(t *testing.T) { + t.Parallel() // TODO: test scenarios and compare output b := make([]byte, 0, 1024) buf := bytes.NewBuffer(b) diff --git a/internal/auth/auth_test.go b/internal/auth/auth_test.go index d253e1d..f9903a0 100644 --- a/internal/auth/auth_test.go +++ b/internal/auth/auth_test.go @@ -15,6 +15,7 @@ import ( ) func TestParseAuthHeader(t *testing.T) { + t.Parallel() var tests = []struct { name, in string wantC []Challenge @@ -91,6 +92,7 @@ func TestParseAuthHeader(t *testing.T) { // TestAuth checks the auth interface using a mock http server func TestAuth(t *testing.T) { + t.Parallel() clientID := "testClient" token1Resp, _ := json.Marshal(BearerToken{ Token: "token1", @@ -308,6 +310,7 @@ func TestAuth(t *testing.T) { } func TestBearer(t *testing.T) { + t.Parallel() useragent := "regclient/test" user := "user" pass := "testpass" diff --git a/internal/cache/cache_test.go b/internal/cache/cache_test.go index 266d354..34716da 100644 --- a/internal/cache/cache_test.go +++ b/internal/cache/cache_test.go @@ -9,6 +9,7 @@ import ( ) func TestCache(t *testing.T) { + t.Parallel() testData := []string{ "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", diff --git a/internal/conffile/conffile_test.go b/internal/conffile/conffile_test.go index 81fc3f2..906e51c 100644 --- a/internal/conffile/conffile_test.go +++ b/internal/conffile/conffile_test.go @@ -12,6 +12,7 @@ import ( // test New func TestNew(t *testing.T) { + t.Parallel() testEnvFileVar, testEnvFileVal := "TEST_CONFFILE_NEW", "./test-filename.json" os.Setenv(testEnvFileVar, testEnvFileVal) testEnvDirVar, testEnvDirVal := "TEST_CONFDIR_NEW", "./test-dirname" @@ -100,6 +101,7 @@ func TestNew(t *testing.T) { // TestWriteOpen test Write and Open using MemFS func TestWriteOpen(t *testing.T) { + t.Parallel() memfs := rwfs.MemNew() confContent := []byte("hello test") cf := New(WithFS(memfs), WithFullname("test.json")) diff --git a/internal/diff/diff_test.go b/internal/diff/diff_test.go index 08ac284..d015907 100644 --- a/internal/diff/diff_test.go +++ b/internal/diff/diff_test.go @@ -3,6 +3,7 @@ package diff import "testing" func TestDiff(t *testing.T) { + t.Parallel() tests := []struct { name string a, b, expect []string diff --git a/internal/httplink/httplink_test.go b/internal/httplink/httplink_test.go index d1cf23f..7025ee0 100644 --- a/internal/httplink/httplink_test.go +++ b/internal/httplink/httplink_test.go @@ -8,6 +8,7 @@ import ( ) func TestParseErr(t *testing.T) { + t.Parallel() tests := []struct { name string headers []string @@ -60,6 +61,7 @@ func TestParseErr(t *testing.T) { } func TestParseGet(t *testing.T) { + t.Parallel() headerComplex := []string{`; rel="next", ; rel="next", / ; rel=index `, `; media=print`, `/link, /reader; media=reader; type=x`} tests := []struct { name string @@ -135,5 +137,4 @@ func TestParseGet(t *testing.T) { } }) } - } diff --git a/internal/limitread/limitread_test.go b/internal/limitread/limitread_test.go index 980b807..45611ab 100644 --- a/internal/limitread/limitread_test.go +++ b/internal/limitread/limitread_test.go @@ -10,6 +10,7 @@ import ( ) func TestLimitRead(t *testing.T) { + t.Parallel() byte0 := []byte("") byte5 := []byte("12345") byte10 := []byte("1234567890") diff --git a/internal/muset/muset_test.go b/internal/muset/muset_test.go index 6442110..b682ce7 100644 --- a/internal/muset/muset_test.go +++ b/internal/muset/muset_test.go @@ -7,6 +7,7 @@ import ( ) func TestMuset(t *testing.T) { + t.Parallel() // test acquiring sets of locks, sleep between changes to force out race conditions var muA, muB, muC sync.Mutex // empty set diff --git a/internal/reghttp/http_test.go b/internal/reghttp/http_test.go index 2d293ee..9edbabc 100644 --- a/internal/reghttp/http_test.go +++ b/internal/reghttp/http_test.go @@ -27,6 +27,7 @@ import ( // TODO: test rate limits and concurrency func TestRegHttp(t *testing.T) { + t.Parallel() ctx := context.Background() // setup req/resp useragent := "regclient/test" diff --git a/internal/rwfs/mem_test.go b/internal/rwfs/mem_test.go index 866fb3e..6f18111 100644 --- a/internal/rwfs/mem_test.go +++ b/internal/rwfs/mem_test.go @@ -3,6 +3,7 @@ package rwfs import "testing" func TestMem(t *testing.T) { + t.Parallel() fs := MemNew() if fs == nil { t.Errorf("MemNew returned nil") diff --git a/internal/rwfs/os_test.go b/internal/rwfs/os_test.go index d16df7f..ccf20a5 100644 --- a/internal/rwfs/os_test.go +++ b/internal/rwfs/os_test.go @@ -5,6 +5,7 @@ import ( ) func TestOS(t *testing.T) { + t.Parallel() tempDir := t.TempDir() t.Logf("tempdir: %s", tempDir) fs := OSNew(tempDir) diff --git a/internal/throttle/throttle_test.go b/internal/throttle/throttle_test.go index ab41d49..8574026 100644 --- a/internal/throttle/throttle_test.go +++ b/internal/throttle/throttle_test.go @@ -9,6 +9,7 @@ import ( ) func TestNil(t *testing.T) { + t.Parallel() ctx := context.Background() var tNil *Throttle err := tNil.Acquire(ctx) @@ -30,6 +31,7 @@ func TestNil(t *testing.T) { } func TestSingleThrottle(t *testing.T) { + t.Parallel() ctx, cancel := context.WithCancel(context.Background()) defer cancel() wg := sync.WaitGroup{} @@ -125,6 +127,7 @@ func TestSingleThrottle(t *testing.T) { } func TestCapacity(t *testing.T) { + t.Parallel() t3 := New(3) wg := sync.WaitGroup{} ctx := context.Background() @@ -194,6 +197,7 @@ func TestCapacity(t *testing.T) { } func TestMulti(t *testing.T) { + t.Parallel() ctx, cancel := context.WithCancel(context.Background()) defer cancel() tList := make([]*Throttle, 4) diff --git a/internal/timejson/timejson_test.go b/internal/timejson/timejson_test.go index 62fa2c6..60ce6d1 100644 --- a/internal/timejson/timejson_test.go +++ b/internal/timejson/timejson_test.go @@ -9,6 +9,7 @@ import ( ) func TestMarshal(t *testing.T) { + t.Parallel() tests := []struct { name string d Duration @@ -41,6 +42,7 @@ func TestMarshal(t *testing.T) { } func TestUnmarshal(t *testing.T) { + t.Parallel() tests := []struct { name string str string diff --git a/internal/units/size_test.go b/internal/units/size_test.go index dc3efdd..4ae478a 100644 --- a/internal/units/size_test.go +++ b/internal/units/size_test.go @@ -3,6 +3,7 @@ package units import "testing" func TestHuman(t *testing.T) { + t.Parallel() tests := []struct { name string size float64 diff --git a/internal/version/version_test.go b/internal/version/version_test.go index 3e5e0c4..31ae7a8 100644 --- a/internal/version/version_test.go +++ b/internal/version/version_test.go @@ -6,6 +6,7 @@ import ( ) func TestVersion(t *testing.T) { + t.Parallel() i := GetInfo() ij, err := json.MarshalIndent(i, "", " ") if err != nil { diff --git a/manifest_test.go b/manifest_test.go index 0c6806f..331b1e3 100644 --- a/manifest_test.go +++ b/manifest_test.go @@ -25,6 +25,7 @@ import ( ) func TestManifest(t *testing.T) { + t.Parallel() repoPath := "/proj" getTag := "get" headTag := "head" @@ -378,5 +379,4 @@ func TestManifest(t *testing.T) { return } }) - } diff --git a/mod/mod_test.go b/mod/mod_test.go index 7aa4229..88d1f10 100644 --- a/mod/mod_test.go +++ b/mod/mod_test.go @@ -19,6 +19,7 @@ import ( ) func TestMod(t *testing.T) { + t.Parallel() ctx := context.Background() // copy testdata images into memory fsOS := rwfs.OSNew("") @@ -745,6 +746,7 @@ func TestMod(t *testing.T) { } func TestInList(t *testing.T) { + t.Parallel() t.Run("match", func(t *testing.T) { if !inListStr(types.MediaTypeDocker2LayerGzip, mtWLTar) { t.Errorf("did not find docker layer in tar whitelist") diff --git a/mod/time_test.go b/mod/time_test.go index 5a57472..5c1f9e2 100644 --- a/mod/time_test.go +++ b/mod/time_test.go @@ -8,6 +8,7 @@ import ( ) func TestTimeNow(t *testing.T) { + t.Parallel() curEnv, envIsSet := os.LookupEnv(epocEnv) defer func() { if envIsSet { diff --git a/regclient_test.go b/regclient_test.go index 5f72dfe..2bef173 100644 --- a/regclient_test.go +++ b/regclient_test.go @@ -9,6 +9,7 @@ import ( ) func TestNew(t *testing.T) { + t.Parallel() logPtr := logrus.New() tt := []struct { name string @@ -99,5 +100,4 @@ func TestNew(t *testing.T) { } }) } - } diff --git a/scheme/ocidir/blob_test.go b/scheme/ocidir/blob_test.go index 8417f2a..8c08248 100644 --- a/scheme/ocidir/blob_test.go +++ b/scheme/ocidir/blob_test.go @@ -15,6 +15,7 @@ import ( ) func TestBlob(t *testing.T) { + t.Parallel() ctx := context.Background() f := rwfs.OSNew("") o := New(WithFS(f)) @@ -168,5 +169,4 @@ func TestBlob(t *testing.T) { if !bytes.Equal(fBytes, bBytes) { t.Errorf("blob put bytes, expected %s, saw %s", string(bBytes), string(fBytes)) } - } diff --git a/scheme/ocidir/close_test.go b/scheme/ocidir/close_test.go index a6ffbca..e234f55 100644 --- a/scheme/ocidir/close_test.go +++ b/scheme/ocidir/close_test.go @@ -12,6 +12,7 @@ import ( ) func TestClose(t *testing.T) { + t.Parallel() ctx := context.Background() fsOS := rwfs.OSNew("") fsMem := rwfs.MemNew() @@ -84,5 +85,4 @@ func TestClose(t *testing.T) { fh.Close() } } - } diff --git a/scheme/ocidir/manifest_test.go b/scheme/ocidir/manifest_test.go index f83d9c7..5610a81 100644 --- a/scheme/ocidir/manifest_test.go +++ b/scheme/ocidir/manifest_test.go @@ -19,6 +19,7 @@ import ( ) func TestManifest(t *testing.T) { + t.Parallel() ctx := context.Background() // copy testdata images into memory fsOS := rwfs.OSNew("") @@ -226,5 +227,4 @@ func TestManifest(t *testing.T) { if err != nil { t.Errorf("could not query manifest after pushing dup tag") } - } diff --git a/scheme/ocidir/ocidir_test.go b/scheme/ocidir/ocidir_test.go index 856c094..3585658 100644 --- a/scheme/ocidir/ocidir_test.go +++ b/scheme/ocidir/ocidir_test.go @@ -34,6 +34,7 @@ func cmpSliceString(a, b []string) bool { } func TestIndex(t *testing.T) { + t.Parallel() // ctx := context.Background() fsMem := rwfs.MemNew() o := New(WithFS(fsMem)) diff --git a/scheme/ocidir/referrer_test.go b/scheme/ocidir/referrer_test.go index 6418931..f7f7ce5 100644 --- a/scheme/ocidir/referrer_test.go +++ b/scheme/ocidir/referrer_test.go @@ -19,6 +19,7 @@ import ( ) func TestReferrer(t *testing.T) { + t.Parallel() ctx := context.Background() fsOS := rwfs.OSNew("") fsMem := rwfs.MemNew() @@ -348,7 +349,6 @@ func TestReferrer(t *testing.T) { return } }) - } func mapStringStringEq(a, b map[string]string) bool { diff --git a/scheme/ocidir/tag_test.go b/scheme/ocidir/tag_test.go index f728e2b..da27eae 100644 --- a/scheme/ocidir/tag_test.go +++ b/scheme/ocidir/tag_test.go @@ -11,6 +11,7 @@ import ( ) func TestTag(t *testing.T) { + t.Parallel() ctx := context.Background() fsOS := rwfs.OSNew("") fsMem := rwfs.MemNew() diff --git a/scheme/reg/blob_test.go b/scheme/reg/blob_test.go index 7a8143c..80e62f1 100644 --- a/scheme/reg/blob_test.go +++ b/scheme/reg/blob_test.go @@ -25,6 +25,7 @@ import ( ) func TestBlobGet(t *testing.T) { + t.Parallel() blobRepo := "/proj/repo" externalRepo := "/proj/external" privateRepo := "/proj/private" @@ -359,10 +360,10 @@ func TestBlobGet(t *testing.T) { t.Errorf("Error does not match \"ErrUnauthorized\": %v", err) } }) - } func TestBlobPut(t *testing.T) { + t.Parallel() blobRepo := "/proj/repo" // privateRepo := "/proj/private" ctx := context.Background() diff --git a/scheme/reg/manifest_test.go b/scheme/reg/manifest_test.go index bdcb741..39c9f97 100644 --- a/scheme/reg/manifest_test.go +++ b/scheme/reg/manifest_test.go @@ -25,6 +25,7 @@ import ( ) func TestManifest(t *testing.T) { + t.Parallel() repoPath := "/proj" getTag := "get" bigTag := "big" diff --git a/scheme/reg/referrer_test.go b/scheme/reg/referrer_test.go index 37d94b8..595582e 100644 --- a/scheme/reg/referrer_test.go +++ b/scheme/reg/referrer_test.go @@ -26,6 +26,7 @@ import ( ) func TestReferrer(t *testing.T) { + t.Parallel() // setup http server with and without API support ctx := context.Background() repoPath := "/proj" diff --git a/scheme/reg/repo_test.go b/scheme/reg/repo_test.go index 563dc7a..a195e1b 100644 --- a/scheme/reg/repo_test.go +++ b/scheme/reg/repo_test.go @@ -21,6 +21,7 @@ import ( ) func TestRepo(t *testing.T) { + t.Parallel() ctx := context.Background() partialLen := 2 listRegistry := []string{ diff --git a/scheme/reg/tag_test.go b/scheme/reg/tag_test.go index 504f1d5..0d7c329 100644 --- a/scheme/reg/tag_test.go +++ b/scheme/reg/tag_test.go @@ -25,6 +25,7 @@ import ( ) func TestTag(t *testing.T) { + t.Parallel() repoPath := "/proj" repoPath2 := "/proj2" pageLen := 2 diff --git a/types/descriptor_test.go b/types/descriptor_test.go index 5c52fa1..4e0789d 100644 --- a/types/descriptor_test.go +++ b/types/descriptor_test.go @@ -13,6 +13,7 @@ import ( ) func TestDescriptorData(t *testing.T) { + t.Parallel() tt := []struct { name string d Descriptor @@ -80,6 +81,7 @@ func TestDescriptorData(t *testing.T) { } func TestDescriptorEq(t *testing.T) { + t.Parallel() digA := digest.FromString("test A") digB := digest.FromString("test B") tt := []struct { @@ -447,6 +449,7 @@ func TestDescriptorEq(t *testing.T) { } func TestDataJSON(t *testing.T) { + t.Parallel() tests := []struct { name string dJSON []byte @@ -534,6 +537,7 @@ func TestDataJSON(t *testing.T) { } func TestDescriptorSearch(t *testing.T) { + t.Parallel() dAMD64 := Descriptor{ MediaType: MediaTypeOCI1Manifest, Size: 12345, @@ -781,5 +785,4 @@ func TestDescriptorSearch(t *testing.T) { } }) } - } diff --git a/types/manifest/manifest_test.go b/types/manifest/manifest_test.go index 7147664..52542aa 100644 --- a/types/manifest/manifest_test.go +++ b/types/manifest/manifest_test.go @@ -401,6 +401,7 @@ var ( ) func TestNew(t *testing.T) { + t.Parallel() r, _ := ref.New("localhost:5000/test:latest") var manifestDockerSchema2, manifestInvalid schema2.Manifest var manifestDockerSchema1Signed schema1.SignedManifest @@ -1059,6 +1060,7 @@ func TestNew(t *testing.T) { } func TestModify(t *testing.T) { + t.Parallel() addDigest := digest.FromString("new layer digest") addDesc := types.Descriptor{ Digest: addDigest, @@ -1288,6 +1290,7 @@ func TestModify(t *testing.T) { // test set methods for config, layers, and manifest list func TestSet(t *testing.T) { + t.Parallel() addDigest := digest.FromString("new digest") addDesc := types.Descriptor{ Digest: addDigest, @@ -1478,7 +1481,6 @@ func TestSet(t *testing.T) { } else if tt.expectAnnot { t.Errorf("annotation methods not found") } - }) } } diff --git a/types/mediatype_test.go b/types/mediatype_test.go index 6a023fa..b2fb7c2 100644 --- a/types/mediatype_test.go +++ b/types/mediatype_test.go @@ -3,6 +3,7 @@ package types import "testing" func TestMediaTypeBase(t *testing.T) { + t.Parallel() tt := []struct { name string orig string @@ -28,5 +29,4 @@ func TestMediaTypeBase(t *testing.T) { } }) } - } diff --git a/types/ref/ref_test.go b/types/ref/ref_test.go index c573a0c..1fbe641 100644 --- a/types/ref/ref_test.go +++ b/types/ref/ref_test.go @@ -9,6 +9,7 @@ import ( ) func TestRef(t *testing.T) { + t.Parallel() var tests = []struct { name string ref string @@ -422,6 +423,7 @@ func TestRef(t *testing.T) { } func TestCommon(t *testing.T) { + t.Parallel() tests := []struct { name string str string @@ -459,6 +461,7 @@ func TestCommon(t *testing.T) { } func TestEqual(t *testing.T) { + t.Parallel() tests := []struct { name string a, b Ref @@ -596,6 +599,7 @@ func TestEqual(t *testing.T) { } func TestToReg(t *testing.T) { + t.Parallel() tests := []struct { name string inRef string @@ -635,5 +639,4 @@ func TestToReg(t *testing.T) { } }) } - } diff --git a/types/referrer/referrer_test.go b/types/referrer/referrer_test.go index 48a1178..316d416 100644 --- a/types/referrer/referrer_test.go +++ b/types/referrer/referrer_test.go @@ -169,6 +169,7 @@ func init() { } func TestEmpty(t *testing.T) { + t.Parallel() // create an empty list and full list, test is empty rlEmpty := &ReferrerList{ Descriptors: []types.Descriptor{}, @@ -215,6 +216,7 @@ func TestEmpty(t *testing.T) { } func TestAdd(t *testing.T) { + t.Parallel() tests := []struct { name string m manifest.Manifest @@ -284,6 +286,7 @@ func TestAdd(t *testing.T) { } func TestDelete(t *testing.T) { + t.Parallel() rl := &ReferrerList{ Descriptors: []types.Descriptor{ dOCIImg, diff --git a/types/repo/repolist_test.go b/types/repo/repolist_test.go index 9e5dd72..abfba90 100644 --- a/types/repo/repolist_test.go +++ b/types/repo/repolist_test.go @@ -12,6 +12,7 @@ import ( ) func TestNew(t *testing.T) { + t.Parallel() emptyRaw := []byte("{}") registryList := []string{"library/alpine", "library/debian", "library/golang"} registryRaw := []byte(fmt.Sprintf(`{"repositories":["%s"]}`, strings.Join(registryList, `","`))) diff --git a/types/tag/taglist_test.go b/types/tag/taglist_test.go index bd0c18a..c5bfa19 100644 --- a/types/tag/taglist_test.go +++ b/types/tag/taglist_test.go @@ -15,6 +15,7 @@ import ( ) func TestNew(t *testing.T) { + t.Parallel() emptyRaw := []byte("{}") registryTags := []string{"cache", "edge", "edge-alpine", "alpine", "latest"} reqURL, err := url.Parse("http://localhost:5000/v2/regclient/test/tag/list") @@ -245,6 +246,7 @@ func TestNew(t *testing.T) { } func TestAppend(t *testing.T) { + t.Parallel() expectTags := []string{"1", "2", "3", "4", "5", "6"} tl1, err := New( WithTags(expectTags[:3]), diff --git a/types/warning/warning_test.go b/types/warning/warning_test.go index d61a0a2..916061d 100644 --- a/types/warning/warning_test.go +++ b/types/warning/warning_test.go @@ -10,6 +10,7 @@ import ( ) func TestWarning(t *testing.T) { + t.Parallel() msg1 := "test 1" msg2 := "test 2" ctxBase := context.Background()