Skip to content
This repository has been archived by the owner on May 6, 2022. It is now read-only.

Commit

Permalink
cleanup codebase and run gofmt (#2729)
Browse files Browse the repository at this point in the history
Signed-off-by: Guangming Wang <[email protected]>
  • Loading branch information
Guangming Wang authored and k8s-ci-robot committed Oct 17, 2019
1 parent 9ad5b40 commit 137279f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 40 deletions.
3 changes: 1 addition & 2 deletions contrib/pkg/broker/server/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,7 @@ func TestCatalogReturnsCompliantJSON(t *testing.T) {
t.Error("Expected 'services' property of the returned catalog to be not nil, got nil")
}

var service map[string]interface{}
service = services[0].(map[string]interface{})
var service = services[0].(map[string]interface{})

if name, ok := service["name"]; !ok {
t.Error("Returned service doesn't have a 'name' property.")
Expand Down
3 changes: 1 addition & 2 deletions pkg/cleaner/cleaner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ func TestCleaner_RemoveCRDs(t *testing.T) {
}

func newTestDeployment() *v1beta1.Deployment {
var rep int32
rep = 1
var rep int32 = 1
return &v1beta1.Deployment{
ObjectMeta: metav1.ObjectMeta{
Name: cmName,
Expand Down
6 changes: 1 addition & 5 deletions pkg/controller/controller_binding.go
Original file line number Diff line number Diff line change
Expand Up @@ -776,11 +776,7 @@ func (c *controller) updateServiceBindingCondition(

func (c *controller) isServiceBindingStatusInitialized(binding *v1beta1.ServiceBinding) bool {
emptyStatus := v1beta1.ServiceBindingStatus{}
if reflect.DeepEqual(binding.Status, emptyStatus) {
return false
}

return true
return !reflect.DeepEqual(binding.Status, emptyStatus)
}

// initializeServiceBindingStatus initialize the ServiceBindingStatus.
Expand Down
6 changes: 1 addition & 5 deletions pkg/controller/controller_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -1995,11 +1995,7 @@ func (c *controller) updateServiceInstanceCondition(

func (c *controller) isServiceInstanceStatusInitialized(instance *v1beta1.ServiceInstance) bool {
emptyStatus := v1beta1.ServiceInstanceStatus{}
if reflect.DeepEqual(instance.Status, emptyStatus) {
return false
}

return true
return !reflect.DeepEqual(instance.Status, emptyStatus)
}

// initializeServiceInstanceStatus initialize the ServiceInstanceStatus.
Expand Down
9 changes: 3 additions & 6 deletions pkg/controller/controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1293,8 +1293,7 @@ func getTestServiceBindingAsyncBinding(operation string) *v1beta1.ServiceBinding
// async mode whose retry duration has been exceeded
func getTestServiceBindingAsyncBindingRetryDurationExceeded(operation string) *v1beta1.ServiceBinding {
binding := getTestServiceBindingAsyncBinding(operation)
var startTime metav1.Time
startTime = metav1.NewTime(time.Now().Add(-7 * 24 * time.Hour))
var startTime = metav1.NewTime(time.Now().Add(-7 * 24 * time.Hour))
binding.Status.OperationStartTime = &startTime
return binding
}
Expand Down Expand Up @@ -1332,8 +1331,7 @@ func getTestServiceBindingAsyncUnbinding(operation string) *v1beta1.ServiceBindi
// async mode whose retry duration has been exceeded
func getTestServiceBindingAsyncUnbindingRetryDurationExceeded(operation string) *v1beta1.ServiceBinding {
binding := getTestServiceBindingAsyncUnbinding(operation)
var startTime metav1.Time
startTime = metav1.NewTime(time.Now().Add(-7 * 24 * time.Hour))
var startTime = metav1.NewTime(time.Now().Add(-7 * 24 * time.Hour))
binding.Status.OperationStartTime = &startTime
return binding
}
Expand Down Expand Up @@ -1372,8 +1370,7 @@ func getTestServiceBindingAsyncOrphanMitigation(operation string) *v1beta1.Servi
// exceeded
func getTestServiceBindingAsyncOrphanMitigationRetryDurationExceeded(operation string) *v1beta1.ServiceBinding {
binding := getTestServiceBindingAsyncOrphanMitigation(operation)
var startTime metav1.Time
startTime = metav1.NewTime(time.Now().Add(-7 * 24 * time.Hour))
var startTime = metav1.NewTime(time.Now().Add(-7 * 24 * time.Hour))
binding.Status.OperationStartTime = &startTime
return binding
}
Expand Down
8 changes: 4 additions & 4 deletions test/integration/controller_binding_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -555,10 +555,10 @@ func TestCreateServiceBindingWithSecretTransform(t *testing.T) {
},
},
expectedSecretData: map[string][]byte{
"addedStringValue": []byte("stringValue"),
"addedByteArray": []byte("byteArray"),
"valueFromJSONPath": []byte("bar"),
"bar": []byte("bar"),
"addedStringValue": []byte("stringValue"),
"addedByteArray": []byte("byteArray"),
"valueFromJSONPath": []byte("bar"),
"bar": []byte("bar"),
"key-from-other-secret": []byte("qux"),
},
},
Expand Down
22 changes: 11 additions & 11 deletions test/integration/controller_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ import (

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

scfeatures "github.com/kubernetes-sigs/service-catalog/pkg/features"
osb "github.com/kubernetes-sigs/go-open-service-broker-client/v2"
fakeosb "github.com/kubernetes-sigs/go-open-service-broker-client/v2/fake"
scfeatures "github.com/kubernetes-sigs/service-catalog/pkg/features"
utilfeature "k8s.io/apiserver/pkg/util/feature"

// avoid error `servicecatalog/v1beta1 is not enabled`
Expand Down Expand Up @@ -755,17 +755,17 @@ func TestUpdateServiceInstanceUpdateParameters(t *testing.T) {
deleteParams: true,
},
{
name: "add secret param",
name: "add secret param",
createdWithParamsFromSecret: false,
updateParamsFromSecret: true,
},
{
name: "update secret param",
name: "update secret param",
createdWithParamsFromSecret: true,
updateParamsFromSecret: true,
},
{
name: "delete secret param",
name: "delete secret param",
createdWithParamsFromSecret: true,
deleteParamsFromSecret: true,
},
Expand All @@ -788,7 +788,7 @@ func TestUpdateServiceInstanceUpdateParameters(t *testing.T) {
deleteParamsFromSecret: true,
},
{
name: "update secret",
name: "update secret",
createdWithParamsFromSecret: true,
updateSecret: true,
},
Expand Down Expand Up @@ -1502,7 +1502,7 @@ func TestDeleteServiceInstance(t *testing.T) {
},
},
{
name: "deprovision instance after in progress provision",
name: "deprovision instance after in progress provision",
skipVerifyingInstanceSuccess: true,
setup: func(ct *controllerTest) {
ct.osbClient.PollLastOperationReaction = fakeosb.DynamicPollLastOperationReaction(
Expand Down Expand Up @@ -1550,7 +1550,7 @@ func TestDeleteServiceInstance(t *testing.T) {
binding: tc.binding,
instance: getTestInstance(),
skipVerifyingInstanceSuccess: tc.skipVerifyingInstanceSuccess,
setup: tc.setup,
setup: tc.setup,
}
ct.run(tc.testFunction)
})
Expand Down Expand Up @@ -1713,10 +1713,10 @@ func TestPollServiceInstanceLastOperationSuccess(t *testing.T) {
broker: getTestBroker(),
instance: getTestInstance(),
skipVerifyingInstanceSuccess: tc.skipVerifyingInstanceSuccess,
setup: tc.setup,
preDeleteBroker: tc.preDeleteBroker,
preCreateInstance: tc.preCreateInstance,
postCreateInstance: tc.postCreateInstance,
setup: tc.setup,
preDeleteBroker: tc.preDeleteBroker,
preCreateInstance: tc.preCreateInstance,
postCreateInstance: tc.postCreateInstance,
}
ct.run(func(ct *controllerTest) {
if tc.verifyCondition != nil {
Expand Down
4 changes: 2 additions & 2 deletions test/integration/filtered_services_and_plans_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

// avoid error `servicecatalog/v1beta1 is not enabled`
_ "github.com/kubernetes-sigs/service-catalog/pkg/apis/servicecatalog/install"
fakeosb "github.com/kubernetes-sigs/go-open-service-broker-client/v2/fake"
_ "github.com/kubernetes-sigs/service-catalog/pkg/apis/servicecatalog/install"

"time"

"github.com/kubernetes-sigs/go-open-service-broker-client/v2/generator"
"github.com/kubernetes-sigs/service-catalog/pkg/apis/servicecatalog/v1beta1"
"github.com/kubernetes-sigs/service-catalog/test/util"
"github.com/kubernetes-sigs/go-open-service-broker-client/v2/generator"
)

func TestClusterServiceClassRemovedFromCatalogAfterFiltering(t *testing.T) {
Expand Down
3 changes: 1 addition & 2 deletions test/integration/framework.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ func withConfigGetFreshApiserverAndClient(
certDir, _ := ioutil.TempDir("", "service-catalog-integration")
secureServingOptions := genericserveroptions.NewSecureServingOptions()

var etcdOptions *server.EtcdOptions
etcdOptions = server.NewEtcdOptions()
var etcdOptions = server.NewEtcdOptions()
etcdOptions.StorageConfig.Transport.ServerList = serverConfig.etcdServerList
etcdOptions.EtcdOptions.StorageConfig.Prefix = fmt.Sprintf("%s-%08X", server.DefaultEtcdPathPrefix, rand.Int31())
options := &server.ServiceCatalogServerOptions{
Expand Down
2 changes: 1 addition & 1 deletion test/upgrade/examiner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func registeredTests(cs *clientutil.ClientStorage) map[string]runner.UpgradeTest

// Config collects all parameters from env variables
type Config struct {
KubeconfigPath string `envconfig:"KUBECONFIG,optional"`
KubeconfigPath string `envconfig:"KUBECONFIG,optional"`
readiness.ServiceCatalogConfig
}

Expand Down

0 comments on commit 137279f

Please sign in to comment.