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
3 changes: 2 additions & 1 deletion pkg/apis/config/default_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/pod"
test "github.com/tektoncd/pipeline/pkg/reconciler/testing"
"github.com/tektoncd/pipeline/test/diff"
)

func TestNewDefaultsFromConfigMap(t *testing.T) {
Expand Down Expand Up @@ -186,7 +187,7 @@ func verifyConfigFileWithExpectedConfig(t *testing.T, fileName string, expectedC
cm := test.ConfigMapFromTestFile(t, fileName)
if Defaults, err := NewDefaultsFromConfigMap(cm); err == nil {
if d := cmp.Diff(Defaults, expectedConfig); d != "" {
t.Errorf("Diff:\n%s", d)
t.Errorf("Diff:\n%s", diff.PrintWantGot(d))
}
} else {
t.Errorf("NewDefaultsFromConfigMap(actual) = %v", err)
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/config/store_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (

"github.com/google/go-cmp/cmp"
test "github.com/tektoncd/pipeline/pkg/reconciler/testing"
"github.com/tektoncd/pipeline/test/diff"
logtesting "knative.dev/pkg/logging/testing"
)

Expand All @@ -33,7 +34,7 @@ func TestStoreLoadWithContext(t *testing.T) {
config := FromContext(store.ToContext(context.Background()))

expected, _ := NewDefaultsFromConfigMap(defaultConfig)
if diff := cmp.Diff(config.Defaults, expected); diff != "" {
t.Errorf("Unexpected default config (-want, +got): %v", diff)
if d := cmp.Diff(config.Defaults, expected); d != "" {
t.Errorf("Unexpected default config %s", diff.PrintWantGot(d))
}
}
9 changes: 5 additions & 4 deletions pkg/apis/pipeline/v1alpha1/cluster_task_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
Expand Down Expand Up @@ -175,8 +176,8 @@ func TestClusterTaskConversion(t *testing.T) {
t.Errorf("ConvertFrom() = %v", err)
}
t.Logf("ConvertFrom() = %#v", got)
if diff := cmp.Diff(test.in, got); diff != "" {
t.Errorf("roundtrip (-want, +got) = %v", diff)
if d := cmp.Diff(test.in, got); d != "" {
t.Errorf("roundtrip %s", diff.PrintWantGot(d))
}
})
}
Expand Down Expand Up @@ -312,8 +313,8 @@ func TestClusterTaskConversionFromDeprecated(t *testing.T) {
t.Errorf("ConvertFrom() = %v", err)
}
t.Logf("ConvertFrom() = %#v", got)
if diff := cmp.Diff(test.want, got); diff != "" {
t.Errorf("roundtrip (-want, +got) = %v", diff)
if d := cmp.Diff(test.want, got); d != "" {
t.Errorf("roundtrip %s", diff.PrintWantGot(d))
}
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/pipeline/v1alpha1/condition_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/google/go-cmp/cmp"
tb "github.com/tektoncd/pipeline/internal/builder/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
)

func TestConditionSpec_SetDefaults(t *testing.T) {
Expand Down Expand Up @@ -90,8 +91,8 @@ func TestConditionSpec_SetDefaults(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
ctx := context.Background()
tc.input.SetDefaults(ctx)
if diff := cmp.Diff(tc.output, tc.input); diff != "" {
t.Errorf("Mismatch of PipelineRunSpec: %s", diff)
if d := cmp.Diff(tc.output, tc.input); d != "" {
t.Errorf("Mismatch of PipelineRunSpec: %s", diff.PrintWantGot(d))
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1alpha1/condition_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/google/go-cmp/cmp/cmpopts"
tb "github.com/tektoncd/pipeline/internal/builder/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
"knative.dev/pkg/apis"
)

Expand Down Expand Up @@ -92,7 +93,7 @@ func TestCondition_Invalidate(t *testing.T) {
t.Fatalf("Expected an Error, got nothing for %v", tc)
}
if d := cmp.Diff(tc.expectedError, *err, cmpopts.IgnoreUnexported(apis.FieldError{})); d != "" {
t.Errorf("Condition.Validate() errors diff -want, +got: %v", d)
t.Errorf("Condition.Validate() errors diff %s", diff.PrintWantGot(d))
}
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/pipeline/v1alpha1/container_replacements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
)

Expand Down Expand Up @@ -121,7 +122,7 @@ func TestApplyContainerReplacements(t *testing.T) {

v1alpha1.ApplyContainerReplacements(&s, replacements, arrayReplacements)
if d := cmp.Diff(s, expected); d != "" {
t.Errorf("Container replacements failed: %s", d)
t.Errorf("Container replacements failed: %s", diff.PrintWantGot(d))
}
}

Expand All @@ -142,6 +143,6 @@ func TestApplyContainerReplacements_NotDefined(t *testing.T) {
}
v1alpha1.ApplyContainerReplacements(&s, replacements, arrayReplacements)
if d := cmp.Diff(s, expected); d != "" {
t.Errorf("Unexpected container replacement: %s", d)
t.Errorf("Unexpected container replacement: %s", diff.PrintWantGot(d))
}
}
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1alpha1/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"testing"

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
)
Expand Down Expand Up @@ -130,7 +131,7 @@ func TestMergeStepsWithStepTemplate(t *testing.T) {
}

if d := cmp.Diff(tc.expected, result, resourceQuantityCmp); d != "" {
t.Errorf("merged steps don't match, diff: %s", d)
t.Errorf("merged steps don't match, diff: %s", diff.PrintWantGot(d))
}
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/pipeline/v1alpha1/param_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/google/go-cmp/cmp"
tb "github.com/tektoncd/pipeline/internal/builder/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
)

func TestParamSpec_SetDefaults(t *testing.T) {
Expand Down Expand Up @@ -72,7 +73,7 @@ func TestParamSpec_SetDefaults(t *testing.T) {
ctx := context.Background()
tc.before.SetDefaults(ctx)
if d := cmp.Diff(tc.before, tc.defaultsApplied); d != "" {
t.Errorf("ParamSpec.SetDefaults/%s (-want, +got) = %v", tc.name, d)
t.Errorf("ParamSpec.SetDefaults/%s %s", tc.name, diff.PrintWantGot(d))
}
})
}
Expand Down Expand Up @@ -133,7 +134,7 @@ func TestArrayOrString_ApplyReplacements(t *testing.T) {
t.Run(tt.name, func(t *testing.T) {
tt.args.input.ApplyReplacements(tt.args.stringReplacements, tt.args.arrayReplacements)
if d := cmp.Diff(tt.expectedOutput, tt.args.input); d != "" {
t.Errorf("ApplyReplacements() output did not match expected value %s", d)
t.Errorf("ApplyReplacements() output did not match expected value %s", diff.PrintWantGot(d))
}
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/pipeline/v1alpha1/pipeline_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
Expand Down Expand Up @@ -170,8 +171,8 @@ func TestPipelineConversion(t *testing.T) {
t.Errorf("ConvertFrom() = %v", err)
}
t.Logf("ConvertFrom() = %#v", got)
if diff := cmp.Diff(test.in, got); diff != "" {
t.Errorf("roundtrip (-want, +got) = %v", diff)
if d := cmp.Diff(test.in, got); d != "" {
t.Errorf("roundtrip %s", diff.PrintWantGot(d))
}
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
Expand Down Expand Up @@ -172,8 +173,8 @@ func TestPipelineRunConversion(t *testing.T) {
t.Errorf("ConvertFrom() = %v", err)
}
t.Logf("ConvertFrom() = %#v", got)
if diff := cmp.Diff(test.in, got); diff != "" {
t.Errorf("roundtrip (-want, +got) = %v", diff)
if d := cmp.Diff(test.in, got); d != "" {
t.Errorf("roundtrip %s", diff.PrintWantGot(d))
}
})
}
Expand Down
9 changes: 5 additions & 4 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/tektoncd/pipeline/pkg/apis/config"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/contexts"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
logtesting "knative.dev/pkg/logging/testing"
Expand Down Expand Up @@ -88,8 +89,8 @@ func TestPipelineRunSpec_SetDefaults(t *testing.T) {
ctx := context.Background()
tc.prs.SetDefaults(ctx)

if diff := cmp.Diff(tc.want, tc.prs); diff != "" {
t.Errorf("Mismatch of PipelineRunSpec: %s", diff)
if d := cmp.Diff(tc.want, tc.prs); d != "" {
t.Errorf("Mismatch of PipelineRunSpec %s", diff.PrintWantGot(d))
}
})
}
Expand Down Expand Up @@ -257,8 +258,8 @@ func TestPipelineRunDefaulting(t *testing.T) {
}
got.SetDefaults(ctx)
if !cmp.Equal(got, tc.want, ignoreUnexportedResources) {
t.Errorf("SetDefaults (-want, +got) = %v",
cmp.Diff(got, tc.want, ignoreUnexportedResources))
d := cmp.Diff(got, tc.want, ignoreUnexportedResources)
t.Errorf("SetDefaults %s", diff.PrintWantGot(d))
}
})
}
Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/google/go-cmp/cmp"
tb "github.com/tektoncd/pipeline/internal/builder/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
Expand All @@ -49,7 +50,7 @@ func TestPipelineRunStatusConditions(t *testing.T) {

fooStatus := p.Status.GetCondition(foo.Type)
if d := cmp.Diff(fooStatus, foo, ignoreVolatileTime); d != "" {
t.Errorf("Unexpected pipeline run condition type; want %v got %v; diff %v", fooStatus, foo, d)
t.Errorf("Unexpected pipeline run condition type; diff %s", diff.PrintWantGot(d))
}

// Add a second condition.
Expand All @@ -58,7 +59,7 @@ func TestPipelineRunStatusConditions(t *testing.T) {
barStatus := p.Status.GetCondition(bar.Type)

if d := cmp.Diff(barStatus, bar, ignoreVolatileTime); d != "" {
t.Fatalf("Unexpected pipeline run condition type; want %v got %v; diff %s", barStatus, bar, d)
t.Fatalf("Unexpected pipeline run condition type; diff %s", diff.PrintWantGot(d))
}
}

Expand All @@ -78,7 +79,7 @@ func TestPipelineRun_TaskRunref(t *testing.T) {
}

if d := cmp.Diff(p.GetTaskRunRef(), expectTaskRunRef); d != "" {
t.Fatalf("Taskrun reference mismatch; want %v got %v; diff %s", expectTaskRunRef, p.GetTaskRunRef(), d)
t.Fatalf("Taskrun reference mismatch; diff %s", diff.PrintWantGot(d))
}
}

Expand Down
7 changes: 4 additions & 3 deletions pkg/apis/pipeline/v1alpha1/pipelinerun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
Expand Down Expand Up @@ -86,7 +87,7 @@ func TestPipelineRun_Invalidate(t *testing.T) {
t.Run(ps.name, func(t *testing.T) {
err := ps.pr.Validate(context.Background())
if d := cmp.Diff(err.Error(), ps.want.Error()); d != "" {
t.Errorf("PipelineRun.Validate/%s (-want, +got) = %v", ps.name, d)
t.Errorf("PipelineRun.Validate/%s %s", ps.name, diff.PrintWantGot(d))
}
})
}
Expand Down Expand Up @@ -187,7 +188,7 @@ func TestPipelineRunSpec_Invalidate(t *testing.T) {
t.Run(ps.name, func(t *testing.T) {
err := ps.spec.Validate(context.Background())
if d := cmp.Diff(ps.wantErr.Error(), err.Error()); d != "" {
t.Errorf("PipelineRunSpec.Validate/%s (-want, +got) = %v", ps.name, d)
t.Errorf("PipelineRunSpec.Validate/%s %s", ps.name, diff.PrintWantGot(d))
}
})
}
Expand All @@ -213,7 +214,7 @@ func TestPipelineRunSpec_Validate(t *testing.T) {
for _, ps := range tests {
t.Run(ps.name, func(t *testing.T) {
if err := ps.spec.Validate(context.Background()); err != nil {
t.Errorf("PipelineRunSpec.Validate/%s (-want, +got) = %v", ps.name, err)
t.Errorf("PipelineRunSpec.Validate/%s %v", ps.name, err)
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1alpha1/resource_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
)

Expand Down Expand Up @@ -94,7 +95,7 @@ func TestApplyTaskModifier(t *testing.T) {
}}

if d := cmp.Diff(expectedTaskSpec, tc.ts); d != "" {
t.Errorf("TaskSpec was not modified as expected (-want, +got): %s", d)
t.Errorf("TaskSpec was not modified as expected %s", diff.PrintWantGot(d))
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1alpha1/step_replacements_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
)

Expand Down Expand Up @@ -126,6 +127,6 @@ func TestApplyStepReplacements(t *testing.T) {
}
v1alpha1.ApplyStepReplacements(&s, replacements, arrayReplacements)
if d := cmp.Diff(s, expected); d != "" {
t.Errorf("Container replacements failed: %s", d)
t.Errorf("Container replacements failed: %s", diff.PrintWantGot(d))
}
}
9 changes: 5 additions & 4 deletions pkg/apis/pipeline/v1alpha1/task_conversion_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"github.com/google/go-cmp/cmp"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/pkg/apis"
Expand Down Expand Up @@ -176,8 +177,8 @@ func TestTaskConversion(t *testing.T) {
t.Errorf("ConvertFrom() = %v", err)
}
t.Logf("ConvertFrom() = %#v", got)
if diff := cmp.Diff(test.in, got); diff != "" {
t.Errorf("roundtrip (-want, +got) = %v", diff)
if d := cmp.Diff(test.in, got); d != "" {
t.Errorf("roundtrip %s", diff.PrintWantGot(d))
}
})
}
Expand Down Expand Up @@ -313,8 +314,8 @@ func TestTaskConversionFromDeprecated(t *testing.T) {
t.Errorf("ConvertFrom() = %v", err)
}
t.Logf("ConvertFrom() = %#v", got)
if diff := cmp.Diff(test.want, got); diff != "" {
t.Errorf("roundtrip (-want, +got) = %v", diff)
if d := cmp.Diff(test.want, got); d != "" {
t.Errorf("roundtrip %s", diff.PrintWantGot(d))
}
})
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/pipeline/v1alpha1/task_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1"
"github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
resource "github.com/tektoncd/pipeline/pkg/apis/resource/v1alpha1"
"github.com/tektoncd/pipeline/test/diff"
corev1 "k8s.io/api/core/v1"
"knative.dev/pkg/apis"
)
Expand Down Expand Up @@ -1015,7 +1016,7 @@ func TestTaskSpecValidateError(t *testing.T) {
t.Fatalf("Expected an error, got nothing for %v", ts)
}
if d := cmp.Diff(tt.expectedError, *err, cmpopts.IgnoreUnexported(apis.FieldError{})); d != "" {
t.Errorf("TaskSpec.Validate() errors diff -want, +got: %v", d)
t.Errorf("TaskSpec.Validate() errors diff %s", diff.PrintWantGot(d))
}
})
}
Expand Down
Loading