Skip to content

Commit

Permalink
Rename some test to be closer to golang naming convention 💅
Browse files Browse the repository at this point in the history
Usually it is `TestF()` and `TestF_Case()` for a function `F()`.

Signed-off-by: Vincent Demeester <[email protected]>
  • Loading branch information
vdemeester authored and tekton-robot committed Jan 10, 2020
1 parent d5c6e64 commit 36b4aaa
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
8 changes: 4 additions & 4 deletions pkg/apis/pipeline/v1alpha1/build_gcs_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var images = pipeline.Images{
ImageDigestExporterImage: "override-with-imagedigest-exporter-image:latest",
}

func Test_Invalid_BuildGCSResource(t *testing.T) {
func TestBuildGCSResource_Invalid(t *testing.T) {
for _, tc := range []struct {
name string
pipelineResource *v1alpha1.PipelineResource
Expand Down Expand Up @@ -100,7 +100,7 @@ func Test_Invalid_BuildGCSResource(t *testing.T) {
}
}

func Test_Valid_NewBuildGCSResource(t *testing.T) {
func TestNewBuildGCSResource_Valid(t *testing.T) {
pr := tb.PipelineResource("build-gcs-resource", "default", tb.PipelineResourceSpec(
v1alpha1.PipelineResourceTypeStorage,
tb.PipelineResourceSpecParam("Location", "gs://fake-bucket"),
Expand All @@ -125,7 +125,7 @@ func Test_Valid_NewBuildGCSResource(t *testing.T) {
}
}

func Test_BuildGCSGetReplacements(t *testing.T) {
func TestBuildGCS_GetReplacements(t *testing.T) {
r := &v1alpha1.BuildGCSResource{
Name: "gcs-resource",
Location: "gs://fake-bucket",
Expand All @@ -141,7 +141,7 @@ func Test_BuildGCSGetReplacements(t *testing.T) {
}
}

func Test_BuildGCSGetInputSteps(t *testing.T) {
func TestBuildGCS_GetInputSteps(t *testing.T) {
for _, at := range []v1alpha1.GCSArtifactType{
v1alpha1.GCSArchive,
v1alpha1.GCSZipArchive,
Expand Down
10 changes: 5 additions & 5 deletions pkg/apis/pipeline/v1alpha1/cloud_event_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
tb "github.com/tektoncd/pipeline/test/builder"
)

func Test_NewCloudEventResource_Invalid(t *testing.T) {
func TestNewCloudEventResource_Invalid(t *testing.T) {
testcases := []struct {
name string
pipelineResource *v1alpha1.PipelineResource
Expand All @@ -52,7 +52,7 @@ func Test_NewCloudEventResource_Invalid(t *testing.T) {
}
}

func Test_NewCloudEventResource_Valid(t *testing.T) {
func TestNewCloudEventResource_Valid(t *testing.T) {
pr := tb.PipelineResource("cloud-event-resource-uri", "default", tb.PipelineResourceSpec(
v1alpha1.PipelineResourceTypeCloudEvent,
tb.PipelineResourceSpecParam("TargetURI", "http://fake-sink"),
Expand All @@ -72,7 +72,7 @@ func Test_NewCloudEventResource_Valid(t *testing.T) {
}
}

func Test_CloudEventGetReplacements(t *testing.T) {
func TestCloudEvent_GetReplacements(t *testing.T) {
r := &v1alpha1.CloudEventResource{
Name: "cloud-event-resource",
TargetURI: "http://fake-uri",
Expand All @@ -88,7 +88,7 @@ func Test_CloudEventGetReplacements(t *testing.T) {
}
}

func Test_CloudEventInputContainerSpec(t *testing.T) {
func TestCloudEvent_InputContainerSpec(t *testing.T) {
r := &v1alpha1.CloudEventResource{
Name: "cloud-event-resource",
TargetURI: "http://fake-uri",
Expand All @@ -103,7 +103,7 @@ func Test_CloudEventInputContainerSpec(t *testing.T) {
}
}

func Test_CloudEventOutputContainerSpec(t *testing.T) {
func TestCloudEvent_OutputContainerSpec(t *testing.T) {
r := &v1alpha1.CloudEventResource{
Name: "cloud-event-resource",
TargetURI: "http://fake-uri",
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1alpha1/cluster_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func TestNewClusterResource(t *testing.T) {
}
}

func Test_ClusterResource_GetInputTaskModifier(t *testing.T) {
func TestClusterResource_GetInputTaskModifier(t *testing.T) {
names.TestingSeed()
clusterResource := &v1alpha1.ClusterResource{
Name: "test-cluster-resource",
Expand Down
8 changes: 4 additions & 4 deletions pkg/apis/pipeline/v1alpha1/git_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ import (
corev1 "k8s.io/api/core/v1"
)

func Test_Invalid_NewGitResource(t *testing.T) {
func TestNewGitResource_Invalid(t *testing.T) {
if _, err := v1alpha1.NewGitResource("override-with-git:latest", tb.PipelineResource("git-resource", "default", tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGCS))); err == nil {
t.Error("Expected error creating Git resource")
}
}

func Test_Valid_NewGitResource(t *testing.T) {
func TestNewGitResource_Valid(t *testing.T) {
for _, tc := range []struct {
desc string
pipelineResource *v1alpha1.PipelineResource
Expand Down Expand Up @@ -181,7 +181,7 @@ func Test_Valid_NewGitResource(t *testing.T) {
}
}

func Test_GitResource_Replacements(t *testing.T) {
func TestGitResource_Replacements(t *testing.T) {
r := &v1alpha1.GitResource{
Name: "git-resource",
Type: v1alpha1.PipelineResourceTypeGit,
Expand All @@ -207,7 +207,7 @@ func Test_GitResource_Replacements(t *testing.T) {
}
}

func Test_GitResource_GetDownloadTaskModifier(t *testing.T) {
func TestGitResource_GetDownloadTaskModifier(t *testing.T) {
names.TestingSeed()

for _, tc := range []struct {
Expand Down
6 changes: 3 additions & 3 deletions pkg/apis/pipeline/v1alpha1/image_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
tb "github.com/tektoncd/pipeline/test/builder"
)

func Test_Invalid_NewImageResource(t *testing.T) {
func TestNewImageResource_Invalid(t *testing.T) {
r := tb.PipelineResource("git-resource", "default", tb.PipelineResourceSpec(v1alpha1.PipelineResourceTypeGit))

_, err := v1alpha1.NewImageResource(r)
Expand All @@ -34,7 +34,7 @@ func Test_Invalid_NewImageResource(t *testing.T) {
}
}

func Test_Valid_NewImageResource(t *testing.T) {
func TestNewImageResource_Valid(t *testing.T) {
want := &v1alpha1.ImageResource{
Name: "image-resource",
Type: v1alpha1.PipelineResourceTypeImage,
Expand Down Expand Up @@ -62,7 +62,7 @@ func Test_Valid_NewImageResource(t *testing.T) {
}
}

func Test_ImageResource_Replacements(t *testing.T) {
func TestImageResource_Replacements(t *testing.T) {
ir := &v1alpha1.ImageResource{
Name: "image-resource",
Type: v1alpha1.PipelineResourceTypeImage,
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/pipeline/v1alpha1/taskrun_validation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func TestTaskRun_Validate(t *testing.T) {
}
}

func Test_TaskRun_Workspaces_Invalid(t *testing.T) {
func TestTaskRun_Workspaces_Invalid(t *testing.T) {
tests := []struct {
name string
tr *v1alpha1.TaskRun
Expand Down
6 changes: 3 additions & 3 deletions pkg/pullrequest/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ func readAndUnmarshal(t *testing.T, p string, v interface{}) {
}
}

func Test_labelsToDisk(t *testing.T) {
func TestLabelsToDisk(t *testing.T) {
type args struct {
labels []*scm.Label
}
Expand Down Expand Up @@ -487,7 +487,7 @@ func Test_labelsToDisk(t *testing.T) {
}
}

func Test_statusToDisk(t *testing.T) {
func TestStatusToDisk(t *testing.T) {
type args struct {
statuses []*scm.Status
}
Expand Down Expand Up @@ -566,7 +566,7 @@ func writeManifest(t *testing.T, items []string, path string) {
}
}

func Test_labelsFromDisk(t *testing.T) {
func TestLabelsFromDisk(t *testing.T) {
type args struct {
fileNames []string
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pullrequest/scm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestNewSCMHandler(t *testing.T) {
}
}

func Test_guessProvider(t *testing.T) {
func TestGuessProvider(t *testing.T) {
tests := []struct {
name string
url string
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
"knative.dev/pkg/apis"
)

func Test_EmitEvent(t *testing.T) {
func TestEmitEvent(t *testing.T) {
testcases := []struct {
name string
before *apis.Condition
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/taskrun/resources/volume_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
corev1 "k8s.io/api/core/v1"
)

func Test_PVC_Volume(t *testing.T) {
func TestGetPVCVolume(t *testing.T) {
expectedVolume := corev1.Volume{
Name: "test-pvc",
VolumeSource: corev1.VolumeSource{
Expand Down
2 changes: 1 addition & 1 deletion pkg/system/names_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
"testing"
)

func Test_GetNamespace(t *testing.T) {
func TestGetNamespace(t *testing.T) {
testcases := []struct {
envVar string
expectEnvVar string
Expand Down

0 comments on commit 36b4aaa

Please sign in to comment.