(t *testing.T)
| 33 | ) |
| 34 | |
| 35 | func TestProcess(t *testing.T) { |
| 36 | t.Parallel() |
| 37 | ctx := context.Background() |
| 38 | boolT := true |
| 39 | var err error |
| 40 | tempDir := t.TempDir() |
| 41 | err = copyfs.Copy(tempDir+"/testrepo", "../../testdata/testrepo") |
| 42 | if err != nil { |
| 43 | t.Fatalf("failed to copy testrepo to tempdir: %v", err) |
| 44 | } |
| 45 | err = copyfs.Copy(tempDir+"/external", "../../testdata/external") |
| 46 | if err != nil { |
| 47 | t.Fatalf("failed to copy external to tempdir: %v", err) |
| 48 | } |
| 49 | regHandler := olareg.New(oConfig.Config{ |
| 50 | Storage: oConfig.ConfigStorage{ |
| 51 | StoreType: oConfig.StoreMem, |
| 52 | RootDir: "../../testdata", |
| 53 | }, |
| 54 | }) |
| 55 | ts := httptest.NewServer(regHandler) |
| 56 | tsURL, _ := url.Parse(ts.URL) |
| 57 | tsHost := tsURL.Host |
| 58 | regROHandler := olareg.New(oConfig.Config{ |
| 59 | Storage: oConfig.ConfigStorage{ |
| 60 | StoreType: oConfig.StoreMem, |
| 61 | RootDir: "../../testdata", |
| 62 | ReadOnly: &boolT, |
| 63 | }, |
| 64 | }) |
| 65 | tsRO := httptest.NewServer(regROHandler) |
| 66 | tsROURL, _ := url.Parse(tsRO.URL) |
| 67 | tsROHost := tsROURL.Host |
| 68 | t.Cleanup(func() { |
| 69 | ts.Close() |
| 70 | _ = regHandler.Close() |
| 71 | }) |
| 72 | rcHosts := []config.Host{ |
| 73 | { |
| 74 | Name: tsHost, |
| 75 | Hostname: tsHost, |
| 76 | TLS: config.TLSDisabled, |
| 77 | }, |
| 78 | { |
| 79 | Name: tsROHost, |
| 80 | Hostname: tsROHost, |
| 81 | TLS: config.TLSDisabled, |
| 82 | }, |
| 83 | { |
| 84 | Name: "registry.example.org", |
| 85 | Hostname: tsHost, |
| 86 | TLS: config.TLSDisabled, |
| 87 | }, |
| 88 | } |
| 89 | delayInit, _ := time.ParseDuration("0.05s") |
| 90 | delayMax, _ := time.ParseDuration("0.10s") |
| 91 | // replace regclient with one configured for test hosts |
| 92 | rc := regclient.New( |
nothing calls this directly
no test coverage detected
searching dependent graphs…