Reverse DependingChart test logic, add debug logs

Signed-off-by: Josh Dolitsky <josh@dolit.ski>
pull/9782/head
Josh Dolitsky 3 years ago
parent 241f23d72a
commit 30a8ce5986
No known key found for this signature in database
GPG Key ID: B2B93673243A65FB

@ -181,31 +181,44 @@ func (srv *OCIServer) Run(t *testing.T, opts ...OCIServerOpt) {
t.Fatal("could not load chart into memory")
}
_, err = registryClient.Push(contentBytes, ref)
result, err := registryClient.Push(contentBytes, ref)
if err != nil {
t.Fatalf("error pushing dependent chart: %s", err)
}
t.Logf("Manifest.Digest: %s, Manifest.Size: %d, "+
"Config.Digest: %s, Config.Size: %d, "+
"Chart.Digest: %s, Chart.Size: %d",
result.Manifest.Digest, result.Manifest.Size,
result.Config.Digest, result.Config.Size,
result.Chart.Digest, result.Chart.Size)
if cfg.DependingChart != nil {
c := cfg.DependingChart
dependingRef := fmt.Sprintf("%s/u/ocitestuser/%s:%s",
srv.RegistryURL, c.Metadata.Name, c.Metadata.Version)
srv.Client = registryClient
c := cfg.DependingChart
if c == nil {
return
}
// load it into memory...
absPath := filepath.Join(srv.Dir,
fmt.Sprintf("%s-%s.tgz", c.Metadata.Name, c.Metadata.Version))
contentBytes, err := ioutil.ReadFile(absPath)
if err != nil {
t.Fatal("could not load chart into memory")
}
dependingRef := fmt.Sprintf("%s/u/ocitestuser/%s:%s",
srv.RegistryURL, c.Metadata.Name, c.Metadata.Version)
_, err = registryClient.Push(contentBytes, dependingRef)
if err != nil {
t.Fatalf("error pushing depending chart: %s", err)
}
// load it into memory...
absPath = filepath.Join(srv.Dir,
fmt.Sprintf("%s-%s.tgz", c.Metadata.Name, c.Metadata.Version))
contentBytes, err = ioutil.ReadFile(absPath)
if err != nil {
t.Fatal("could not load chart into memory")
}
srv.Client = registryClient
result, err = registryClient.Push(contentBytes, dependingRef)
if err != nil {
t.Fatalf("error pushing depending chart: %s", err)
}
t.Logf("Manifest.Digest: %s, Manifest.Size: %d, "+
"Config.Digest: %s, Config.Size: %d, "+
"Chart.Digest: %s, Chart.Size: %d",
result.Manifest.Digest, result.Manifest.Size,
result.Config.Digest, result.Config.Size,
result.Chart.Digest, result.Chart.Size)
}
// NewTempServer creates a server inside of a temp dir.

Loading…
Cancel
Save