未验证 提交 d412fdae 编写于 作者: K KubeSphere CI Bot 提交者: GitHub

Merge pull request #3416 from zryfish/fix_fmt_issue

fix code format issues
...@@ -35,7 +35,7 @@ import ( ...@@ -35,7 +35,7 @@ import (
const ( const (
applicationName = "bookinfo" applicationName = "bookinfo"
serviceName = "productpage" serviceName = "productpage"
timeout = time.Second * 30 timeout = time.Second * 30
interval = time.Second * 2 interval = time.Second * 2
) )
...@@ -48,7 +48,7 @@ var _ = Context("Inside of a new namespace", func() { ...@@ -48,7 +48,7 @@ var _ = Context("Inside of a new namespace", func() {
Describe("Application", func() { Describe("Application", func() {
applicationLabels := map[string]string{ applicationLabels := map[string]string{
"app.kubernetes.io/name": "bookinfo", "app.kubernetes.io/name": "bookinfo",
"app.kubernetes.io/version": "1", "app.kubernetes.io/version": "1",
} }
...@@ -79,7 +79,7 @@ var _ = Context("Inside of a new namespace", func() { ...@@ -79,7 +79,7 @@ var _ = Context("Inside of a new namespace", func() {
newApp.Labels["kubesphere.io/creator"] = "" newApp.Labels["kubesphere.io/creator"] = ""
} }
updated, err := updateWithRetries(k8sClient, ctx, application.Namespace, applicationName, updateApplication, 1 * time.Second, 5 * time.Second) updated, err := updateWithRetries(k8sClient, ctx, application.Namespace, applicationName, updateApplication, 1*time.Second, 5*time.Second)
Expect(updated).Should(BeTrue()) Expect(updated).Should(BeTrue())
Eventually(func() bool { Eventually(func() bool {
...@@ -112,7 +112,7 @@ var _ = Context("Inside of a new namespace", func() { ...@@ -112,7 +112,7 @@ var _ = Context("Inside of a new namespace", func() {
type UpdateObjectFunc func(obj interface{}) type UpdateObjectFunc func(obj interface{})
func updateWithRetries(client client.Client, ctx context.Context, namespace, name string, updateFunc UpdateObjectFunc, interval, timeout time.Duration)(bool, error) { func updateWithRetries(client client.Client, ctx context.Context, namespace, name string, updateFunc UpdateObjectFunc, interval, timeout time.Duration) (bool, error) {
var updateErr error var updateErr error
pollErr := wait.PollImmediate(interval, timeout, func() (done bool, err error) { pollErr := wait.PollImmediate(interval, timeout, func() (done bool, err error) {
...@@ -143,9 +143,9 @@ func newDeployments(deploymentName, namespace string, labels map[string]string, ...@@ -143,9 +143,9 @@ func newDeployments(deploymentName, namespace string, labels map[string]string,
deployment := &v1.Deployment{ deployment := &v1.Deployment{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s", deploymentName, version), Name: fmt.Sprintf("%s-%s", deploymentName, version),
Namespace: namespace, Namespace: namespace,
Labels: labels, Labels: labels,
Annotations: map[string]string{servicemesh.ServiceMeshEnabledAnnotation: "true"}, Annotations: map[string]string{servicemesh.ServiceMeshEnabledAnnotation: "true"},
}, },
Spec: v1.DeploymentSpec{ Spec: v1.DeploymentSpec{
...@@ -155,7 +155,7 @@ func newDeployments(deploymentName, namespace string, labels map[string]string, ...@@ -155,7 +155,7 @@ func newDeployments(deploymentName, namespace string, labels map[string]string,
}, },
Template: corev1.PodTemplateSpec{ Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Labels: labels, Labels: labels,
}, },
Spec: corev1.PodSpec{ Spec: corev1.PodSpec{
Containers: []corev1.Container{ Containers: []corev1.Container{
...@@ -201,7 +201,7 @@ func newService(serviceName, namesapce string, labels map[string]string) *corev1 ...@@ -201,7 +201,7 @@ func newService(serviceName, namesapce string, labels map[string]string) *corev1
ObjectMeta: metav1.ObjectMeta{ ObjectMeta: metav1.ObjectMeta{
Name: serviceName, Name: serviceName,
Namespace: namesapce, Namespace: namesapce,
Labels: labels, Labels: labels,
Annotations: map[string]string{ Annotations: map[string]string{
"servicemesh.kubesphere.io/enabled": "true", "servicemesh.kubesphere.io/enabled": "true",
}, },
...@@ -225,7 +225,7 @@ func newService(serviceName, namesapce string, labels map[string]string) *corev1 ...@@ -225,7 +225,7 @@ func newService(serviceName, namesapce string, labels map[string]string) *corev1
}, },
}, },
Selector: labels, Selector: labels,
Type: corev1.ServiceTypeClusterIP, Type: corev1.ServiceTypeClusterIP,
}, },
Status: corev1.ServiceStatus{}, Status: corev1.ServiceStatus{},
} }
......
...@@ -111,9 +111,9 @@ func SetupTest(ctx context.Context) *corev1.Namespace { ...@@ -111,9 +111,9 @@ func SetupTest(ctx context.Context) *corev1.Namespace {
selector, _ := labels.Parse("app.kubernetes.io/name,!kubesphere.io/creator") selector, _ := labels.Parse("app.kubernetes.io/name,!kubesphere.io/creator")
reconciler := &ApplicationReconciler{ reconciler := &ApplicationReconciler{
Client: mgr.GetClient(), Client: mgr.GetClient(),
Scheme: mgr.GetScheme(), Scheme: mgr.GetScheme(),
Mapper: mgr.GetRESTMapper(), Mapper: mgr.GetRESTMapper(),
ApplicationSelector: selector, ApplicationSelector: selector,
} }
err = reconciler.SetupWithManager(mgr) err = reconciler.SetupWithManager(mgr)
...@@ -147,4 +147,4 @@ func randStringRunes(n int) string { ...@@ -147,4 +147,4 @@ func randStringRunes(n int) string {
b[i] = letterRunes[rand.Intn(len(letterRunes))] b[i] = letterRunes[rand.Intn(len(letterRunes))]
} }
return string(b) return string(b)
} }
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册