From d2db1dbfa8af368d66d792421d08894104deab97 Mon Sep 17 00:00:00 2001 From: fabriziopandini Date: Wed, 16 Sep 2020 12:01:53 +0200 Subject: [PATCH] Fix e2e logs --- test/e2e/kcp_adoption.go | 4 ++-- test/e2e/self_hosted.go | 5 ++--- test/framework/cluster_helpers.go | 6 +++--- test/framework/control_plane.go | 2 +- test/framework/controlplane_helpers.go | 8 ++++---- test/framework/daemonset_helpers.go | 2 +- test/framework/deployment_helpers.go | 4 ++-- test/framework/deprecated.go | 2 +- test/framework/machine_helpers.go | 4 ++-- test/framework/machinedeployment_helpers.go | 2 +- test/framework/machines.go | 4 ++-- test/framework/pod_helpers.go | 2 -- test/infrastructure/docker/docker/machine.go | 2 +- 13 files changed, 22 insertions(+), 25 deletions(-) diff --git a/test/e2e/kcp_adoption.go b/test/e2e/kcp_adoption.go index 628446efafe6..102b1192277f 100644 --- a/test/e2e/kcp_adoption.go +++ b/test/e2e/kcp_adoption.go @@ -145,7 +145,7 @@ func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInpu ControlPlane: controlPlane, }) - By("taking stable ownership of the Machines") + By("Taking stable ownership of the Machines") must := func(r *labels.Requirement, err error) labels.Requirement { if err != nil { panic(err) @@ -184,7 +184,7 @@ func KCPAdoptionSpec(ctx context.Context, inputGetter func() KCPAdoptionSpecInpu clusterv1.ClusterLabelName: clusterName, })).To(Succeed()) - By("taking ownership of the cluster's PKI material") + By("Taking ownership of the cluster's PKI material") secrets := corev1.SecretList{} Expect(client.List(ctx, &secrets, ctrlclient.InNamespace(namespace.Name), ctrlclient.MatchingLabels{ clusterv1.ClusterLabelName: cluster.Name, diff --git a/test/e2e/self_hosted.go b/test/e2e/self_hosted.go index 06bfc173fe62..3cbf6ed2ac9e 100644 --- a/test/e2e/self_hosted.go +++ b/test/e2e/self_hosted.go @@ -137,7 +137,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput) Namespace: namespace.Name, }) - log.Logf("Waiting for the cluster infrastructure to be provisioned") + log.Logf("Waiting for the cluster to be reconciled after moving to self hosted") selfHostedCluster = framework.DiscoveryAndWaitForCluster(ctx, framework.DiscoveryAndWaitForClusterInput{ Getter: selfHostedClusterProxy.GetClient(), Namespace: selfHostedNamespace.Name, @@ -155,7 +155,6 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput) }) AfterEach(func() { - //TODO: refactor in to an helper func e.g. "MoveToBootstrapAndWait" if selfHostedNamespace != nil { // Dump all Cluster API related resources to artifacts before pivoting back. framework.DumpAllResources(ctx, framework.DumpAllResourcesInput{ @@ -174,7 +173,7 @@ func SelfHostedSpec(ctx context.Context, inputGetter func() SelfHostedSpecInput) Namespace: selfHostedNamespace.Name, }) - log.Logf("Waiting for the cluster infrastructure to be provisioned") + log.Logf("Waiting for the cluster to be reconciled after moving back to booststrap") cluster = framework.DiscoveryAndWaitForCluster(ctx, framework.DiscoveryAndWaitForClusterInput{ Getter: input.BootstrapClusterProxy.GetClient(), Namespace: namespace.Name, diff --git a/test/framework/cluster_helpers.go b/test/framework/cluster_helpers.go index da1514f9938f..76449476381b 100644 --- a/test/framework/cluster_helpers.go +++ b/test/framework/cluster_helpers.go @@ -122,7 +122,7 @@ type WaitForClusterToProvisionInput struct { // WaitForClusterToProvision will wait for a cluster to have a phase status of provisioned. func WaitForClusterToProvision(ctx context.Context, input WaitForClusterToProvisionInput, intervals ...interface{}) { - By("waiting for cluster to enter the provisioned phase") + By("Waiting for cluster to enter the provisioned phase") Eventually(func() (string, error) { cluster := &clusterv1.Cluster{} key := client.ObjectKey{ @@ -147,7 +147,7 @@ func DeleteCluster(ctx context.Context, input DeleteClusterInput) { if options.SkipResourceCleanup { return } - By(fmt.Sprintf("deleting cluster %s", input.Cluster.GetName())) + By(fmt.Sprintf("Deleting cluster %s", input.Cluster.GetName())) Expect(input.Deleter.Delete(ctx, input.Cluster)).To(Succeed()) } @@ -162,7 +162,7 @@ func WaitForClusterDeleted(ctx context.Context, input WaitForClusterDeletedInput if options.SkipResourceCleanup { return } - By(fmt.Sprintf("waiting for cluster %s to be deleted", input.Cluster.GetName())) + By(fmt.Sprintf("Waiting for cluster %s to be deleted", input.Cluster.GetName())) Eventually(func() bool { cluster := &clusterv1.Cluster{} key := client.ObjectKey{ diff --git a/test/framework/control_plane.go b/test/framework/control_plane.go index 3607e123b533..941c426891ec 100644 --- a/test/framework/control_plane.go +++ b/test/framework/control_plane.go @@ -34,7 +34,7 @@ type WaitForControlPlaneToBeUpToDateInput struct { // WaitForControlPlaneToBeUpToDate will wait for a control plane to be fully up-to-date. func WaitForControlPlaneToBeUpToDate(ctx context.Context, input WaitForControlPlaneToBeUpToDateInput, intervals ...interface{}) { - By("waiting for the control plane to be ready") + By("Waiting for the control plane to be ready") Eventually(func() (int32, error) { controlplane := &controlplanev1.KubeadmControlPlane{} key := client.ObjectKey{ diff --git a/test/framework/controlplane_helpers.go b/test/framework/controlplane_helpers.go index 521ba96452b2..9834132180ad 100644 --- a/test/framework/controlplane_helpers.go +++ b/test/framework/controlplane_helpers.go @@ -83,7 +83,7 @@ type WaitForKubeadmControlPlaneMachinesToExistInput struct { // WaitForKubeadmControlPlaneMachinesToExist will wait until all control plane machines have node refs. func WaitForKubeadmControlPlaneMachinesToExist(ctx context.Context, input WaitForKubeadmControlPlaneMachinesToExistInput, intervals ...interface{}) { - By("waiting for all control plane nodes to exist") + By("Waiting for all control plane nodes to exist") inClustersNamespaceListOption := client.InNamespace(input.Cluster.Namespace) // ControlPlane labels matchClusterListOption := client.MatchingLabels{ @@ -120,7 +120,7 @@ func WaitForOneKubeadmControlPlaneMachineToExist(ctx context.Context, input Wait Expect(input.Lister).ToNot(BeNil(), "Invalid argument. input.Getter can't be nil when calling WaitForOneKubeadmControlPlaneMachineToExist") Expect(input.ControlPlane).ToNot(BeNil(), "Invalid argument. input.ControlPlane can't be nil when calling WaitForOneKubeadmControlPlaneMachineToExist") - By("waiting for one control plane node to exist") + By("Waiting for one control plane node to exist") inClustersNamespaceListOption := client.InNamespace(input.Cluster.Namespace) // ControlPlane labels matchClusterListOption := client.MatchingLabels{ @@ -152,7 +152,7 @@ type WaitForControlPlaneToBeReadyInput struct { // WaitForControlPlaneToBeReady will wait for a control plane to be ready. func WaitForControlPlaneToBeReady(ctx context.Context, input WaitForControlPlaneToBeReadyInput, intervals ...interface{}) { - By("waiting for the control plane to be ready") + By("Waiting for the control plane to be ready") Eventually(func() (bool, error) { controlplane := &controlplanev1.KubeadmControlPlane{} key := client.ObjectKey{ @@ -314,7 +314,7 @@ func UpgradeControlPlaneAndWaitForUpgrade(ctx context.Context, input UpgradeCont Expect(patchHelper.Patch(ctx, input.ControlPlane)).To(Succeed()) - log.Logf("Waiting for machines to have the upgraded kubernetes version") + log.Logf("Waiting for control-plane machines to have the upgraded kubernetes version") WaitForControlPlaneMachinesToBeUpgraded(ctx, WaitForControlPlaneMachinesToBeUpgradedInput{ Lister: mgmtClient, Cluster: input.Cluster, diff --git a/test/framework/daemonset_helpers.go b/test/framework/daemonset_helpers.go index 7466165e8f16..364b08a270fb 100644 --- a/test/framework/daemonset_helpers.go +++ b/test/framework/daemonset_helpers.go @@ -35,7 +35,7 @@ type WaitForKubeProxyUpgradeInput struct { // WaitForKubeProxyUpgrade waits until kube-proxy version matches with the kubernetes version. This is called during KCP upgrade. func WaitForKubeProxyUpgrade(ctx context.Context, input WaitForKubeProxyUpgradeInput, intervals ...interface{}) { - By("ensuring kube-proxy has the correct image") + By("Ensuring kube-proxy has the correct image") Eventually(func() (bool, error) { ds := &appsv1.DaemonSet{} diff --git a/test/framework/deployment_helpers.go b/test/framework/deployment_helpers.go index 7e9b9bbc36ea..5e7ce8e21287 100644 --- a/test/framework/deployment_helpers.go +++ b/test/framework/deployment_helpers.go @@ -49,7 +49,7 @@ type WaitForDeploymentsAvailableInput struct { // all the desired replicas are in place. // This can be used to check if Cluster API controllers installed in the management cluster are working. func WaitForDeploymentsAvailable(ctx context.Context, input WaitForDeploymentsAvailableInput, intervals ...interface{}) { - By(fmt.Sprintf("waiting for deployment %s/%s to be available", input.Deployment.GetNamespace(), input.Deployment.GetName())) + By(fmt.Sprintf("Waiting for deployment %s/%s to be available", input.Deployment.GetNamespace(), input.Deployment.GetName())) deployment := &appsv1.Deployment{} Eventually(func() bool { key := client.ObjectKey{ @@ -233,7 +233,7 @@ type WaitForDNSUpgradeInput struct { // WaitForDNSUpgrade waits until CoreDNS version matches with the CoreDNS upgrade version. This is called during KCP upgrade. func WaitForDNSUpgrade(ctx context.Context, input WaitForDNSUpgradeInput, intervals ...interface{}) { - By("ensuring CoreDNS has the correct image") + By("Ensuring CoreDNS has the correct image") Eventually(func() (bool, error) { d := &appsv1.Deployment{} diff --git a/test/framework/deprecated.go b/test/framework/deprecated.go index 6ab9fd8f55ad..079b8eb3d2e2 100644 --- a/test/framework/deprecated.go +++ b/test/framework/deprecated.go @@ -224,7 +224,7 @@ func (input *ControlplaneClusterInput) ControlPlaneCluster() { Expect(mgmtClient.Create(ctx, input.MachineDeployment.InfraMachineTemplate)).To(Succeed()) } - By("waiting for the workload nodes to exist") + By("Waiting for the workload nodes to exist") Eventually(func() ([]corev1.Node, error) { workloadClient, err := input.Management.GetWorkloadClient(ctx, input.Cluster.Namespace, input.Cluster.Name) if err != nil { diff --git a/test/framework/machine_helpers.go b/test/framework/machine_helpers.go index 62234eafab75..913f87e83510 100644 --- a/test/framework/machine_helpers.go +++ b/test/framework/machine_helpers.go @@ -18,6 +18,7 @@ package framework import ( "context" + "fmt" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -120,8 +121,7 @@ func WaitForControlPlaneMachinesToBeUpgraded(ctx context.Context, input WaitForC Expect(input.KubernetesUpgradeVersion).ToNot(BeEmpty(), "Invalid argument. input.KubernetesUpgradeVersion can't be empty when calling WaitForControlPlaneMachinesToBeUpgraded") Expect(input.MachineCount).To(BeNumerically(">", 0), "Invalid argument. input.MachineCount can't be smaller than 1 when calling WaitForControlPlaneMachinesToBeUpgraded") - By("ensuring all machines have upgraded kubernetes version") - log.Logf("Ensuring all MachineDeployment Machines have upgraded kubernetes version %s", input.KubernetesUpgradeVersion) + By(fmt.Sprintf("Ensuring all control-plane machines have upgraded kubernetes version %s", input.KubernetesUpgradeVersion)) Eventually(func() (int, error) { machines := GetControlPlaneMachinesByCluster(ctx, GetControlPlaneMachinesByClusterInput{ diff --git a/test/framework/machinedeployment_helpers.go b/test/framework/machinedeployment_helpers.go index 31a1a1f09d66..a2154b09eeab 100644 --- a/test/framework/machinedeployment_helpers.go +++ b/test/framework/machinedeployment_helpers.go @@ -89,7 +89,7 @@ func WaitForMachineDeploymentNodesToExist(ctx context.Context, input WaitForMach Expect(input.Lister).ToNot(BeNil(), "Invalid argument. input.Lister can't be nil when calling WaitForMachineDeploymentNodesToExist") Expect(input.MachineDeployment).ToNot(BeNil(), "Invalid argument. input.MachineDeployment can't be nil when calling WaitForMachineDeploymentNodesToExist") - By("waiting for the workload nodes to exist") + By("Waiting for the workload nodes to exist") Eventually(func() (int, error) { selectorMap, err := metav1.LabelSelectorAsMap(&input.MachineDeployment.Spec.Selector) if err != nil { diff --git a/test/framework/machines.go b/test/framework/machines.go index b19c2230140e..8c12109dc692 100644 --- a/test/framework/machines.go +++ b/test/framework/machines.go @@ -35,7 +35,7 @@ type WaitForClusterMachineNodeRefsInput struct { // WaitForClusterMachineNodesRefs waits until all nodes associated with a machine deployment exist. func WaitForClusterMachineNodeRefs(ctx context.Context, input WaitForClusterMachineNodeRefsInput, intervals ...interface{}) { - By("waiting for the machines' nodes to exist") + By("Waiting for the machines' nodes to exist") machines := &clusterv1.MachineList{} Expect(input.GetLister.List(ctx, machines, byClusterOptions(input.Cluster.Name, input.Cluster.Namespace)...)).To(Succeed(), "Failed to get Cluster machines %s/%s", input.Cluster.Namespace, input.Cluster.Name) @@ -61,7 +61,7 @@ type WaitForClusterMachinesReadyInput struct { } func WaitForClusterMachinesReady(ctx context.Context, input WaitForClusterMachinesReadyInput, intervals ...interface{}) { - By("waiting for the machines' nodes to be ready") + By("Waiting for the machines' nodes to be ready") machines := &clusterv1.MachineList{} Expect(input.GetLister.List(ctx, machines, byClusterOptions(input.Cluster.Name, input.Cluster.Namespace)...)).To(Succeed(), "Failed to get Cluster machines %s/%s", input.Cluster.Namespace, input.Cluster.Name) diff --git a/test/framework/pod_helpers.go b/test/framework/pod_helpers.go index 70ec68a140fc..8c756b7def0b 100644 --- a/test/framework/pod_helpers.go +++ b/test/framework/pod_helpers.go @@ -20,7 +20,6 @@ import ( "context" "strings" - . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" "github.com/pkg/errors" @@ -55,7 +54,6 @@ func WaitForPodListCondition(ctx context.Context, input WaitForPodListConditionI } return true, nil }, intervals...).Should(BeTrue()) - By("pod condition satisfied") } // EtcdImageTagCondition returns a podListCondition that ensures the pod image diff --git a/test/infrastructure/docker/docker/machine.go b/test/infrastructure/docker/docker/machine.go index 8a362e7dbc60..238a61e54d81 100644 --- a/test/infrastructure/docker/docker/machine.go +++ b/test/infrastructure/docker/docker/machine.go @@ -245,7 +245,7 @@ func (m *Machine) ExecBootstrap(ctx context.Context, data string) error { err := cmd.Run(ctx) if err != nil { m.log.Info("Failed running command", "command", command, "stdout", outStd.String(), "stderr", outErr.String(), "bootstrap data", data) - return errors.Wrap(err, "failed to run cloud conifg") + return errors.Wrap(errors.WithStack(err), "failed to run cloud config") } }