test: all table based test names converted to camel case

In order to have a consistent naming convention for table based tests throughout the codebase, all test names have converged to CamelCase

Signed-off-by: HashedDan <georgedanielmangum@gmail.com>
This commit is contained in:
HashedDan 2019-04-24 13:50:34 -05:00
parent b38110eefa
commit 0cb6ee0b77
7 changed files with 132 additions and 132 deletions

View File

@ -32,7 +32,7 @@ func TestAddToScheme(t *testing.T) {
wantErr bool
}{
{
name: "test",
name: "Test",
args: args{s: runtime.NewScheme()},
wantErr: false,
},

View File

@ -85,17 +85,17 @@ func TestParseClusterSpec(t *testing.T) {
want *GKEClusterSpec
}{
{
name: "nil properties",
name: "NilProperties",
args: nil,
want: &GKEClusterSpec{ReclaimPolicy: DefaultReclaimPolicy},
},
{
name: "empty properties",
name: "EmptyProperties",
args: map[string]string{},
want: &GKEClusterSpec{ReclaimPolicy: DefaultReclaimPolicy},
},
{
name: "valid values",
name: "ValidValues",
args: map[string]string{
"enableIPAlias": "true",
"machineType": "test-machine",
@ -113,7 +113,7 @@ func TestParseClusterSpec(t *testing.T) {
},
},
{
name: "invalid values",
name: "InvalidValues",
args: map[string]string{
"enableIPAlias": "really",
"machineType": "test-machine",
@ -131,7 +131,7 @@ func TestParseClusterSpec(t *testing.T) {
},
},
{
name: "defaults",
name: "Defaults",
args: map[string]string{
"machineType": "test-machine",
"zone": "test-zone",
@ -162,8 +162,8 @@ func Test_parseNodesNumber(t *testing.T) {
args string
want int64
}{
{name: "empty", args: "", want: DefaultNumberOfNodes},
{name: "invalid", args: "foo", want: DefaultNumberOfNodes},
{name: "Empty", args: "", want: DefaultNumberOfNodes},
{name: "Invalid", args: "foo", want: DefaultNumberOfNodes},
{name: "0", args: "0", want: int64(0)},
{name: "44", args: "44", want: int64(44)},
{name: "-44", args: "-44", want: DefaultNumberOfNodes},

View File

@ -95,8 +95,8 @@ func TestProjectTeam(t *testing.T) {
args *ProjectTeam
want *storage.ProjectTeam
}{
{"nil", nil, nil},
{"val", testProjectTeam, testStorageProjectTeam},
{"Nil", nil, nil},
{"Val", testProjectTeam, testStorageProjectTeam},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -139,8 +139,8 @@ func TestNewBucketPolicyOnly(t *testing.T) {
args storage.BucketPolicyOnly
want BucketPolicyOnly
}{
{name: "default", args: storage.BucketPolicyOnly{}, want: BucketPolicyOnly{}},
{name: "values", args: storage.BucketPolicyOnly{Enabled: true}, want: BucketPolicyOnly{Enabled: true}},
{name: "Default", args: storage.BucketPolicyOnly{}, want: BucketPolicyOnly{}},
{name: "Values", args: storage.BucketPolicyOnly{Enabled: true}, want: BucketPolicyOnly{Enabled: true}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -158,8 +158,8 @@ func TestCopyToBucketPolicyOnly(t *testing.T) {
args BucketPolicyOnly
want storage.BucketPolicyOnly
}{
{name: "default", args: BucketPolicyOnly{}, want: storage.BucketPolicyOnly{}},
{name: "values", args: BucketPolicyOnly{Enabled: true}, want: storage.BucketPolicyOnly{Enabled: true}},
{name: "Default", args: BucketPolicyOnly{}, want: storage.BucketPolicyOnly{}},
{name: "Values", args: BucketPolicyOnly{Enabled: true}, want: storage.BucketPolicyOnly{Enabled: true}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -177,8 +177,8 @@ func TestACLRule(t *testing.T) {
args ACLRule
want storage.ACLRule
}{
{"default value args", ACLRule{}, storage.ACLRule{}},
{"values", testACLRule, testStorageACLRule},
{"DefaultValueArgs", ACLRule{}, storage.ACLRule{}},
{"Values", testACLRule, testStorageACLRule},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -200,9 +200,9 @@ func TestNewACLRules(t *testing.T) {
args []storage.ACLRule
want []ACLRule
}{
{"nil", nil, nil},
{"empty", []storage.ACLRule{}, nil},
{"values", []storage.ACLRule{testStorageACLRule}, []ACLRule{testACLRule}},
{"Nil", nil, nil},
{"Empty", []storage.ACLRule{}, nil},
{"Values", []storage.ACLRule{testStorageACLRule}, []ACLRule{testACLRule}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -220,9 +220,9 @@ func TestCopyToACLRules(t *testing.T) {
args []ACLRule
want []storage.ACLRule
}{
{"nil", nil, nil},
{"empty", []ACLRule{}, nil},
{"values", []ACLRule{testACLRule}, []storage.ACLRule{testStorageACLRule}},
{"Nil", nil, nil},
{"Empty", []ACLRule{}, nil},
{"Values", []ACLRule{testACLRule}, []storage.ACLRule{testStorageACLRule}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -252,7 +252,7 @@ func TestNewLifecyleAction(t *testing.T) {
args storage.LifecycleAction
want LifecycleAction
}{
{"val", testStorageLifecyleAction, testLifecycleAction},
{"Val", testStorageLifecyleAction, testLifecycleAction},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -270,7 +270,7 @@ func TestCopyToLifecyleAction(t *testing.T) {
args LifecycleAction
want storage.LifecycleAction
}{
{"test", testLifecycleAction, testStorageLifecyleAction},
{"Test", testLifecycleAction, testStorageLifecyleAction},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -308,7 +308,7 @@ func TestNewLifecycleCondition(t *testing.T) {
args storage.LifecycleCondition
want LifecycleCondition
}{
{"test", testStorageLifecycleCondition, testLifecycleCondition},
{"Test", testStorageLifecycleCondition, testLifecycleCondition},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -326,7 +326,7 @@ func TestCopyToLifecycleCondition(t *testing.T) {
args LifecycleCondition
want storage.LifecycleCondition
}{
{"test", testLifecycleCondition, testStorageLifecycleCondition},
{"Test", testLifecycleCondition, testStorageLifecycleCondition},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -356,7 +356,7 @@ func TestNewLifecycleRule(t *testing.T) {
args storage.LifecycleRule
want LifecycleRule
}{
{"test", testStorageLifecycleRule, testLifecycleRule},
{"Test", testStorageLifecycleRule, testLifecycleRule},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -374,7 +374,7 @@ func TestCopyToLifecyleRule(t *testing.T) {
args LifecycleRule
want storage.LifecycleRule
}{
{"test", testLifecycleRule, testStorageLifecycleRule},
{"Test", testLifecycleRule, testStorageLifecycleRule},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -397,8 +397,8 @@ func TestNewLifecycle(t *testing.T) {
args storage.Lifecycle
want Lifecycle
}{
{"rules-nil", storage.Lifecycle{Rules: nil}, Lifecycle{Rules: nil}},
{"rules-val", testStorageLifecycle, testLifecycle},
{"RulesNil", storage.Lifecycle{Rules: nil}, Lifecycle{Rules: nil}},
{"RulesVal", testStorageLifecycle, testLifecycle},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -416,8 +416,8 @@ func TestCopyToLifecycle(t *testing.T) {
args Lifecycle
want storage.Lifecycle
}{
{"rules-nil", Lifecycle{Rules: nil}, storage.Lifecycle{Rules: nil}},
{"rules-val", Lifecycle{Rules: []LifecycleRule{testLifecycleRule}},
{"RulesNil", Lifecycle{Rules: nil}, storage.Lifecycle{Rules: nil}},
{"RulesVal", Lifecycle{Rules: []LifecycleRule{testLifecycleRule}},
storage.Lifecycle{Rules: []storage.LifecycleRule{testStorageLifecycleRule}}},
}
for _, tt := range tests {
@ -451,8 +451,8 @@ func TestNewRetentionPolicy(t *testing.T) {
args *storage.RetentionPolicy
want *RetentionPolicy
}{
{"nil", nil, nil},
{"val", testStorageRetentionPolicy, testRetentionPolicy},
{"Nil", nil, nil},
{"Val", testStorageRetentionPolicy, testRetentionPolicy},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -476,8 +476,8 @@ func TestCopyToRetentionPolicy(t *testing.T) {
args *RetentionPolicy
want *storage.RetentionPolicy
}{
{"nil", nil, &storage.RetentionPolicy{RetentionPeriod: time.Duration(0)}},
{"val", testRetentionPolicy, testStorageRetentionPolicy},
{"Nil", nil, &storage.RetentionPolicy{RetentionPeriod: time.Duration(0)}},
{"Val", testRetentionPolicy, testStorageRetentionPolicy},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -501,8 +501,8 @@ func TestNewRetentionPolicyStatus(t *testing.T) {
args *storage.RetentionPolicy
want *RetentionPolicyStatus
}{
{"nil", nil, nil},
{"val", testStorageRetentionPolicy, testRetentionPolicyStatus},
{"Nil", nil, nil},
{"Val", testStorageRetentionPolicy, testRetentionPolicyStatus},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -525,8 +525,8 @@ func TestNewBucketEncryption(t *testing.T) {
args *storage.BucketEncryption
want *BucketEncryption
}{
{"nil", nil, nil},
{"val", testStorageBucketEncryption, testBucketEncryption},
{"Nil", nil, nil},
{"Val", testStorageBucketEncryption, testBucketEncryption},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -544,8 +544,8 @@ func TestCopyToBucketEncryption(t *testing.T) {
args *BucketEncryption
want *storage.BucketEncryption
}{
{"nil", nil, nil},
{"val", testBucketEncryption, testStorageBucketEncryption},
{"Nil", nil, nil},
{"Val", testBucketEncryption, testStorageBucketEncryption},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -575,8 +575,8 @@ func TestNewBucketLogging(t *testing.T) {
args *storage.BucketLogging
want *BucketLogging
}{
{"nil", nil, nil},
{"val", testStorageBucketLogging, testBucketLogging},
{"Nil", nil, nil},
{"Val", testStorageBucketLogging, testBucketLogging},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -594,8 +594,8 @@ func TestCopyToBucketLogging(t *testing.T) {
args *BucketLogging
want *storage.BucketLogging
}{
{"nil", nil, nil},
{"val", testBucketLogging, testStorageBucketLogging},
{"Nil", nil, nil},
{"Val", testBucketLogging, testStorageBucketLogging},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -629,7 +629,7 @@ func TestNewCORS(t *testing.T) {
args storage.CORS
want CORS
}{
{"test", testStorageCORS, testCORS},
{"Test", testStorageCORS, testCORS},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -647,7 +647,7 @@ func TestCopyToCORS(t *testing.T) {
args CORS
want storage.CORS
}{
{"test", testCORS, testStorageCORS},
{"Test", testCORS, testStorageCORS},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -665,9 +665,9 @@ func TestNewCORSs(t *testing.T) {
args []storage.CORS
want []CORS
}{
{"nil", nil, nil},
{"empty", []storage.CORS{}, []CORS{}},
{"val", []storage.CORS{testStorageCORS}, []CORS{testCORS}},
{"Nil", nil, nil},
{"Empty", []storage.CORS{}, []CORS{}},
{"Val", []storage.CORS{testStorageCORS}, []CORS{testCORS}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -685,9 +685,9 @@ func TestCopyToCORSs(t *testing.T) {
args []CORS
want []storage.CORS
}{
{"nil", nil, nil},
{"empty", []CORS{}, []storage.CORS{}},
{"val", []CORS{testCORS}, []storage.CORS{testStorageCORS}},
{"Nil", nil, nil},
{"Empty", []CORS{}, []storage.CORS{}},
{"Val", []CORS{testCORS}, []storage.CORS{testStorageCORS}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -710,8 +710,8 @@ func TestNewBucketWebsite(t *testing.T) {
args *storage.BucketWebsite
want *BucketWebsite
}{
{"nil", nil, nil},
{"val", testStorageBucketWebsite, testBucketWebsite},
{"Nil", nil, nil},
{"Val", testStorageBucketWebsite, testBucketWebsite},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -729,8 +729,8 @@ func TestCopyToBucketWebsite(t *testing.T) {
args *BucketWebsite
want *storage.BucketWebsite
}{
{"nil", nil, nil},
{"val", testBucketWebsite, testStorageBucketWebsite},
{"Nil", nil, nil},
{"Val", testBucketWebsite, testStorageBucketWebsite},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -795,8 +795,8 @@ func TestNewBucketUpdateAttrs(t *testing.T) {
args *storage.BucketAttrs
want *BucketUpdatableAttrs
}{
{"nil", nil, nil},
{"val", testStorageBucketAttrs, testBucketUpdateAttrs},
{"Nil", nil, nil},
{"Val", testStorageBucketAttrs, testBucketUpdateAttrs},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -814,8 +814,8 @@ func TestCopyToBucketAttrs(t *testing.T) {
args *BucketUpdatableAttrs
want *storage.BucketAttrs
}{
{"nil", nil, nil},
{"val", testBucketUpdateAttrs, testStorageBucketAttrs},
{"Nil", nil, nil},
{"Val", testBucketUpdateAttrs, testStorageBucketAttrs},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -845,7 +845,7 @@ func TestCopyToBucketUpdateAttrs(t *testing.T) {
want storage.BucketAttrsToUpdate
}{
{
name: "test",
name: "Test",
args: args{*testBucketUpdateAttrs, map[string]string{"application": "crossplane", "foo": "bar"}},
want: testStorageBucketAttrsToUpdate,
},
@ -897,8 +897,8 @@ func TestNewBucketSpecAttrs(t *testing.T) {
args *storage.BucketAttrs
want BucketSpecAttrs
}{
{"nil", nil, BucketSpecAttrs{}},
{"val", testStorageBucketAttrs2, *testBucketSpecAttrs},
{"Nil", nil, BucketSpecAttrs{}},
{"Val", testStorageBucketAttrs2, *testBucketSpecAttrs},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -916,8 +916,8 @@ func TestCopyBucketSpecAttrs(t *testing.T) {
args *BucketSpecAttrs
want *storage.BucketAttrs
}{
{"nil", nil, nil},
{"val", testBucketSpecAttrs, testStorageBucketAttrs2},
{"Nil", nil, nil},
{"Val", testBucketSpecAttrs, testStorageBucketAttrs2},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -952,8 +952,8 @@ func TestNewBucketOutputAttrs(t *testing.T) {
args *storage.BucketAttrs
want BucketOutputAttrs
}{
{"nil", nil, BucketOutputAttrs{}},
{"val", testStorageBucketAttrs3, testBucketOutputAttrs},
{"Nil", nil, BucketOutputAttrs{}},
{"Val", testStorageBucketAttrs3, testBucketOutputAttrs},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -971,9 +971,9 @@ func TestBucket_ConnectionSecretName(t *testing.T) {
bucket Bucket
want string
}{
{"default", Bucket{}, ""},
{"named", Bucket{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, "foo"},
{"override",
{"Default", Bucket{}, ""},
{"Named", Bucket{ObjectMeta: metav1.ObjectMeta{Name: "foo"}}, "foo"},
{"Override",
Bucket{
ObjectMeta: metav1.ObjectMeta{Name: "foo"},
Spec: BucketSpec{ConnectionSecretNameOverride: "bar"}}, "bar"},
@ -1031,7 +1031,7 @@ func TestBucket_ObjectReference(t *testing.T) {
bucket Bucket
want *corev1.ObjectReference
}{
{"test", Bucket{}, &corev1.ObjectReference{APIVersion: APIVersion, Kind: BucketKind}},
{"Test", Bucket{}, &corev1.ObjectReference{APIVersion: APIVersion, Kind: BucketKind}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -1049,7 +1049,7 @@ func TestBucket_OwnerReference(t *testing.T) {
bucket Bucket
want metav1.OwnerReference
}{
{"test", Bucket{}, metav1.OwnerReference{APIVersion: APIVersion, Kind: BucketKind}},
{"Test", Bucket{}, metav1.OwnerReference{APIVersion: APIVersion, Kind: BucketKind}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -1078,10 +1078,10 @@ func TestBucket_IsAvailable(t *testing.T) {
bucket Bucket
want bool
}{
{"no conditions", b, false},
{"running active", bReady, true},
{"running and failed active", bReadyAndFailed, true},
{"not running and failed active", bNotReadyAndFailed, false},
{"NoConditions", b, false},
{"RunningActive", bReady, true},
{"RunningAndFailedActive", bReadyAndFailed, true},
{"NotRunningAndFailedActive", bNotReadyAndFailed, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -1098,8 +1098,8 @@ func TestBucket_IsBound(t *testing.T) {
phase v1alpha1.BindingState
want bool
}{
{"bound", v1alpha1.BindingStateBound, true},
{"not-bound", v1alpha1.BindingStateUnbound, false},
{"Bound", v1alpha1.BindingStateBound, true},
{"NotBound", v1alpha1.BindingStateUnbound, false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -1123,8 +1123,8 @@ func TestBucket_SetBound(t *testing.T) {
state bool
want v1alpha1.BindingState
}{
{"not-bound", false, v1alpha1.BindingStateUnbound},
{"bound", true, v1alpha1.BindingStateBound},
{"NotBound", false, v1alpha1.BindingStateUnbound},
{"Bound", true, v1alpha1.BindingStateBound},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -1143,10 +1143,10 @@ func Test_parseCORSList(t *testing.T) {
args string
want []CORS
}{
{name: "empty", args: "", want: nil},
{name: "invalid", args: "foo", want: nil},
{name: "Empty", args: "", want: nil},
{name: "Invalid", args: "foo", want: nil},
{
name: "valid",
name: "Valid",
args: `[{"maxAge":"1s","methods":["GET","POST"],"origins":["foo","bar"]}]`,
want: []CORS{
{
@ -1178,10 +1178,10 @@ func Test_parseLifecycle(t *testing.T) {
args string
want *Lifecycle
}{
{name: "empty", args: "", want: &Lifecycle{}},
{name: "invalid", args: "foo", want: &Lifecycle{}},
{name: "Empty", args: "", want: &Lifecycle{}},
{name: "Invalid", args: "foo", want: &Lifecycle{}},
{
name: "valid",
name: "Valid",
args: `{"rules":[{"action":{"storageClass":"test-storage-class","type":"test-action-type"},` +
`"condition":{"ageInDays":10,"createdBefore":"2019-03-26T21:58:58Z",` +
`"liveness":3,"matchesStorageClasses":["foo","bar"],"numNewerVersions":42}}]}`,
@ -1220,10 +1220,10 @@ func Test_parseLogging(t *testing.T) {
args string
want *BucketLogging
}{
{name: "empty", args: "", want: &BucketLogging{}},
{name: "invalid", args: "foo", want: &BucketLogging{}},
{name: "Empty", args: "", want: &BucketLogging{}},
{name: "Invalid", args: "foo", want: &BucketLogging{}},
{
name: "valid",
name: "Valid",
args: "logBucket:foo,logObjectPrefix:bar",
want: &BucketLogging{LogBucket: "foo", LogObjectPrefix: "bar"},
},
@ -1244,10 +1244,10 @@ func Test_parseWebsite(t *testing.T) {
args string
want *BucketWebsite
}{
{name: "empty", args: "", want: &BucketWebsite{}},
{name: "invalid", args: "foo", want: &BucketWebsite{}},
{name: "Empty", args: "", want: &BucketWebsite{}},
{name: "Invalid", args: "foo", want: &BucketWebsite{}},
{
name: "valid",
name: "Valid",
args: "mainPageSuffix:foo,notFoundPage:bar",
want: &BucketWebsite{MainPageSuffix: "foo", NotFoundPage: "bar"},
},
@ -1269,17 +1269,17 @@ func Test_parseACLRules(t *testing.T) {
want []ACLRule
}{
{
name: "empty",
name: "Empty",
args: "",
want: nil,
},
{
name: "invalid",
name: "Invalid",
args: "foo",
want: nil,
},
{
name: "single rule",
name: "SingleRule",
args: `[{"Entity":"test-entity","EntityID":"42","Role":"test-role","Domain":"test-domain","Email":"test-email","ProjectTeam":{"ProjectNumber":"test-project-number","Team":"test-team"}}]`,
want: []ACLRule{
{
@ -1296,7 +1296,7 @@ func Test_parseACLRules(t *testing.T) {
},
},
{
name: "single rule",
name: "SingleRule",
args: `[{"Entity":"test-entity","EntityID":"42","Role":"test-role","Domain":"test-domain","Email":"test-email","ProjectTeam":{"ProjectNumber":"test-project-number","Team":"test-team"}},` +
`{"Entity":"another-entity","EntityID":"42","Role":"test-role","Domain":"test-domain","Email":"test-email","ProjectTeam":{"ProjectNumber":"test-project-number","Team":"test-team"}}]`,
want: []ACLRule{
@ -1345,10 +1345,10 @@ func TestParseBucketSpec(t *testing.T) {
args map[string]string
want *BucketSpec
}{
{name: "empty", args: map[string]string{}, want: &BucketSpec{ReclaimPolicy: v1alpha1.ReclaimRetain}},
{name: "invalid", args: map[string]string{"foo": "bar"}, want: &BucketSpec{ReclaimPolicy: v1alpha1.ReclaimRetain}},
{name: "Empty", args: map[string]string{}, want: &BucketSpec{ReclaimPolicy: v1alpha1.ReclaimRetain}},
{name: "Invalid", args: map[string]string{"foo": "bar"}, want: &BucketSpec{ReclaimPolicy: v1alpha1.ReclaimRetain}},
{
name: "valid",
name: "Valid",
args: map[string]string{
"bucketPolicyOnly": "true",
"cors": `[{"maxAge":"1s","methods":["GET","POST"],"origins":["foo","bar"]}]`,
@ -1454,7 +1454,7 @@ func TestBucket_GetBucketName(t *testing.T) {
want string
}{
{
name: "no name format",
name: "NoNameFormat",
fields: fields{
ObjectMeta: om,
Spec: BucketSpec{},
@ -1462,7 +1462,7 @@ func TestBucket_GetBucketName(t *testing.T) {
want: "test-uid",
},
{
name: "format string",
name: "FormatString",
fields: fields{
ObjectMeta: om,
Spec: BucketSpec{
@ -1472,7 +1472,7 @@ func TestBucket_GetBucketName(t *testing.T) {
want: "foo-test-uid",
},
{
name: "constant string",
name: "ConstantString",
fields: fields{
ObjectMeta: om,
Spec: BucketSpec{
@ -1482,7 +1482,7 @@ func TestBucket_GetBucketName(t *testing.T) {
want: "foo-bar",
},
{
name: "invalid: multiple substitutions",
name: "InvalidMultipleSubstitutions",
fields: fields{
ObjectMeta: om,
Spec: BucketSpec{

View File

@ -31,8 +31,8 @@ func TestIsErrorNotFound(t *testing.T) {
args error
want bool
}{
{name: "nil", args: nil, want: false},
{name: "other", args: errors.New("foo"), want: false},
{name: "Nil", args: nil, want: false},
{name: "Other", args: errors.New("foo"), want: false},
{name: "404", args: &googleapi.Error{Code: http.StatusNotFound}, want: true},
}
for _, tt := range tests {

View File

@ -35,17 +35,17 @@ func TestAddOwnerReference(t *testing.T) {
want *metav1.ObjectMeta
}{
{
name: "meta is nil",
name: "MetaIsNil",
args: args{om: nil, or: metav1.OwnerReference{Name: "foo"}},
want: nil,
},
{
name: "meta.or is nil",
name: "MetaOrIsNil",
args: args{om: &metav1.ObjectMeta{}, or: metav1.OwnerReference{Name: "foo"}},
want: &metav1.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "foo"}}},
},
{
name: "no dupes",
name: "NoDupes",
args: args{
om: &metav1.ObjectMeta{OwnerReferences: []metav1.OwnerReference{{Name: "bar"}}},
or: metav1.OwnerReference{Name: "foo"},
@ -56,7 +56,7 @@ func TestAddOwnerReference(t *testing.T) {
}},
},
{
name: "dupes",
name: "Dupes",
args: args{
om: &metav1.ObjectMeta{OwnerReferences: []metav1.OwnerReference{
{Name: "foo"},

View File

@ -48,10 +48,10 @@ func TestParseMap(t *testing.T) {
args string
want map[string]string
}{
{name: "empty", args: "", want: map[string]string{}},
{name: "single", args: "foo:bar", want: map[string]string{"foo": "bar"}},
{name: "multi", args: "foo:bar, one:two", want: map[string]string{"foo": "bar", "one": "two"}},
{name: "dupe key", args: "foo:bar,foo:buz", want: map[string]string{"foo": "buz"}},
{name: "Empty", args: "", want: map[string]string{}},
{name: "Single", args: "foo:bar", want: map[string]string{"foo": "bar"}},
{name: "Multi", args: "foo:bar, one:two", want: map[string]string{"foo": "bar", "one": "two"}},
{name: "DupeKey", args: "foo:bar,foo:buz", want: map[string]string{"foo": "buz"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -69,11 +69,11 @@ func TestParseBool(t *testing.T) {
args string
want bool
}{
{name: "empty", args: "", want: false},
{name: "true", args: "true", want: true},
{name: "True", args: "True", want: true},
{name: "tRue", args: "tRue", want: false},
{name: "_true", args: " true", want: false},
{name: "Empty", args: "", want: false},
{name: "LowerTrue", args: "true", want: true},
{name: "UpperTrue", args: "True", want: true},
{name: "UpperRTrue", args: "tRue", want: false},
{name: "SpaceTrue", args: " true", want: false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
@ -96,7 +96,7 @@ func TestConditionalStringFormat(t *testing.T) {
want string
}{
{
name: "no name format",
name: "NoNameFormat",
args: args{
format: "",
value: "test-value",
@ -104,7 +104,7 @@ func TestConditionalStringFormat(t *testing.T) {
want: "test-value",
},
{
name: "format string only",
name: "FormatStringOnly",
args: args{
format: "%s",
value: "test-value",
@ -112,7 +112,7 @@ func TestConditionalStringFormat(t *testing.T) {
want: "test-value",
},
{
name: "format string at the beginning",
name: "FormatStringAtTheBeginning",
args: args{
format: "%s-foo",
value: "test-value",
@ -120,7 +120,7 @@ func TestConditionalStringFormat(t *testing.T) {
want: "test-value-foo",
},
{
name: "format string at the end",
name: "FormatStringAtTheEnd",
args: args{
format: "foo-%s",
value: "test-value",
@ -128,7 +128,7 @@ func TestConditionalStringFormat(t *testing.T) {
want: "foo-test-value",
},
{
name: "format string in the middle",
name: "FormatStringInTheMiddle",
args: args{
format: "foo-%s-bar",
value: "test-value",
@ -136,7 +136,7 @@ func TestConditionalStringFormat(t *testing.T) {
want: "foo-test-value-bar",
},
{
name: "constant string",
name: "ConstantString",
args: args{
format: "foo-bar",
value: "test-value",
@ -144,7 +144,7 @@ func TestConditionalStringFormat(t *testing.T) {
want: "foo-bar",
},
{
name: "invalid: multiple substitutions",
name: "InvalidMultipleSubstitutions",
args: args{
format: "foo-%s-bar-%s",
value: "test-value",
@ -172,9 +172,9 @@ func TestSplit(t *testing.T) {
args args
want []string
}{
{name: "empty", args: args{s: "", sep: ","}, want: []string{}},
{name: "comma", args: args{s: ",", sep: ","}, want: []string{}},
{name: "values", args: args{s: " a,,b ", sep: ","}, want: []string{"a", "b"}},
{name: "Empty", args: args{s: "", sep: ","}, want: []string{}},
{name: "Comma", args: args{s: ",", sep: ","}, want: []string{}},
{name: "Values", args: args{s: " a,,b ", sep: ","}, want: []string{"a", "b"}},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View File

@ -203,7 +203,7 @@ func TestApply(t *testing.T) {
want error
}{
{
name: "create failed: other",
name: "CreateFailedOther",
args: args{
kube: &test.MockClient{
MockCreate: func(ctx context.Context, obj runtime.Object) error {
@ -214,7 +214,7 @@ func TestApply(t *testing.T) {
want: testError,
},
{
name: "create failed: already exists",
name: "CreateFailedAlreadyExists",
args: args{
kube: &test.MockClient{
MockCreate: func(ctx context.Context, obj runtime.Object) error {