Add goci lint. (#243)

* Add goci lint.

Signed-off-by: xuezhaojun <zxue@redhat.com>

* handle errs and remove unused.

Signed-off-by: xuezhaojun <zxue@redhat.com>

* fix fail and remove unused code.

Signed-off-by: xuezhaojun <zxue@redhat.com>
This commit is contained in:
xuezhaojun
2022-05-10 14:50:42 +08:00
committed by GitHub
parent 25373ddab3
commit 11efeb18b5
21 changed files with 110 additions and 65 deletions

View File

@@ -38,7 +38,6 @@ const (
eventuallyTimeout = 30 // seconds
eventuallyInterval = 1 // seconds
hubNamespace = "open-cluster-management-hub"
spokeNamespace = "open-cluster-management-agent"
clusterManagerName = "hub"
hubNamespaceHosted = "hub"
)

View File

@@ -98,7 +98,7 @@ var _ = ginkgo.Describe("Klusterlet Hosted mode", func() {
})
ginkgo.AfterEach(func() {
operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})
gomega.Expect(operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})).To(gomega.BeNil())
})
ginkgo.It("should have expected resource created successfully", func() {

View File

@@ -112,7 +112,7 @@ var _ = ginkgo.Describe("Klusterlet", func() {
})
ginkgo.AfterEach(func() {
operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})
gomega.Expect(operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})).To(gomega.BeNil())
})
ginkgo.It("should have expected resource created successfully", func() {
@@ -584,7 +584,7 @@ var _ = ginkgo.Describe("Klusterlet", func() {
workDeploymentName = fmt.Sprintf("%s-work-agent", klusterlet.Name)
})
ginkgo.AfterEach(func() {
operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})
gomega.Expect(operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})).To(gomega.BeNil())
})
ginkgo.It("should have correct degraded conditions", func() {
_, err := operatorClient.OperatorV1().Klusterlets().Create(context.Background(), klusterlet, metav1.CreateOptions{})
@@ -701,7 +701,7 @@ var _ = ginkgo.Describe("Klusterlet", func() {
workDeploymentName = fmt.Sprintf("%s-work-agent", klusterlet.Name)
})
ginkgo.AfterEach(func() {
operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})
gomega.Expect(operatorClient.OperatorV1().Klusterlets().Delete(context.Background(), klusterlet.Name, metav1.DeleteOptions{})).To(gomega.BeNil())
})
ginkgo.It("should reload the klusterlet after the bootstrap secret is changed", func() {

View File

@@ -65,12 +65,10 @@ func (r *IntegrationTestEventRecorder) Warningf(reason, messageFmt string, args
func (r *IntegrationTestEventRecorder) Shutdown() {}
func HasCondition(conditions []metav1.Condition, expectedType, expectedReason string, expectedStatus metav1.ConditionStatus) bool {
found := false
for _, condition := range conditions {
if condition.Type != expectedType {
continue
}
found = true
if condition.Status != expectedStatus {
return false
@@ -83,7 +81,7 @@ func HasCondition(conditions []metav1.Condition, expectedType, expectedReason st
return true
}
return found
return false
}
func NewKubeConfig(config *rest.Config) []byte {