Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
凌波微步_大先生
dashboard
提交
459221d2
D
dashboard
项目概览
凌波微步_大先生
/
dashboard
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dashboard
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
459221d2
编写于
5月 19, 2016
作者:
L
Luiz Felipe G. Pereira
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adding events to deployment details
上级
49d8ea82
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
19 addition
and
8 deletion
+19
-8
src/app/backend/resource/deployment/deploymentdetail.go
src/app/backend/resource/deployment/deploymentdetail.go
+11
-5
src/test/backend/resource/deployment/deploymentdetail_test.go
...test/backend/resource/deployment/deploymentdetail_test.go
+8
-3
未找到文件。
src/app/backend/resource/deployment/deploymentdetail.go
浏览文件 @
459221d2
...
@@ -37,11 +37,11 @@ type DeploymentDetail struct {
...
@@ -37,11 +37,11 @@ type DeploymentDetail struct {
// OldReplicaSets
// OldReplicaSets
OldReplicaSets
[]
extensions
.
ReplicaSet
`json:"oldReplicaSets"`
OldReplicaSets
[]
extensions
.
ReplicaSet
`json:"oldReplicaSets"`
// New
ReplicaSe
t
// New
replica set used by this deploymen
t
NewReplicaSet
extensions
.
ReplicaSet
`json:"newReplicaSet"`
NewReplicaSet
extensions
.
ReplicaSet
`json:"newReplicaSet"`
//
Events
//
List of events related to this Deployment
// TODO
EventList
common
.
EventList
`json:"eventList"`
}
}
func
GetDeploymentDetail
(
client
client
.
Interface
,
namespace
string
,
name
string
)
(
*
DeploymentDetail
,
error
)
{
func
GetDeploymentDetail
(
client
client
.
Interface
,
namespace
string
,
name
string
)
(
*
DeploymentDetail
,
error
)
{
...
@@ -78,10 +78,15 @@ func GetDeploymentDetail(client client.Interface, namespace string, name string)
...
@@ -78,10 +78,15 @@ func GetDeploymentDetail(client client.Interface, namespace string, name string)
return
nil
,
err
return
nil
,
err
}
}
return
getDeploymentDetail
(
deploymentData
,
oldReplicaSets
,
newReplicaSet
),
nil
events
,
err
:=
GetDeploymentEvents
(
client
,
namespace
,
name
)
if
err
!=
nil
{
return
nil
,
err
}
return
getDeploymentDetail
(
deploymentData
,
oldReplicaSets
,
newReplicaSet
,
events
),
nil
}
}
func
getDeploymentDetail
(
deployment
*
extensions
.
Deployment
,
old
[]
*
extensions
.
ReplicaSet
,
newReplicaSet
*
extensions
.
ReplicaSet
)
*
DeploymentDetail
{
func
getDeploymentDetail
(
deployment
*
extensions
.
Deployment
,
old
[]
*
extensions
.
ReplicaSet
,
newReplicaSet
*
extensions
.
ReplicaSet
,
events
*
common
.
EventList
)
*
DeploymentDetail
{
oldReplicaSets
:=
make
([]
extensions
.
ReplicaSet
,
len
(
old
))
oldReplicaSets
:=
make
([]
extensions
.
ReplicaSet
,
len
(
old
))
for
i
,
replicaSet
:=
range
old
{
for
i
,
replicaSet
:=
range
old
{
...
@@ -101,5 +106,6 @@ func getDeploymentDetail(deployment *extensions.Deployment, old []*extensions.Re
...
@@ -101,5 +106,6 @@ func getDeploymentDetail(deployment *extensions.Deployment, old []*extensions.Re
},
},
OldReplicaSets
:
oldReplicaSets
,
OldReplicaSets
:
oldReplicaSets
,
NewReplicaSet
:
*
newReplicaSet
,
NewReplicaSet
:
*
newReplicaSet
,
EventList
:
*
events
,
}
}
}
}
src/test/backend/resource/deployment/deploymentdetail_test.go
浏览文件 @
459221d2
...
@@ -16,6 +16,7 @@ import (
...
@@ -16,6 +16,7 @@ import (
func
TestGetDeploymentDetail
(
t
*
testing
.
T
)
{
func
TestGetDeploymentDetail
(
t
*
testing
.
T
)
{
podList
:=
&
api
.
PodList
{}
podList
:=
&
api
.
PodList
{}
eventList
:=
&
api
.
EventList
{}
deployment
:=
&
extensions
.
Deployment
{
deployment
:=
&
extensions
.
Deployment
{
ObjectMeta
:
api
.
ObjectMeta
{
ObjectMeta
:
api
.
ObjectMeta
{
...
@@ -74,7 +75,7 @@ func TestGetDeploymentDetail(t *testing.T) {
...
@@ -74,7 +75,7 @@ func TestGetDeploymentDetail(t *testing.T) {
}{
}{
{
{
"test-namespace"
,
"test-name"
,
"test-namespace"
,
"test-name"
,
[]
string
{
"get"
,
"list"
,
"list"
},
[]
string
{
"get"
,
"list"
,
"list"
,
"list"
},
deployment
,
deployment
,
&
DeploymentDetail
{
&
DeploymentDetail
{
ObjectMeta
:
common
.
ObjectMeta
{
ObjectMeta
:
common
.
ObjectMeta
{
...
@@ -97,13 +98,17 @@ func TestGetDeploymentDetail(t *testing.T) {
...
@@ -97,13 +98,17 @@ func TestGetDeploymentDetail(t *testing.T) {
},
},
OldReplicaSets
:
[]
extensions
.
ReplicaSet
{},
OldReplicaSets
:
[]
extensions
.
ReplicaSet
{},
NewReplicaSet
:
newReplicaSet
,
NewReplicaSet
:
newReplicaSet
,
EventList
:
common
.
EventList
{
Namespace
:
"test-namespace"
,
Events
:
[]
common
.
Event
{},
},
},
},
},
},
}
}
for
_
,
c
:=
range
cases
{
for
_
,
c
:=
range
cases
{
fakeClient
:=
testclient
.
NewSimpleFake
(
c
.
deployment
,
replicaSetList
,
podList
)
fakeClient
:=
testclient
.
NewSimpleFake
(
c
.
deployment
,
replicaSetList
,
podList
,
eventList
)
actual
,
_
:=
GetDeploymentDetail
(
fakeClient
,
c
.
namespace
,
c
.
name
)
actual
,
_
:=
GetDeploymentDetail
(
fakeClient
,
c
.
namespace
,
c
.
name
)
...
@@ -123,7 +128,7 @@ func TestGetDeploymentDetail(t *testing.T) {
...
@@ -123,7 +128,7 @@ func TestGetDeploymentDetail(t *testing.T) {
if
!
reflect
.
DeepEqual
(
actual
,
c
.
expected
)
{
if
!
reflect
.
DeepEqual
(
actual
,
c
.
expected
)
{
t
.
Errorf
(
"GetDeploymentDetail(client, namespace, name) ==
\n
got: %#v,
\n
expected %#v"
,
t
.
Errorf
(
"GetDeploymentDetail(client, namespace, name) ==
\n
got: %#v,
\n
expected %#v"
,
c
.
namespace
,
c
.
name
,
actual
,
c
.
expected
)
actual
,
c
.
expected
)
}
}
}
}
}
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录