зеркало из https://github.com/Azure/ARO-RP.git
improve gatherlogs usability
This commit is contained in:
Родитель
61bb23c6fa
Коммит
e4479fcb9d
|
@ -24,11 +24,8 @@ func (m *manager) gatherFailureLogs(ctx context.Context) {
|
|||
m.log.Error(err)
|
||||
continue
|
||||
}
|
||||
if o == nil {
|
||||
continue
|
||||
}
|
||||
|
||||
b, err := json.Marshal(o)
|
||||
b, err := json.MarshalIndent(o, "", " ")
|
||||
if err != nil {
|
||||
m.log.Error(err)
|
||||
continue
|
||||
|
@ -51,7 +48,12 @@ func (m *manager) logNodes(ctx context.Context) (interface{}, error) {
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
return m.kubernetescli.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
|
||||
nodes, err := m.kubernetescli.CoreV1().Nodes().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nodes.Items, nil
|
||||
}
|
||||
|
||||
func (m *manager) logClusterOperators(ctx context.Context) (interface{}, error) {
|
||||
|
@ -59,7 +61,12 @@ func (m *manager) logClusterOperators(ctx context.Context) (interface{}, error)
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
return m.configcli.ConfigV1().ClusterOperators().List(ctx, metav1.ListOptions{})
|
||||
cos, err := m.configcli.ConfigV1().ClusterOperators().List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return cos.Items, nil
|
||||
}
|
||||
|
||||
func (m *manager) logIngressControllers(ctx context.Context) (interface{}, error) {
|
||||
|
@ -67,5 +74,10 @@ func (m *manager) logIngressControllers(ctx context.Context) (interface{}, error
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
return m.operatorcli.OperatorV1().IngressControllers("openshift-ingress-operator").List(ctx, metav1.ListOptions{})
|
||||
ics, err := m.operatorcli.OperatorV1().IngressControllers("openshift-ingress-operator").List(ctx, metav1.ListOptions{})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return ics.Items, nil
|
||||
}
|
||||
|
|
|
@ -38,19 +38,7 @@ func failingFunc(context.Context) error { return errors.New("oh no!") }
|
|||
|
||||
var clusterOperator = &configv1.ClusterOperator{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "console",
|
||||
},
|
||||
Status: configv1.ClusterOperatorStatus{
|
||||
Versions: []configv1.OperandVersion{
|
||||
{
|
||||
Name: "operator",
|
||||
Version: "4.3.0",
|
||||
},
|
||||
{
|
||||
Name: "operator-good",
|
||||
Version: "4.3.1",
|
||||
},
|
||||
},
|
||||
Name: "operator",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -58,11 +46,6 @@ var clusterVersion = &configv1.ClusterVersion{
|
|||
ObjectMeta: metav1.ObjectMeta{
|
||||
Name: "version",
|
||||
},
|
||||
Status: configv1.ClusterVersionStatus{
|
||||
Desired: configv1.Update{
|
||||
Version: "1.2.3",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
var node = &corev1.Node{
|
||||
|
@ -74,9 +57,7 @@ var node = &corev1.Node{
|
|||
var ingressController = &operatorv1.IngressController{
|
||||
ObjectMeta: metav1.ObjectMeta{
|
||||
Namespace: "openshift-ingress-operator",
|
||||
},
|
||||
Spec: operatorv1.IngressControllerSpec{
|
||||
Domain: "aroapp.io",
|
||||
Name: "ingress-controller",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -109,19 +90,19 @@ func TestStepRunnerWithInstaller(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.MatchRegexp(`github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logClusterVersion\-fm: {.*"version":"1.2.3".*}`),
|
||||
"msg": gomega.MatchRegexp(`(?s)github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logClusterVersion\-fm:.*"name": "version"`),
|
||||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.MatchRegexp(`github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logNodes\-fm: {.*"name":"node".*}`),
|
||||
"msg": gomega.MatchRegexp(`(?s)github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logNodes\-fm:.*"name": "node"`),
|
||||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.MatchRegexp(`github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logClusterOperators\-fm: {.*"versions":\[{"name":"operator","version":"4.3.0"},{"name":"operator\-good","version":"4.3.1"}\].*}`),
|
||||
"msg": gomega.MatchRegexp(`(?s)github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logClusterOperators\-fm:.*"name": "operator"`),
|
||||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.MatchRegexp(`github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logIngressControllers\-fm: {.*"items":\[{.*"domain":"aroapp.io"}.*\]}`),
|
||||
"msg": gomega.MatchRegexp(`(?s)github.com/Azure/ARO-RP/pkg/cluster.\(\*manager\).logIngressControllers\-fm:.*"name": "ingress-controller"`),
|
||||
},
|
||||
},
|
||||
kubernetescli: fake.NewSimpleClientset(node),
|
||||
|
@ -149,15 +130,15 @@ func TestStepRunnerWithInstaller(t *testing.T) {
|
|||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.Equal(`github.com/Azure/ARO-RP/pkg/cluster.(*manager).logNodes-fm: {"metadata":{},"items":null}`),
|
||||
"msg": gomega.Equal(`github.com/Azure/ARO-RP/pkg/cluster.(*manager).logNodes-fm: null`),
|
||||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.Equal(`github.com/Azure/ARO-RP/pkg/cluster.(*manager).logClusterOperators-fm: {"metadata":{},"items":null}`),
|
||||
"msg": gomega.Equal(`github.com/Azure/ARO-RP/pkg/cluster.(*manager).logClusterOperators-fm: null`),
|
||||
},
|
||||
{
|
||||
"level": gomega.Equal(logrus.InfoLevel),
|
||||
"msg": gomega.Equal(`github.com/Azure/ARO-RP/pkg/cluster.(*manager).logIngressControllers-fm: {"metadata":{},"items":null}`),
|
||||
"msg": gomega.Equal(`github.com/Azure/ARO-RP/pkg/cluster.(*manager).logIngressControllers-fm: null`),
|
||||
},
|
||||
},
|
||||
kubernetescli: fake.NewSimpleClientset(),
|
||||
|
|
Загрузка…
Ссылка в новой задаче