From ed757743413d2e32fd933350ef0907ff5eb78d6f Mon Sep 17 00:00:00 2001 From: Doug Davis Date: Fri, 11 Aug 2017 06:10:44 -0700 Subject: [PATCH] Minor fixes based on go report card Signed-off-by: Doug Davis --- Makefile | 2 +- .../user_provided/controller/controller.go | 4 ++++ pkg/controller/controller_test.go | 2 +- test/e2e/walkthrough.go | 24 ++++++++++--------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index 81961ead43a..ec2dd6d9994 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ $(BINDIR)/e2e.test: .init .PHONY: verify verify-client-gen verify: .init .generate_files verify-client-gen @echo Running gofmt: - @$(DOCKER_CMD) gofmt -l -s $(TOP_SRC_DIRS) > .out 2>&1 || true + @$(DOCKER_CMD) gofmt -l -s $(TOP_TEST_DIRS) $(TOP_SRC_DIRS) &> .out || true @bash -c '[ "`cat .out`" == "" ] || \ (echo -e "\n*** Please 'gofmt' the following:" ; cat .out ; echo ; false)' @rm .out diff --git a/contrib/pkg/broker/user_provided/controller/controller.go b/contrib/pkg/broker/user_provided/controller/controller.go index 766321cbde4..f230ce87b22 100644 --- a/contrib/pkg/broker/user_provided/controller/controller.go +++ b/contrib/pkg/broker/user_provided/controller/controller.go @@ -90,6 +90,10 @@ func (c *userProvidedController) CreateServiceInstance( } var cred brokerapi.Credential err = json.Unmarshal(jsonCred, &cred) + if err != nil { + glog.Errorf("Failed to unmarshal credentials: %v", err) + return nil, err + } c.instanceMap[id] = &userProvidedServiceInstance{ Name: id, diff --git a/pkg/controller/controller_test.go b/pkg/controller/controller_test.go index 7d5bab290a9..0d6152372d3 100644 --- a/pkg/controller/controller_test.go +++ b/pkg/controller/controller_test.go @@ -53,7 +53,7 @@ import ( // - tests for the methods on controller.go // - test fixtures used in other controller_*_test.go files // -// Other controller_*_test.go files contain tests related to the reconcilation +// Other controller_*_test.go files contain tests related to the reconciliation // loops for the different catalog API resources. const ( diff --git a/test/e2e/walkthrough.go b/test/e2e/walkthrough.go index edc99b36e77..42c5d23a998 100644 --- a/test/e2e/walkthrough.go +++ b/test/e2e/walkthrough.go @@ -60,11 +60,11 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { It("Run walkthrough-example ", func() { var ( - brokerName = upsbrokername + brokerName = upsbrokername serviceclassName = "user-provided-service" - testns = "test-ns" - instanceName = "ups-instance" - bindingName = "ups-binding" + testns = "test-ns" + instanceName = "ups-instance" + bindingName = "ups-binding" ) //Broker and ServiceClass should become ready @@ -79,7 +79,7 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { } By("Creating a Broker") - url := "http://" + upsbrokername + "." +f.Namespace.Name + ".svc.cluster.local" + url := "http://" + upsbrokername + "." + f.Namespace.Name + ".svc.cluster.local" broker := &v1alpha1.Broker{ ObjectMeta: metav1.ObjectMeta{ Name: brokerName, @@ -95,7 +95,7 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { err = util.WaitForBrokerCondition(f.ServiceCatalogClientSet.ServicecatalogV1alpha1(), broker.Name, v1alpha1.BrokerCondition{ - Type: v1alpha1.BrokerConditionReady, + Type: v1alpha1.BrokerConditionReady, Status: v1alpha1.ConditionTrue, }, ) @@ -113,23 +113,24 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { By("Creating a Instance") instance := &v1alpha1.Instance{ ObjectMeta: metav1.ObjectMeta{ - Name: instanceName, + Name: instanceName, Namespace: testnamespace.Name, }, Spec: v1alpha1.InstanceSpec{ ServiceClassName: serviceclassName, - PlanName: "default", + PlanName: "default", }, } instance, err = f.ServiceCatalogClientSet.ServicecatalogV1alpha1().Instances(testnamespace.Name).Create(instance) Expect(err).NotTo(HaveOccurred(), "failed to create instance") + Expect(instance).NotTo(BeNil()) By("Waiting for Instance to be ready") err = util.WaitForInstanceCondition(f.ServiceCatalogClientSet.ServicecatalogV1alpha1(), testnamespace.Name, instanceName, v1alpha1.InstanceCondition{ - Type: v1alpha1.InstanceConditionReady, + Type: v1alpha1.InstanceConditionReady, Status: v1alpha1.ConditionTrue, }, ) @@ -139,7 +140,7 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { By("Creating a Binding") binding := &v1alpha1.Binding{ ObjectMeta: metav1.ObjectMeta{ - Name: bindingName, + Name: bindingName, Namespace: testnamespace.Name, }, Spec: v1alpha1.BindingSpec{ @@ -151,13 +152,14 @@ var _ = framework.ServiceCatalogDescribe("walkthrough", func() { } binding, err = f.ServiceCatalogClientSet.ServicecatalogV1alpha1().Bindings(testnamespace.Name).Create(binding) Expect(err).NotTo(HaveOccurred(), "failed to create binding") + Expect(binding).NotTo(BeNil()) By("Waiting for Binding to be ready") err = util.WaitForBindingCondition(f.ServiceCatalogClientSet.ServicecatalogV1alpha1(), testnamespace.Name, bindingName, v1alpha1.BindingCondition{ - Type: v1alpha1.BindingConditionReady, + Type: v1alpha1.BindingConditionReady, Status: v1alpha1.ConditionTrue, }, )