Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2020fengziyang
kubesphere
提交
d412fdae
K
kubesphere
项目概览
2020fengziyang
/
kubesphere
与 Fork 源项目一致
Fork自
KubeSphere / kubesphere
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kubesphere
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
d412fdae
编写于
3月 01, 2021
作者:
K
KubeSphere CI Bot
提交者:
GitHub
3月 01, 2021
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #3416 from zryfish/fix_fmt_issue
fix code format issues
上级
12f84072
a2ede11e
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
14 deletion
+14
-14
pkg/controller/application/application_controller_test.go
pkg/controller/application/application_controller_test.go
+10
-10
pkg/controller/application/application_suit_test.go
pkg/controller/application/application_suit_test.go
+4
-4
未找到文件。
pkg/controller/application/application_controller_test.go
浏览文件 @
d412fdae
...
...
@@ -35,7 +35,7 @@ import (
const
(
applicationName
=
"bookinfo"
serviceName
=
"productpage"
serviceName
=
"productpage"
timeout
=
time
.
Second
*
30
interval
=
time
.
Second
*
2
)
...
...
@@ -48,7 +48,7 @@ var _ = Context("Inside of a new namespace", func() {
Describe
(
"Application"
,
func
()
{
applicationLabels
:=
map
[
string
]
string
{
"app.kubernetes.io/name"
:
"bookinfo"
,
"app.kubernetes.io/name"
:
"bookinfo"
,
"app.kubernetes.io/version"
:
"1"
,
}
...
...
@@ -79,7 +79,7 @@ var _ = Context("Inside of a new namespace", func() {
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
())
Eventually
(
func
()
bool
{
...
...
@@ -112,7 +112,7 @@ var _ = Context("Inside of a new namespace", func() {
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
pollErr
:=
wait
.
PollImmediate
(
interval
,
timeout
,
func
()
(
done
bool
,
err
error
)
{
...
...
@@ -143,9 +143,9 @@ func newDeployments(deploymentName, namespace string, labels map[string]string,
deployment
:=
&
v1
.
Deployment
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
fmt
.
Sprintf
(
"%s-%s"
,
deploymentName
,
version
),
Namespace
:
namespace
,
Labels
:
labels
,
Name
:
fmt
.
Sprintf
(
"%s-%s"
,
deploymentName
,
version
),
Namespace
:
namespace
,
Labels
:
labels
,
Annotations
:
map
[
string
]
string
{
servicemesh
.
ServiceMeshEnabledAnnotation
:
"true"
},
},
Spec
:
v1
.
DeploymentSpec
{
...
...
@@ -155,7 +155,7 @@ func newDeployments(deploymentName, namespace string, labels map[string]string,
},
Template
:
corev1
.
PodTemplateSpec
{
ObjectMeta
:
metav1
.
ObjectMeta
{
Labels
:
labels
,
Labels
:
labels
,
},
Spec
:
corev1
.
PodSpec
{
Containers
:
[]
corev1
.
Container
{
...
...
@@ -201,7 +201,7 @@ func newService(serviceName, namesapce string, labels map[string]string) *corev1
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
serviceName
,
Namespace
:
namesapce
,
Labels
:
labels
,
Labels
:
labels
,
Annotations
:
map
[
string
]
string
{
"servicemesh.kubesphere.io/enabled"
:
"true"
,
},
...
...
@@ -225,7 +225,7 @@ func newService(serviceName, namesapce string, labels map[string]string) *corev1
},
},
Selector
:
labels
,
Type
:
corev1
.
ServiceTypeClusterIP
,
Type
:
corev1
.
ServiceTypeClusterIP
,
},
Status
:
corev1
.
ServiceStatus
{},
}
...
...
pkg/controller/application/application_suit_test.go
浏览文件 @
d412fdae
...
...
@@ -111,9 +111,9 @@ func SetupTest(ctx context.Context) *corev1.Namespace {
selector
,
_
:=
labels
.
Parse
(
"app.kubernetes.io/name,!kubesphere.io/creator"
)
reconciler
:=
&
ApplicationReconciler
{
Client
:
mgr
.
GetClient
(),
Scheme
:
mgr
.
GetScheme
(),
Mapper
:
mgr
.
GetRESTMapper
(),
Client
:
mgr
.
GetClient
(),
Scheme
:
mgr
.
GetScheme
(),
Mapper
:
mgr
.
GetRESTMapper
(),
ApplicationSelector
:
selector
,
}
err
=
reconciler
.
SetupWithManager
(
mgr
)
...
...
@@ -147,4 +147,4 @@ func randStringRunes(n int) string {
b
[
i
]
=
letterRunes
[
rand
.
Intn
(
len
(
letterRunes
))]
}
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.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录