tests: collect the operator log prior to a pod restart
Signed-off-by: travisn <tnielsen@redhat.com>
This commit is contained in:
6 files changed
+39
-28
No files matched your search
@@ -164,6 +164,6 @@ func (ci *CassandraInstaller) UninstallCassandra(systemNamespace string, namespa
|
||||
func (ci *CassandraInstaller) GatherAllCassandraLogs(systemNamespace, namespace, testName string) {
|
||||
|
||||
logger.Infof("Gathering all logs from Cassandra Cluster %s", namespace)
|
||||
ci.k8sHelper.GetRookLogs("rook-cassandra-operator", Env.HostType, systemNamespace, testName)
|
||||
ci.k8sHelper.GetRookLogs("rook-cassandra", Env.HostType, namespace, testName)
|
||||
ci.k8sHelper.GetLogs("rook-cassandra-operator", Env.HostType, systemNamespace, testName)
|
||||
ci.k8sHelper.GetLogs("rook-cassandra", Env.HostType, namespace, testName)
|
||||
}
|
||||
@@ -309,7 +309,7 @@ func (h *CephInstaller) InstallRookOnK8sWithHostPathAndDevices(namespace, storeT
|
||||
}
|
||||
if !h.k8shelper.IsPodInExpectedState("rook-ceph-operator", onamespace, "Running") {
|
||||
logger.Error("rook-ceph-operator is not running")
|
||||
h.k8shelper.GetRookLogs("rook-ceph-operator", Env.HostType, onamespace, "test-setup")
|
||||
h.k8shelper.GetLogs("rook-ceph-operator", Env.HostType, onamespace, "test-setup")
|
||||
logger.Error("rook-ceph-operator is not Running, abort!")
|
||||
return false, err
|
||||
}
|
||||
@@ -486,20 +486,21 @@ func (h *CephInstaller) cleanupDir(node, dir string) error {
|
||||
|
||||
func (h *CephInstaller) GatherAllRookLogs(namespace, systemNamespace string, testName string) {
|
||||
logger.Infof("Gathering all logs from Rook Cluster %s", namespace)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-agent", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-discover", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-mgr", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-mon", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-osd", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-osd-prepare", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-rgw", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-ceph-mds", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetRookContainerLogs("rook-ceph-mgr", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetRookContainerLogs("rook-ceph-mon", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetRookContainerLogs("rook-ceph-osd", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetRookContainerLogs("rook-ceph-rgw", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetRookContainerLogs("rook-ceph-mds", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetPreviousLogs("rook-ceph-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-agent", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-discover", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-mgr", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-mon", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-osd", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-osd-prepare", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-rgw", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-ceph-mds", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetContainerLogs("rook-ceph-mgr", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetContainerLogs("rook-ceph-mon", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetContainerLogs("rook-ceph-osd", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetContainerLogs("rook-ceph-rgw", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
h.k8shelper.GetContainerLogs("rook-ceph-mds", Env.HostType, namespace, testName, opspec.ConfigInitContainerName)
|
||||
}
|
||||
|
||||
// NewCephInstaller creates new instance of CephInstaller
|
||||
|
||||
@@ -151,6 +151,6 @@ func (h *CockroachDBInstaller) UninstallCockroachDB(systemNamespace, namespace s
|
||||
|
||||
func (h *CockroachDBInstaller) GatherAllCockroachDBLogs(systemNamespace, namespace, testName string) {
|
||||
logger.Infof("Gathering all logs from cockroachdb cluster %s", namespace)
|
||||
h.k8shelper.GetRookLogs("rook-cockroachdb-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-cockroachdb", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-cockroachdb-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-cockroachdb", Env.HostType, namespace, testName)
|
||||
}
|
||||
@@ -153,6 +153,6 @@ func (h *EdgefsInstaller) UninstallEdgefs(systemNamespace, namespace string) {
|
||||
|
||||
func (h *EdgefsInstaller) GatherAllEdgefsLogs(systemNamespace, namespace, testName string) {
|
||||
logger.Infof("Gathering all logs from edgefs cluster %s", namespace)
|
||||
h.k8shelper.GetRookLogs("rook-edgefs-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-edgefs", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-edgefs-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-edgefs", Env.HostType, namespace, testName)
|
||||
}
|
||||
@@ -199,8 +199,8 @@ func (h *NFSInstaller) UninstallNFSServer(systemNamespace, namespace string) {
|
||||
// GatherAllNFSServerLogs gathers all NFS Server logs
|
||||
func (h *NFSInstaller) GatherAllNFSServerLogs(systemNamespace, namespace, testName string) {
|
||||
logger.Infof("Gathering all logs from NFSServer %s", namespace)
|
||||
h.k8shelper.GetRookLogs("rook-nfs-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetRookLogs("rook-nfs", Env.HostType, namespace, testName)
|
||||
h.k8shelper.GetLogs("rook-nfs-operator", Env.HostType, systemNamespace, testName)
|
||||
h.k8shelper.GetLogs("rook-nfs", Env.HostType, namespace, testName)
|
||||
}
|
||||
|
||||
// GetNFSServerClusterIP gets the nfs server cluster ip on which it serves
|
||||
|
||||
@@ -1419,13 +1419,23 @@ func (k8sh *K8sHelper) IsRookInstalled(namespace string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// GetRookLogs captures logs from specified rook pod and writes it to specified file
|
||||
func (k8sh *K8sHelper) GetRookLogs(podAppName string, hostType string, namespace string, testName string) {
|
||||
k8sh.GetRookContainerLogs(podAppName, hostType, namespace, testName, "")
|
||||
// GetPreviousLogs captures logs from the previous run of the container if it exists
|
||||
func (k8sh *K8sHelper) GetPreviousLogs(podAppName string, hostType string, namespace string, testName string) {
|
||||
k8sh.getContainerLogs(podAppName, hostType, namespace, testName, "", true)
|
||||
}
|
||||
|
||||
func (k8sh *K8sHelper) GetRookContainerLogs(podAppName, hostType, namespace, testName, containerName string) {
|
||||
logOpts := &v1.PodLogOptions{}
|
||||
// GetLogs captures logs from specified rook pod and writes it to specified file
|
||||
func (k8sh *K8sHelper) GetLogs(podAppName string, hostType string, namespace string, testName string) {
|
||||
k8sh.getContainerLogs(podAppName, hostType, namespace, testName, "", false)
|
||||
}
|
||||
|
||||
// GetLogs captures logs from a specific container in a pod
|
||||
func (k8sh *K8sHelper) GetContainerLogs(podAppName, hostType, namespace, testName, containerName string) {
|
||||
k8sh.getContainerLogs(podAppName, hostType, namespace, testName, containerName, false)
|
||||
}
|
||||
|
||||
func (k8sh *K8sHelper) getContainerLogs(podAppName, hostType, namespace, testName, containerName string, previousLog bool) {
|
||||
logOpts := &v1.PodLogOptions{Previous: previousLog}
|
||||
if containerName != "" {
|
||||
logOpts.Container = containerName
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user