Skip to content

Commit 37a5b46

Browse files
author
OpenShift Bot
authored
Merge pull request #13557 from miminar/extended-dump-registry-logs
Merged by openshift-bot
2 parents dae0037 + d7fd52d commit 37a5b46

File tree

1 file changed

+38
-2
lines changed

1 file changed

+38
-2
lines changed

test/extended/util/framework.go

+38-2
Original file line numberDiff line numberDiff line change
@@ -357,10 +357,46 @@ func (t *BuildResult) DumpLogs() {
357357

358358
fmt.Fprintf(g.GinkgoWriter, "\n\n")
359359

360+
t.dumpRegistryLogs()
361+
360362
// if we suspect that we are filling up the registry file system, call ExamineDiskUsage / ExaminePodDiskUsage
361363
// also see if manipulations of the quota around /mnt/openshift-xfs-vol-dir exist in the extended test set up scripts
362-
//ExamineDiskUsage()
363-
//ExaminePodDiskUsage(t.oc)
364+
/*
365+
ExamineDiskUsage()
366+
ExaminePodDiskUsage(t.oc)
367+
fmt.Fprintf(g.GinkgoWriter, "\n\n")
368+
*/
369+
}
370+
371+
func (t *BuildResult) dumpRegistryLogs() {
372+
var buildStarted *time.Time
373+
oc := t.oc
374+
fmt.Fprintf(g.GinkgoWriter, "\n** Registry Logs:\n")
375+
376+
if t.Build != nil && !t.Build.CreationTimestamp.IsZero() {
377+
buildStarted = &t.Build.CreationTimestamp.Time
378+
} else {
379+
proj, err := oc.Client().Projects().Get(oc.Namespace())
380+
if err != nil {
381+
fmt.Fprintf(g.GinkgoWriter, "Failed to get project %s: %v\n", oc.Namespace(), err)
382+
} else {
383+
buildStarted = &proj.CreationTimestamp.Time
384+
}
385+
}
386+
387+
if buildStarted == nil {
388+
fmt.Fprintf(g.GinkgoWriter, "Could not determine test' start time\n\n\n")
389+
return
390+
}
391+
392+
since := time.Now().Sub(*buildStarted)
393+
oadm := t.oc.AsAdmin().SetNamespace("default")
394+
out, err := oadm.Run("logs").Args("dc/docker-registry", "--since="+since.String()).Output()
395+
if err != nil {
396+
fmt.Fprintf(g.GinkgoWriter, "Error during log retrieval: %+v\n", err)
397+
} else {
398+
fmt.Fprintf(g.GinkgoWriter, "%s\n", out)
399+
}
364400

365401
fmt.Fprintf(g.GinkgoWriter, "\n\n")
366402
}

0 commit comments

Comments
 (0)