Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions setup/metrics/gather.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
cfg "github.com/codeready-toolchain/toolchain-e2e/setup/configuration"
"github.com/codeready-toolchain/toolchain-e2e/setup/metrics/queries"
"github.com/codeready-toolchain/toolchain-e2e/setup/terminal"
"github.com/pkg/errors"
"github.com/prometheus/common/model"

k8sutil "k8s.io/apimachinery/pkg/util/wait"
Expand Down Expand Up @@ -124,13 +123,13 @@ func (g *Gatherer) sample(q queries.Query) error {
if strings.Contains(err.Error(), "client error: 403") {
url, tokenErr := auth.GetTokenRequestURI(g.k8sClient)
if tokenErr != nil {
return errors.Wrapf(err, "metrics query failed with 403 (Forbidden)")
return fmt.Errorf("metrics query failed with 403 (Forbidden): %w", err)
}
return errors.Wrapf(err, "metrics query failed with 403 (Forbidden) - retrieve a new token from %s", url)
return fmt.Errorf("metrics query failed with 403 (Forbidden) - retrieve a new token from %s: %w", url, err)
}
return errors.Wrapf(err, "metrics query failed - check whether prometheus is still healthy in the cluster")
return fmt.Errorf("metrics query failed - check whether prometheus is still healthy in the cluster: %w", err)
} else if len(warnings) > 0 {
return errors.Wrapf(fmt.Errorf("warnings: %v", warnings), "metrics query had unexpected warnings")
return fmt.Errorf("metrics query had unexpected warnings: %w", fmt.Errorf("warnings: %v", warnings))
}

vector := val.(model.Vector)
Expand Down
7 changes: 3 additions & 4 deletions setup/operators/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (

ctemplate "github.com/codeready-toolchain/toolchain-common/pkg/template"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -68,7 +67,7 @@ func EnsureOperatorsInstalled(ctx context.Context, cl client.Client, s *runtime.
for _, templatePath := range templatePaths {
tmpl, err := templates.GetTemplateFromFile(templatePath)
if err != nil {
return errors.Wrapf(err, "invalid template file: '%s'", templatePath)
return fmt.Errorf("invalid template file: '%s': %w", templatePath, err)
}

processor := ctemplate.NewProcessor(s)
Expand Down Expand Up @@ -135,10 +134,10 @@ func EnsureOperatorsInstalled(ctx context.Context, cl client.Client, s *runtime.
}
installDuration := time.Since(startTime)
if csverr != nil {
return errors.Wrapf(csverr, "failed to find CSV '%s' with Phase 'Succeeded'", currentCSV)
return fmt.Errorf("failed to find CSV '%s' with Phase 'Succeeded': %w", currentCSV, csverr)
}
if err != nil {
return errors.Wrapf(err, "failed to verify installation of operator with subscription '%s' after %s", subscriptionResource.GetName(), installDuration.String())
return fmt.Errorf("failed to verify installation of operator with subscription '%s' after %s: %w", subscriptionResource.GetName(), installDuration.String(), err)
}

fmt.Printf("Verified installation of operator with subscription '%s' completed in %s\n\n", subscriptionResource.GetName(), installDuration.String())
Expand Down
3 changes: 1 addition & 2 deletions setup/resources/create_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
ctemplate "github.com/codeready-toolchain/toolchain-common/pkg/template"
"github.com/codeready-toolchain/toolchain-e2e/setup/templates"
"github.com/codeready-toolchain/toolchain-e2e/setup/wait"
"github.com/pkg/errors"

templatev1 "github.com/openshift/api/template/v1"
"k8s.io/apimachinery/pkg/runtime"
Expand All @@ -26,7 +25,7 @@ func CreateUserResourcesFromTemplateFiles(ctx context.Context, cl runtimeclient.
if _, ok := tmpls[templatePath]; !ok {
var err error
if tmpls[templatePath], err = templates.GetTemplateFromFile(templatePath); err != nil {
return errors.Wrapf(err, "invalid template file: '%s'", templatePath)
return fmt.Errorf("invalid template file: '%s': %w", templatePath, err)
}
}
tmpl := tmpls[templatePath]
Expand Down
3 changes: 1 addition & 2 deletions setup/templates/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
cfg "github.com/codeready-toolchain/toolchain-e2e/setup/configuration"
multierror "github.com/hashicorp/go-multierror"
templatev1 "github.com/openshift/api/template/v1"
"github.com/pkg/errors"
"k8s.io/apimachinery/pkg/runtime/serializer"
k8swait "k8s.io/apimachinery/pkg/util/wait"
"k8s.io/kubectl/pkg/scheme"
Expand Down Expand Up @@ -148,7 +147,7 @@ func applyObject(ctx context.Context, applycl *applyclientlib.SSAApplyClient, ob
}
return true, nil
}); err != nil {
return errors.Wrapf(err, "could not apply resource '%s' in namespace '%s'", obj.GetName(), obj.GetNamespace())
return fmt.Errorf("could not apply resource '%s' in namespace '%s': %w", obj.GetName(), obj.GetNamespace(), err)
}
return nil
}
8 changes: 4 additions & 4 deletions setup/wait/wait.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ package wait

import (
"context"
"fmt"
"time"

"github.com/codeready-toolchain/toolchain-common/pkg/test"
"github.com/codeready-toolchain/toolchain-e2e/setup/configuration"

toolchainv1alpha1 "github.com/codeready-toolchain/api/api/v1alpha1"
"github.com/operator-framework/api/pkg/operators/v1alpha1"
"github.com/pkg/errors"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -41,7 +41,7 @@ func ForSpace(cl client.Client, space string) error {
}
return true, nil
}); err != nil {
return errors.Wrapf(err, "space '%s' is not ready yet", space)
return fmt.Errorf("space '%s' is not ready yet: %w", space, err)
}
return nil
}
Expand All @@ -67,7 +67,7 @@ func ForSubscriptionWithCriteria(cl client.Client, name, namespace string, timeo
if err := k8swait.PollUntilContextTimeout(context.TODO(), configuration.DefaultRetryInterval, timeout, true, func(ctx context.Context) (bool, error) {
return HasSubscriptionWithCriteria(cl, name, namespace, criteria...)
}); err != nil {
return errors.Wrapf(err, "could not find a Subscription with name '%s' in namespace '%s' that meets the expected criteria", name, namespace)
return fmt.Errorf("could not find a Subscription with name '%s' in namespace '%s' that meets the expected criteria: %w", name, namespace, err)
}
return nil
}
Expand All @@ -93,7 +93,7 @@ func ForCSVWithCriteria(cl client.Client, name, namespace string, timeout time.D
if err := k8swait.PollUntilContextTimeout(context.TODO(), configuration.DefaultRetryInterval, timeout, true, func(ctx context.Context) (bool, error) {
return HasCSVWithCriteria(cl, name, namespace, criteria...)
}); err != nil {
return errors.Wrapf(err, "could not find a CSV with name '%s' in namespace '%s' that meets the expected criteria", name, namespace)
return fmt.Errorf("could not find a CSV with name '%s' in namespace '%s' that meets the expected criteria: %w", name, namespace, err)
}
return nil
}
Expand Down
Loading