diff --git a/pkg/apis/pipeline/v1/matrix_types_test.go b/pkg/apis/pipeline/v1/matrix_types_test.go index c1ca04efd80..72877a9765e 100644 --- a/pkg/apis/pipeline/v1/matrix_types_test.go +++ b/pkg/apis/pipeline/v1/matrix_types_test.go @@ -11,12 +11,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1 +package v1_test import ( "testing" "github.com/google/go-cmp/cmp" + . "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" "github.com/tektoncd/pipeline/test/diff" ) diff --git a/pkg/apis/pipeline/v1/taskref_types_test.go b/pkg/apis/pipeline/v1/taskref_types_test.go index 66acb286679..370cc6c7c3e 100644 --- a/pkg/apis/pipeline/v1/taskref_types_test.go +++ b/pkg/apis/pipeline/v1/taskref_types_test.go @@ -1,6 +1,26 @@ -package v1 +/* +Copyright 2023 The Tekton Authors -import "testing" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1_test + +import ( + "testing" + + . "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1" +) func TestTaskRef_IsCustomTask(t *testing.T) { tests := []struct { diff --git a/pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go b/pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go index 6dda3ba2987..56dbc4c9658 100644 --- a/pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go +++ b/pkg/apis/pipeline/v1beta1/cluster_task_conversion_test.go @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta1_test import ( "context" "testing" + + . "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ) func TestClusterTaskConversionBadType(t *testing.T) { diff --git a/pkg/apis/pipeline/v1beta1/matrix_types_test.go b/pkg/apis/pipeline/v1beta1/matrix_types_test.go index dfde9bf84d6..303d45572a5 100644 --- a/pkg/apis/pipeline/v1beta1/matrix_types_test.go +++ b/pkg/apis/pipeline/v1beta1/matrix_types_test.go @@ -11,12 +11,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta1_test import ( "testing" "github.com/google/go-cmp/cmp" + . "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" "github.com/tektoncd/pipeline/test/diff" ) diff --git a/pkg/apis/pipeline/v1beta1/merge_test.go b/pkg/apis/pipeline/v1beta1/merge_test.go index c2248b0aa1b..897e0cb93f5 100644 --- a/pkg/apis/pipeline/v1beta1/merge_test.go +++ b/pkg/apis/pipeline/v1beta1/merge_test.go @@ -14,12 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package v1beta1 +package v1beta1_test import ( "testing" "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" "k8s.io/apimachinery/pkg/api/resource" diff --git a/pkg/apis/pipeline/v1beta1/taskref_types_test.go b/pkg/apis/pipeline/v1beta1/taskref_types_test.go index 544fb14c411..2696fd6c0af 100644 --- a/pkg/apis/pipeline/v1beta1/taskref_types_test.go +++ b/pkg/apis/pipeline/v1beta1/taskref_types_test.go @@ -1,6 +1,26 @@ -package v1beta1 +/* +Copyright 2023 The Tekton Authors -import "testing" +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1beta1_test + +import ( + "testing" + + . "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" +) func TestTaskRef_IsCustomTask(t *testing.T) { tests := []struct { diff --git a/pkg/apis/resolution/v1alpha1/resolution_request_conversion_test.go b/pkg/apis/resolution/v1alpha1/resolution_request_conversion_test.go index 773073464c3..759254992ce 100644 --- a/pkg/apis/resolution/v1alpha1/resolution_request_conversion_test.go +++ b/pkg/apis/resolution/v1alpha1/resolution_request_conversion_test.go @@ -15,7 +15,7 @@ */ -package v1alpha1 +package v1alpha1_test import ( "context" @@ -24,6 +24,7 @@ import ( "github.com/google/go-cmp/cmp" pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/apis/resolution/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1" "github.com/tektoncd/pipeline/test/diff" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/apis/resolution/v1beta1/resolution_request_conversion_test.go b/pkg/apis/resolution/v1beta1/resolution_request_conversion_test.go index 44b77f51c21..1a1f9826070 100644 --- a/pkg/apis/resolution/v1beta1/resolution_request_conversion_test.go +++ b/pkg/apis/resolution/v1beta1/resolution_request_conversion_test.go @@ -15,13 +15,14 @@ */ -package v1beta1 +package v1beta1_test import ( "context" "testing" pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1" ) func TestResolutionRequestConversionBadType(t *testing.T) { diff --git a/pkg/apis/run/v1beta1/customrunstatus_types_test.go b/pkg/apis/run/v1beta1/customrunstatus_types_test.go index d2b0fcd1da2..571d0c5d677 100644 --- a/pkg/apis/run/v1beta1/customrunstatus_types_test.go +++ b/pkg/apis/run/v1beta1/customrunstatus_types_test.go @@ -15,7 +15,7 @@ */ -package v1beta1 +package v1beta1_test import ( "testing" @@ -23,6 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/run/v1alpha1" + . "github.com/tektoncd/pipeline/pkg/apis/run/v1beta1" "github.com/tektoncd/pipeline/test/diff" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/pkg/credentials/initialize_test.go b/pkg/credentials/initialize_test.go index dbc934de37e..1e89b184ab8 100644 --- a/pkg/credentials/initialize_test.go +++ b/pkg/credentials/initialize_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package credentials import ( diff --git a/pkg/internal/computeresources/transformer_test.go b/pkg/internal/computeresources/transformer_test.go index 63154e2b85f..e805392838d 100644 --- a/pkg/internal/computeresources/transformer_test.go +++ b/pkg/internal/computeresources/transformer_test.go @@ -13,6 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ + package computeresources import ( diff --git a/pkg/list/diff_test.go b/pkg/list/diff_test.go index cdd1eb37f22..c89a47f70b0 100644 --- a/pkg/list/diff_test.go +++ b/pkg/list/diff_test.go @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package list +package list_test import ( "reflect" "testing" + + . "github.com/tektoncd/pipeline/pkg/list" ) func TestIsSame_same(t *testing.T) { diff --git a/pkg/names/generate_test.go b/pkg/names/generate_test.go index c0e597a5b04..79e38debfe5 100644 --- a/pkg/names/generate_test.go +++ b/pkg/names/generate_test.go @@ -14,12 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package names +package names_test import ( "strings" "testing" + . "github.com/tektoncd/pipeline/pkg/names" "github.com/tektoncd/pipeline/test/names" ) @@ -51,7 +52,7 @@ func TestRestrictLength(t *testing.T) { want: "hello", }, { in: strings.Repeat("a", 100), - want: strings.Repeat("a", maxNameLength), + want: strings.Repeat("a", 63), }, { // Values that don't end with an alphanumeric value are // trimmed until they do. diff --git a/pkg/reconciler/customrun/customrun_test.go b/pkg/reconciler/customrun/customrun_test.go index c739e19055a..569752c11d0 100644 --- a/pkg/reconciler/customrun/customrun_test.go +++ b/pkg/reconciler/customrun/customrun_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package customrun +package customrun_test import ( "context" @@ -25,6 +25,7 @@ import ( "github.com/google/go-cmp/cmp/cmpopts" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/customrun" "github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" "github.com/tektoncd/pipeline/test" diff --git a/pkg/reconciler/events/cache/cache_test.go b/pkg/reconciler/events/cache/cache_test.go index 4ae12beab5f..5a5ee2855db 100644 --- a/pkg/reconciler/events/cache/cache_test.go +++ b/pkg/reconciler/events/cache/cache_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package cache +package cache_test import ( "net/url" @@ -28,6 +28,7 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/events/cache" "github.com/tektoncd/pipeline/test/diff" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/reconciler/events/event_test.go b/pkg/reconciler/events/event_test.go index ba350a20259..d95ba2aefb3 100644 --- a/pkg/reconciler/events/event_test.go +++ b/pkg/reconciler/events/event_test.go @@ -14,13 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -package events +package events_test import ( "testing" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/events" "github.com/tektoncd/pipeline/pkg/reconciler/events/cloudevent" "github.com/tektoncd/pipeline/pkg/reconciler/events/k8sevent" corev1 "k8s.io/api/core/v1" diff --git a/pkg/reconciler/events/k8sevent/event_test.go b/pkg/reconciler/events/k8sevent/event_test.go index f5c446696b5..13df5091e7f 100644 --- a/pkg/reconciler/events/k8sevent/event_test.go +++ b/pkg/reconciler/events/k8sevent/event_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package k8sevent +package k8sevent_test import ( "errors" @@ -23,6 +23,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/events/k8sevent" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/tools/record" diff --git a/pkg/reconciler/pipelinerun/pipelinespec/pipelinespec_test.go b/pkg/reconciler/pipelinerun/pipelinespec/pipelinespec_test.go index a4d0a0c8129..6ffef250cfd 100644 --- a/pkg/reconciler/pipelinerun/pipelinespec/pipelinespec_test.go +++ b/pkg/reconciler/pipelinerun/pipelinespec/pipelinespec_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package pipelinespec +package pipelinespec_test import ( "context" @@ -24,6 +24,7 @@ import ( "github.com/google/go-cmp/cmp" cfgtesting "github.com/tektoncd/pipeline/pkg/apis/config/testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun/pipelinespec" "github.com/tektoncd/pipeline/test/diff" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/reconciler/pipelinerun/resources/apply_test.go b/pkg/reconciler/pipelinerun/resources/apply_test.go index 82e64f7e0ab..77df9194ef4 100644 --- a/pkg/reconciler/pipelinerun/resources/apply_test.go +++ b/pkg/reconciler/pipelinerun/resources/apply_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package resources +package resources_test import ( "context" @@ -24,6 +24,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/config" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun/resources" "github.com/tektoncd/pipeline/test/diff" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/selection" diff --git a/pkg/reconciler/pipelinerun/resources/resultrefresolution_test.go b/pkg/reconciler/pipelinerun/resources/resultrefresolution_test.go index 09d04cddd40..dcbc87066d2 100644 --- a/pkg/reconciler/pipelinerun/resources/resultrefresolution_test.go +++ b/pkg/reconciler/pipelinerun/resources/resultrefresolution_test.go @@ -1,3 +1,19 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + package resources import ( diff --git a/pkg/reconciler/pipelinerun/resources/validate_dependencies_test.go b/pkg/reconciler/pipelinerun/resources/validate_dependencies_test.go index 34604dabc18..effb389d9c7 100644 --- a/pkg/reconciler/pipelinerun/resources/validate_dependencies_test.go +++ b/pkg/reconciler/pipelinerun/resources/validate_dependencies_test.go @@ -14,13 +14,14 @@ See the License for the specific language governing permissions and limitations under the License. */ -package resources +package resources_test import ( "strings" "testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun/resources" "github.com/tektoncd/pipeline/pkg/reconciler/taskrun/resources" "k8s.io/apimachinery/pkg/selection" ) diff --git a/pkg/reconciler/pipelinerun/resources/validate_params_test.go b/pkg/reconciler/pipelinerun/resources/validate_params_test.go index e1fcef4df33..db97d837545 100644 --- a/pkg/reconciler/pipelinerun/resources/validate_params_test.go +++ b/pkg/reconciler/pipelinerun/resources/validate_params_test.go @@ -14,12 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package resources +package resources_test import ( "testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/reconciler/pipelinerun/resources" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/reconciler/resources_test.go b/pkg/reconciler/resources_test.go index 4e391d07536..76f8d023ed2 100644 --- a/pkg/reconciler/resources_test.go +++ b/pkg/reconciler/resources_test.go @@ -14,17 +14,23 @@ See the License for the specific language governing permissions and limitations under the License. */ -package reconciler +package reconciler_test import ( "testing" "time" + . "github.com/tektoncd/pipeline/pkg/reconciler" corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "knative.dev/pkg/kmeta" ) +const ( + // minimumResourceAge is the age at which resources stop being IsYoungResource. + minimumResourceAge = 5 * time.Second +) + func TestIsYoungResource(t *testing.T) { tests := []struct { name string diff --git a/pkg/reconciler/run/run_test.go b/pkg/reconciler/run/run_test.go index 2189b33660a..c47cac0c35c 100644 --- a/pkg/reconciler/run/run_test.go +++ b/pkg/reconciler/run/run_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package run +package run_test import ( "context" @@ -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/reconciler/events/cloudevent" + . "github.com/tektoncd/pipeline/pkg/reconciler/run" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" "github.com/tektoncd/pipeline/test" "github.com/tektoncd/pipeline/test/names" diff --git a/pkg/resolution/common/context_test.go b/pkg/resolution/common/context_test.go index 83e3b165b7d..704c5396256 100644 --- a/pkg/resolution/common/context_test.go +++ b/pkg/resolution/common/context_test.go @@ -1,8 +1,26 @@ -package common +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package common_test import ( "context" "testing" + + . "github.com/tektoncd/pipeline/pkg/resolution/common" ) func TestRequestNamespace(t *testing.T) { diff --git a/pkg/resolution/common/errors_test.go b/pkg/resolution/common/errors_test.go index f73a5490fc2..4a3a955454a 100644 --- a/pkg/resolution/common/errors_test.go +++ b/pkg/resolution/common/errors_test.go @@ -14,11 +14,13 @@ See the License for the specific language governing permissions and limitations under the License. */ -package common +package common_test import ( "errors" "testing" + + . "github.com/tektoncd/pipeline/pkg/resolution/common" ) type TestError struct{} diff --git a/pkg/resolution/resolver/bundle/resolver_test.go b/pkg/resolution/resolver/bundle/resolver_test.go index b950dd27872..fe33f2333a7 100644 --- a/pkg/resolution/resolver/bundle/resolver_test.go +++ b/pkg/resolution/resolver/bundle/resolver_test.go @@ -14,7 +14,7 @@ limitations under the License. */ -package bundle +package bundle_test import ( "context" @@ -32,6 +32,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" resolutioncommon "github.com/tektoncd/pipeline/pkg/resolution/common" + . "github.com/tektoncd/pipeline/pkg/resolution/resolver/bundle" frtesting "github.com/tektoncd/pipeline/pkg/resolution/resolver/framework/testing" "github.com/tektoncd/pipeline/pkg/resolution/resolver/internal" "github.com/tektoncd/pipeline/test" @@ -44,6 +45,10 @@ import ( "sigs.k8s.io/yaml" ) +const ( + disabledError = "cannot handle resolution request, enable-bundles-resolver feature flag not true" +) + func TestGetSelector(t *testing.T) { resolver := Resolver{} sel := resolver.GetSelector(context.Background()) diff --git a/pkg/resolution/resolver/cluster/resolver_test.go b/pkg/resolution/resolver/cluster/resolver_test.go index 7518f8874d7..983fa73d0b7 100644 --- a/pkg/resolution/resolver/cluster/resolver_test.go +++ b/pkg/resolution/resolver/cluster/resolver_test.go @@ -15,7 +15,7 @@ */ -package cluster +package cluster_test import ( "context" @@ -32,6 +32,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" resolutioncommon "github.com/tektoncd/pipeline/pkg/resolution/common" + . "github.com/tektoncd/pipeline/pkg/resolution/resolver/cluster" "github.com/tektoncd/pipeline/pkg/resolution/resolver/framework" frtesting "github.com/tektoncd/pipeline/pkg/resolution/resolver/framework/testing" "github.com/tektoncd/pipeline/pkg/resolution/resolver/internal" @@ -45,6 +46,10 @@ import ( "sigs.k8s.io/yaml" ) +const ( + disabledError = "cannot handle resolution request, enable-cluster-resolver feature flag not true" +) + func TestGetSelector(t *testing.T) { resolver := Resolver{} sel := resolver.GetSelector(context.Background()) @@ -376,7 +381,7 @@ func TestResolve(t *testing.T) { d := test.Data{ ConfigMaps: []*corev1.ConfigMap{{ ObjectMeta: metav1.ObjectMeta{ - Name: configMapName, + Name: "cluster-resolver-config", Namespace: resolverconfig.ResolversNamespace(system.Namespace()), }, Data: confMap, diff --git a/pkg/resolution/resolver/framework/configstore_test.go b/pkg/resolution/resolver/framework/configstore_test.go index 34bc82e39d3..ec102d4ac86 100644 --- a/pkg/resolution/resolver/framework/configstore_test.go +++ b/pkg/resolution/resolver/framework/configstore_test.go @@ -14,13 +14,13 @@ limitations under the License. */ -package framework +package framework_test import ( "testing" + . "github.com/tektoncd/pipeline/pkg/resolution/resolver/framework" corev1 "k8s.io/api/core/v1" - "knative.dev/pkg/configmap" logtesting "knative.dev/pkg/logging/testing" ) @@ -64,15 +64,9 @@ func TestDataFromConfigMap(t *testing.T) { } func TestGetResolverConfig(t *testing.T) { - _ = &ConfigStore{ - resolverConfigName: "test", - untyped: configmap.NewUntypedStore( - "test-config", - logtesting.TestLogger(t), - configmap.Constructors{ - "test": DataFromConfigMap, - }, - ), + config := NewConfigStore("test", logtesting.TestLogger(t)) + if len(config.GetResolverConfig()) != 0 { + t.Fatalf("expected empty config") } } diff --git a/pkg/resolution/resolver/framework/reconciler_test.go b/pkg/resolution/resolver/framework/reconciler_test.go index f8f583ac895..7db2a15acbb 100644 --- a/pkg/resolution/resolver/framework/reconciler_test.go +++ b/pkg/resolution/resolver/framework/reconciler_test.go @@ -14,7 +14,7 @@ limitations under the License. */ -package framework +package framework_test import ( "context" @@ -30,6 +30,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/resolution/v1beta1" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" resolutioncommon "github.com/tektoncd/pipeline/pkg/resolution/common" + . "github.com/tektoncd/pipeline/pkg/resolution/resolver/framework" "github.com/tektoncd/pipeline/test" "github.com/tektoncd/pipeline/test/diff" "github.com/tektoncd/pipeline/test/names" diff --git a/pkg/status/status_test.go b/pkg/status/status_test.go index e3dae9c4b79..af81a67e886 100644 --- a/pkg/status/status_test.go +++ b/pkg/status/status_test.go @@ -15,7 +15,7 @@ */ -package status +package status_test import ( "errors" @@ -25,6 +25,7 @@ import ( "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1alpha1" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" ttesting "github.com/tektoncd/pipeline/pkg/reconciler/testing" + . "github.com/tektoncd/pipeline/pkg/status" "github.com/tektoncd/pipeline/test" "github.com/tektoncd/pipeline/test/diff" "github.com/tektoncd/pipeline/test/parse" diff --git a/pkg/termination/parse_test.go b/pkg/termination/parse_test.go index ac55a438e4c..512b39e6db6 100644 --- a/pkg/termination/parse_test.go +++ b/pkg/termination/parse_test.go @@ -13,7 +13,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package termination +package termination_test import ( "strings" @@ -21,6 +21,7 @@ import ( "github.com/google/go-cmp/cmp" v1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/termination" "github.com/tektoncd/pipeline/test/diff" "knative.dev/pkg/logging" ) diff --git a/pkg/termination/write_test.go b/pkg/termination/write_test.go index 0045b937460..6862a321391 100644 --- a/pkg/termination/write_test.go +++ b/pkg/termination/write_test.go @@ -13,10 +13,9 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ -package termination +package termination_test import ( - "errors" "log" "os" "strings" @@ -24,6 +23,7 @@ import ( "github.com/google/go-cmp/cmp" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/termination" "github.com/tektoncd/pipeline/test/diff" "knative.dev/pkg/logging" ) @@ -82,7 +82,8 @@ func TestMaxSizeFile(t *testing.T) { Value: value, }} - if err := WriteMessage(tmpFile.Name(), output); !errors.Is(err, errTooLong) { + err = WriteMessage(tmpFile.Name(), output) + if _, ok := err.(MessageLengthError); !ok { t.Fatalf("Expected MessageLengthError, received: %v", err) } } diff --git a/pkg/workspace/validate_test.go b/pkg/workspace/validate_test.go index 4adc62f4e68..4a1030f432b 100644 --- a/pkg/workspace/validate_test.go +++ b/pkg/workspace/validate_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package workspace +package workspace_test import ( "context" @@ -22,6 +22,7 @@ import ( "testing" "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1" + . "github.com/tektoncd/pipeline/pkg/workspace" corev1 "k8s.io/api/core/v1" )