Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
水淹萌龙
kubesphere
提交
3e998c34
K
kubesphere
项目概览
水淹萌龙
/
kubesphere
与 Fork 源项目一致
Fork自
KubeSphere / kubesphere
通知
1
Star
0
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看板
未验证
提交
3e998c34
编写于
3月 19, 2020
作者:
R
runzexia
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add devops project test
Signed-off-by:
N
runzexia
<
runzexia@yunify.com
>
上级
71898e59
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
439 addition
and
86 deletion
+439
-86
pkg/apis/devops/v1alpha3/devopsproject_types.go
pkg/apis/devops/v1alpha3/devopsproject_types.go
+6
-0
pkg/controller/devopsproject/devopsproject_controller.go
pkg/controller/devopsproject/devopsproject_controller.go
+35
-29
pkg/controller/devopsproject/devopsproject_controller_test.go
...controller/devopsproject/devopsproject_controller_test.go
+257
-0
pkg/models/tenant/devops.go
pkg/models/tenant/devops.go
+1
-1
pkg/simple/client/devops/fake/fakedevops.go
pkg/simple/client/devops/fake/fakedevops.go
+140
-56
未找到文件。
pkg/apis/devops/v1alpha3/devopsproject_types.go
浏览文件 @
3e998c34
...
...
@@ -25,6 +25,12 @@ import (
const
DevOpsProjectFinalizerName
=
"devopsproject.finalizers.kubesphere.io"
const
(
ResourceKindDevOpsProject
=
"DevOpsProject"
ResourceSingularDevOpsProject
=
"devopsproject"
ResourcePluralDevOpsProject
=
"devopsprojects"
)
// DevOpsProjectSpec defines the desired state of DevOpsProject
type
DevOpsProjectSpec
struct
{
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
...
...
pkg/controller/devopsproject/devopsproject_controller.go
浏览文件 @
3e998c34
package
s2ibinary
package
devopsproject
import
(
"fmt"
...
...
@@ -24,7 +24,7 @@ import (
devopslisters
"kubesphere.io/kubesphere/pkg/client/listers/devops/v1alpha3"
)
type
DevOpsProject
Controller
struct
{
type
Controller
struct
{
client
clientset
.
Interface
kubesphereClient
kubesphereclient
.
Interface
...
...
@@ -41,10 +41,10 @@ type DevOpsProjectController struct {
devopsClient
devopsClient
.
Interface
}
func
NewController
(
kubesphereClient
kubesphereclien
t
.
Interface
,
client
clientse
t
.
Interface
,
func
NewController
(
client
clientse
t
.
Interface
,
kubesphereClient
kubesphereclien
t
.
Interface
,
devopsClinet
devopsClient
.
Interface
,
devopsInformer
devopsinformers
.
DevOpsProjectInformer
)
*
DevOpsProject
Controller
{
devopsInformer
devopsinformers
.
DevOpsProjectInformer
)
*
Controller
{
broadcaster
:=
record
.
NewBroadcaster
()
broadcaster
.
StartLogging
(
func
(
format
string
,
args
...
interface
{})
{
...
...
@@ -53,7 +53,7 @@ func NewController(kubesphereClient kubesphereclient.Interface,
broadcaster
.
StartRecordingToSink
(
&
v1core
.
EventSinkImpl
{
Interface
:
client
.
CoreV1
()
.
Events
(
""
)})
recorder
:=
broadcaster
.
NewRecorder
(
scheme
.
Scheme
,
v1
.
EventSource
{
Component
:
"devopsproject-controller"
})
v
:=
&
DevOpsProject
Controller
{
v
:=
&
Controller
{
client
:
client
,
devopsClient
:
devopsClinet
,
kubesphereClient
:
kubesphereClient
,
...
...
@@ -84,7 +84,7 @@ func NewController(kubesphereClient kubesphereclient.Interface,
// enqueueDevOpsProject takes a Foo resource and converts it into a namespace/name
// string which is then put onto the work workqueue. This method should *not* be
// passed resources of any type other than DevOpsProject.
func
(
c
*
DevOpsProject
Controller
)
enqueueDevOpsProject
(
obj
interface
{})
{
func
(
c
*
Controller
)
enqueueDevOpsProject
(
obj
interface
{})
{
var
key
string
var
err
error
if
key
,
err
=
cache
.
MetaNamespaceKeyFunc
(
obj
);
err
!=
nil
{
...
...
@@ -94,7 +94,7 @@ func (c *DevOpsProjectController) enqueueDevOpsProject(obj interface{}) {
c
.
workqueue
.
Add
(
key
)
}
func
(
c
*
DevOpsProject
Controller
)
processNextWorkItem
()
bool
{
func
(
c
*
Controller
)
processNextWorkItem
()
bool
{
obj
,
shutdown
:=
c
.
workqueue
.
Get
()
if
shutdown
{
...
...
@@ -129,17 +129,17 @@ func (c *DevOpsProjectController) processNextWorkItem() bool {
return
true
}
func
(
c
*
DevOpsProject
Controller
)
worker
()
{
func
(
c
*
Controller
)
worker
()
{
for
c
.
processNextWorkItem
()
{
}
}
func
(
c
*
DevOpsProject
Controller
)
Start
(
stopCh
<-
chan
struct
{})
error
{
func
(
c
*
Controller
)
Start
(
stopCh
<-
chan
struct
{})
error
{
return
c
.
Run
(
1
,
stopCh
)
}
func
(
c
*
DevOpsProject
Controller
)
Run
(
workers
int
,
stopCh
<-
chan
struct
{})
error
{
func
(
c
*
Controller
)
Run
(
workers
int
,
stopCh
<-
chan
struct
{})
error
{
defer
utilruntime
.
HandleCrash
()
defer
c
.
workqueue
.
ShutDown
()
...
...
@@ -161,7 +161,7 @@ func (c *DevOpsProjectController) Run(workers int, stopCh <-chan struct{}) error
// syncHandler compares the actual state with the desired, and attempts to
// converge the two. It then updates the Status block of the devopsproject resource
// with the current status of the resource.
func
(
c
*
DevOpsProject
Controller
)
syncHandler
(
key
string
)
error
{
func
(
c
*
Controller
)
syncHandler
(
key
string
)
error
{
project
,
err
:=
c
.
devOpsProjectLister
.
Get
(
key
)
if
err
!=
nil
{
if
errors
.
IsNotFound
(
err
)
{
...
...
@@ -180,31 +180,37 @@ func (c *DevOpsProjectController) syncHandler(key string) error {
return
err
}
}
_
,
err
:=
c
.
devopsClient
.
GetDevOpsProject
(
key
)
if
err
!=
nil
&&
devopsClient
.
GetDevOpsStatusCode
(
err
)
!=
http
.
StatusNotFound
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to get project %s "
,
key
))
return
err
}
else
{
_
,
err
:=
c
.
devopsClient
.
CreateDevOpsProject
(
key
)
if
err
!=
nil
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to get project %s "
,
key
))
return
err
}
}
}
else
{
if
sliceutil
.
HasString
(
project
.
ObjectMeta
.
Finalizers
,
devopsv1alpha3
.
DevOpsProjectFinalizerName
)
{
if
err
:=
c
.
deleteDevOpsProjectInDevOps
(
project
);
err
!=
nil
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to delete resource %s in devops"
,
key
))
_
,
err
:=
c
.
devopsClient
.
GetDevOpsProject
(
key
)
if
err
!=
nil
&&
devopsClient
.
GetDevOpsStatusCode
(
err
)
!=
http
.
StatusNotFound
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to get project %s "
,
key
))
return
err
}
else
if
err
!=
nil
&&
devopsClient
.
GetDevOpsStatusCode
(
err
)
==
http
.
StatusNotFound
{
}
else
{
if
err
:=
c
.
deleteDevOpsProjectInDevOps
(
project
);
err
!=
nil
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to delete resource %s in devops"
,
key
))
return
err
}
}
project
.
ObjectMeta
.
Finalizers
=
sliceutil
.
RemoveString
(
project
.
ObjectMeta
.
Finalizers
,
func
(
item
string
)
bool
{
return
item
==
devopsv1alpha3
.
DevOpsProjectFinalizerName
})
_
,
err
:=
c
.
kubesphereClient
.
DevopsV1alpha3
()
.
DevOpsProjects
()
.
Update
(
project
)
if
err
!=
nil
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to update project %s "
,
key
))
return
err
}
}
_
,
err
:=
c
.
devopsClient
.
GetDevOpsProject
(
key
)
if
err
!=
nil
&&
devopsClient
.
GetDevOpsStatusCode
(
err
)
!=
http
.
StatusNotFound
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to get project %s "
,
key
))
return
err
}
else
{
_
,
err
:=
c
.
devopsClient
.
CreateDevOpsProject
(
key
)
_
,
err
=
c
.
kubesphereClient
.
DevopsV1alpha3
()
.
DevOpsProjects
()
.
Update
(
project
)
if
err
!=
nil
{
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to
get
project %s "
,
key
))
klog
.
Error
(
err
,
fmt
.
Sprintf
(
"failed to
update
project %s "
,
key
))
return
err
}
}
...
...
@@ -213,7 +219,7 @@ func (c *DevOpsProjectController) syncHandler(key string) error {
return
nil
}
func
(
c
*
DevOpsProject
Controller
)
deleteDevOpsProjectInDevOps
(
project
*
devopsv1alpha3
.
DevOpsProject
)
error
{
func
(
c
*
Controller
)
deleteDevOpsProjectInDevOps
(
project
*
devopsv1alpha3
.
DevOpsProject
)
error
{
err
:=
c
.
devopsClient
.
DeleteDevOpsProject
(
project
.
Name
)
if
err
!=
nil
{
...
...
pkg/controller/devopsproject/devopsproject_controller_test.go
0 → 100644
浏览文件 @
3e998c34
package
devopsproject
import
(
devopsprojects
"kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
fakeDevOps
"kubesphere.io/kubesphere/pkg/simple/client/devops/fake"
"reflect"
"testing"
"time"
metav1
"k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/diff"
k8sfake
"k8s.io/client-go/kubernetes/fake"
core
"k8s.io/client-go/testing"
"k8s.io/client-go/tools/cache"
"k8s.io/client-go/tools/record"
devops
"kubesphere.io/kubesphere/pkg/apis/devops/v1alpha3"
"kubesphere.io/kubesphere/pkg/client/clientset/versioned/fake"
informers
"kubesphere.io/kubesphere/pkg/client/informers/externalversions"
)
var
(
alwaysReady
=
func
()
bool
{
return
true
}
noResyncPeriodFunc
=
func
()
time
.
Duration
{
return
0
}
)
type
fixture
struct
{
t
*
testing
.
T
client
*
fake
.
Clientset
kubeclient
*
k8sfake
.
Clientset
// Objects to put in the store.
devopsProjectLister
[]
*
devops
.
DevOpsProject
actions
[]
core
.
Action
// Objects from here preloaded into NewSimpleFake.
objects
[]
runtime
.
Object
// Objects from here preloaded into devops
initDevOpsProject
[]
string
expectDevOpsProject
[]
string
}
func
newFixture
(
t
*
testing
.
T
)
*
fixture
{
f
:=
&
fixture
{}
f
.
t
=
t
f
.
objects
=
[]
runtime
.
Object
{}
return
f
}
func
newDevOpsProject
(
name
string
)
*
devopsprojects
.
DevOpsProject
{
return
&
devopsprojects
.
DevOpsProject
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
devopsprojects
.
SchemeGroupVersion
.
String
()},
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
name
,
},
}
}
func
newDeletingDevOpsProject
(
name
string
)
*
devopsprojects
.
DevOpsProject
{
now
:=
metav1
.
Now
()
return
&
devopsprojects
.
DevOpsProject
{
TypeMeta
:
metav1
.
TypeMeta
{
APIVersion
:
devopsprojects
.
SchemeGroupVersion
.
String
()},
ObjectMeta
:
metav1
.
ObjectMeta
{
Name
:
name
,
DeletionTimestamp
:
&
now
,
Finalizers
:
[]
string
{
devopsprojects
.
DevOpsProjectFinalizerName
},
},
}
}
func
(
f
*
fixture
)
newController
()
(
*
Controller
,
informers
.
SharedInformerFactory
,
*
fakeDevOps
.
Devops
)
{
f
.
client
=
fake
.
NewSimpleClientset
(
f
.
objects
...
)
f
.
kubeclient
=
k8sfake
.
NewSimpleClientset
()
i
:=
informers
.
NewSharedInformerFactory
(
f
.
client
,
noResyncPeriodFunc
())
dI
:=
fakeDevOps
.
New
(
f
.
initDevOpsProject
...
)
c
:=
NewController
(
f
.
kubeclient
,
f
.
client
,
dI
,
i
.
Devops
()
.
V1alpha3
()
.
DevOpsProjects
())
c
.
devOpsProjectSynced
=
alwaysReady
c
.
eventRecorder
=
&
record
.
FakeRecorder
{}
for
_
,
f
:=
range
f
.
devopsProjectLister
{
i
.
Devops
()
.
V1alpha3
()
.
DevOpsProjects
()
.
Informer
()
.
GetIndexer
()
.
Add
(
f
)
}
return
c
,
i
,
dI
}
func
(
f
*
fixture
)
run
(
fooName
string
)
{
f
.
runController
(
fooName
,
true
,
false
)
}
func
(
f
*
fixture
)
runExpectError
(
fooName
string
)
{
f
.
runController
(
fooName
,
true
,
true
)
}
func
(
f
*
fixture
)
runController
(
projectName
string
,
startInformers
bool
,
expectError
bool
)
{
c
,
i
,
dI
:=
f
.
newController
()
if
startInformers
{
stopCh
:=
make
(
chan
struct
{})
defer
close
(
stopCh
)
i
.
Start
(
stopCh
)
}
err
:=
c
.
syncHandler
(
projectName
)
if
!
expectError
&&
err
!=
nil
{
f
.
t
.
Errorf
(
"error syncing foo: %v"
,
err
)
}
else
if
expectError
&&
err
==
nil
{
f
.
t
.
Error
(
"expected error syncing foo, got nil"
)
}
actions
:=
filterInformerActions
(
f
.
client
.
Actions
())
for
i
,
action
:=
range
actions
{
if
len
(
f
.
actions
)
<
i
+
1
{
f
.
t
.
Errorf
(
"%d unexpected actions: %+v"
,
len
(
actions
)
-
len
(
f
.
actions
),
actions
[
i
:
])
break
}
expectedAction
:=
f
.
actions
[
i
]
checkAction
(
expectedAction
,
action
,
f
.
t
)
}
if
len
(
f
.
actions
)
>
len
(
actions
)
{
f
.
t
.
Errorf
(
"%d additional expected actions:%+v"
,
len
(
f
.
actions
)
-
len
(
actions
),
f
.
actions
[
len
(
actions
)
:
])
}
if
len
(
dI
.
Projects
)
!=
len
(
f
.
expectDevOpsProject
)
{
f
.
t
.
Errorf
(
" unexpected objects: %v"
,
dI
.
Projects
)
}
}
// checkAction verifies that expected and actual actions are equal and both have
// same attached resources
func
checkAction
(
expected
,
actual
core
.
Action
,
t
*
testing
.
T
)
{
if
!
(
expected
.
Matches
(
actual
.
GetVerb
(),
actual
.
GetResource
()
.
Resource
)
&&
actual
.
GetSubresource
()
==
expected
.
GetSubresource
())
{
t
.
Errorf
(
"Expected
\n\t
%#v
\n
got
\n\t
%#v"
,
expected
,
actual
)
return
}
if
reflect
.
TypeOf
(
actual
)
!=
reflect
.
TypeOf
(
expected
)
{
t
.
Errorf
(
"Action has wrong type. Expected: %t. Got: %t"
,
expected
,
actual
)
return
}
switch
a
:=
actual
.
(
type
)
{
case
core
.
CreateActionImpl
:
e
,
_
:=
expected
.
(
core
.
CreateActionImpl
)
expObject
:=
e
.
GetObject
()
object
:=
a
.
GetObject
()
if
!
reflect
.
DeepEqual
(
expObject
,
object
)
{
t
.
Errorf
(
"Action %s %s has wrong object
\n
Diff:
\n
%s"
,
a
.
GetVerb
(),
a
.
GetResource
()
.
Resource
,
diff
.
ObjectGoPrintSideBySide
(
expObject
,
object
))
}
case
core
.
UpdateActionImpl
:
e
,
_
:=
expected
.
(
core
.
UpdateActionImpl
)
expObject
:=
e
.
GetObject
()
object
:=
a
.
GetObject
()
if
!
reflect
.
DeepEqual
(
expObject
,
object
)
{
t
.
Errorf
(
"Action %s %s has wrong object
\n
Diff:
\n
%s"
,
a
.
GetVerb
(),
a
.
GetResource
()
.
Resource
,
diff
.
ObjectGoPrintSideBySide
(
expObject
,
object
))
}
case
core
.
PatchActionImpl
:
e
,
_
:=
expected
.
(
core
.
PatchActionImpl
)
expPatch
:=
e
.
GetPatch
()
patch
:=
a
.
GetPatch
()
if
!
reflect
.
DeepEqual
(
expPatch
,
patch
)
{
t
.
Errorf
(
"Action %s %s has wrong patch
\n
Diff:
\n
%s"
,
a
.
GetVerb
(),
a
.
GetResource
()
.
Resource
,
diff
.
ObjectGoPrintSideBySide
(
expPatch
,
patch
))
}
default
:
t
.
Errorf
(
"Uncaptured Action %s %s, you should explicitly add a case to capture it"
,
actual
.
GetVerb
(),
actual
.
GetResource
()
.
Resource
)
}
}
// filterInformerActions filters list and watch actions for testing resources.
// Since list and watch don't change resource state we can filter it to lower
// nose level in our tests.
func
filterInformerActions
(
actions
[]
core
.
Action
)
[]
core
.
Action
{
ret
:=
[]
core
.
Action
{}
for
_
,
action
:=
range
actions
{
if
len
(
action
.
GetNamespace
())
==
0
&&
(
action
.
Matches
(
"list"
,
"foos"
)
||
action
.
Matches
(
"watch"
,
"foos"
)
||
action
.
Matches
(
"list"
,
"deployments"
)
||
action
.
Matches
(
"watch"
,
"deployments"
))
{
continue
}
ret
=
append
(
ret
,
action
)
}
return
ret
}
func
(
f
*
fixture
)
expectUpdateDevOpsProjectAction
(
p
*
devopsprojects
.
DevOpsProject
)
{
action
:=
core
.
NewUpdateAction
(
schema
.
GroupVersionResource
{
Resource
:
devopsprojects
.
ResourcePluralDevOpsProject
},
p
.
Namespace
,
p
)
f
.
actions
=
append
(
f
.
actions
,
action
)
}
func
getKey
(
p
*
devopsprojects
.
DevOpsProject
,
t
*
testing
.
T
)
string
{
key
,
err
:=
cache
.
DeletionHandlingMetaNamespaceKeyFunc
(
p
)
if
err
!=
nil
{
t
.
Errorf
(
"Unexpected error getting key for devopsprojects %v: %v"
,
p
.
Name
,
err
)
return
""
}
return
key
}
func
TestDoNothing
(
t
*
testing
.
T
)
{
f
:=
newFixture
(
t
)
project
:=
newDevOpsProject
(
"test"
)
f
.
devopsProjectLister
=
append
(
f
.
devopsProjectLister
,
project
)
f
.
objects
=
append
(
f
.
objects
,
project
)
f
.
initDevOpsProject
=
[]
string
{
project
.
Name
}
f
.
expectDevOpsProject
=
[]
string
{
project
.
Name
}
f
.
expectUpdateDevOpsProjectAction
(
project
)
f
.
run
(
getKey
(
project
,
t
))
}
func
TestCreateDevOpsProjects
(
t
*
testing
.
T
)
{
f
:=
newFixture
(
t
)
project
:=
newDevOpsProject
(
"test"
)
f
.
devopsProjectLister
=
append
(
f
.
devopsProjectLister
,
project
)
f
.
objects
=
append
(
f
.
objects
,
project
)
f
.
expectDevOpsProject
=
[]
string
{
project
.
Name
}
f
.
expectUpdateDevOpsProjectAction
(
project
)
f
.
run
(
getKey
(
project
,
t
))
}
func
TestDeleteDevOpsProjects
(
t
*
testing
.
T
)
{
f
:=
newFixture
(
t
)
project
:=
newDeletingDevOpsProject
(
"test"
)
f
.
devopsProjectLister
=
append
(
f
.
devopsProjectLister
,
project
)
f
.
objects
=
append
(
f
.
objects
,
project
)
f
.
initDevOpsProject
=
[]
string
{
project
.
Name
}
f
.
expectDevOpsProject
=
[]
string
{}
f
.
expectUpdateDevOpsProjectAction
(
project
)
f
.
run
(
getKey
(
project
,
t
))
}
func
TestDeleteDevOpsProjectsWithNull
(
t
*
testing
.
T
)
{
f
:=
newFixture
(
t
)
project
:=
newDeletingDevOpsProject
(
"test"
)
f
.
devopsProjectLister
=
append
(
f
.
devopsProjectLister
,
project
)
f
.
objects
=
append
(
f
.
objects
,
project
)
f
.
expectDevOpsProject
=
[]
string
{}
f
.
expectUpdateDevOpsProjectAction
(
project
)
f
.
run
(
getKey
(
project
,
t
))
}
pkg/models/tenant/devops.go
浏览文件 @
3e998c34
...
...
@@ -186,7 +186,7 @@ func (o *devopsProjectOperator) DeleteDevOpsProject(projectId, username string)
func
(
o
*
devopsProjectOperator
)
CreateDevOpsProject
(
username
string
,
workspace
string
,
req
*
v1alpha2
.
DevOpsProject
)
(
*
v1alpha2
.
DevOpsProject
,
error
)
{
project
:=
devops
.
NewDevOpsProject
(
req
.
Name
,
req
.
Description
,
username
,
req
.
Extra
,
workspace
)
_
,
err
:=
o
.
dsProject
.
CreateDevOpsProject
(
username
,
project
)
_
,
err
:=
o
.
dsProject
.
CreateDevOpsProject
(
project
.
ProjectId
)
if
err
!=
nil
{
klog
.
Error
(
err
)
return
nil
,
err
...
...
pkg/simple/client/devops/fake/fakedevops.go
浏览文件 @
3e998c34
package
fake
import
(
"io/ioutil"
"kubesphere.io/kubesphere/pkg/simple/client/devops"
"net/http"
"net/url"
"strings"
)
type
Fake
Devops
struct
{
type
Devops
struct
{
Data
map
[
string
]
interface
{}
Projects
map
[
string
]
interface
{}
}
func
New
(
projects
...
string
)
*
Devops
{
d
:=
&
Devops
{
Data
:
nil
,
Projects
:
map
[
string
]
interface
{}{},
}
for
_
,
p
:=
range
projects
{
d
.
Projects
[
p
]
=
true
}
return
d
}
func
(
d
*
Devops
)
CreateDevOpsProject
(
projectId
string
)
(
string
,
error
)
{
if
_
,
ok
:=
d
.
Projects
[
projectId
];
ok
{
return
projectId
,
nil
}
d
.
Projects
[
projectId
]
=
true
return
projectId
,
nil
}
func
(
d
*
Devops
)
DeleteDevOpsProject
(
projectId
string
)
error
{
if
_
,
ok
:=
d
.
Projects
[
projectId
];
ok
{
delete
(
d
.
Projects
,
projectId
)
return
nil
}
else
{
return
&
devops
.
ErrorResponse
{
Body
:
[]
byte
{},
Response
:
&
http
.
Response
{
Status
:
"404 Not Found"
,
StatusCode
:
404
,
Proto
:
"HTTP/1.1"
,
ProtoMajor
:
1
,
ProtoMinor
:
1
,
ContentLength
:
50
,
Header
:
http
.
Header
{
"Foo"
:
[]
string
{
"Bar"
},
},
Body
:
ioutil
.
NopCloser
(
strings
.
NewReader
(
"foo"
)),
// shouldn't be used
},
Message
:
""
,
}
}
}
func
(
d
*
Devops
)
GetDevOpsProject
(
projectId
string
)
(
string
,
error
)
{
if
_
,
ok
:=
d
.
Projects
[
projectId
];
ok
{
return
projectId
,
nil
}
else
{
return
""
,
&
devops
.
ErrorResponse
{
Body
:
[]
byte
{},
Response
:
&
http
.
Response
{
Status
:
"404 Not Found"
,
StatusCode
:
404
,
Proto
:
"HTTP/1.1"
,
ProtoMajor
:
1
,
ProtoMinor
:
1
,
ContentLength
:
50
,
Header
:
http
.
Header
{
"Foo"
:
[]
string
{
"Bar"
},
},
Body
:
ioutil
.
NopCloser
(
strings
.
NewReader
(
"foo"
)),
// shouldn't be used
Request
:
&
http
.
Request
{
Method
:
""
,
URL
:
&
url
.
URL
{
Scheme
:
""
,
Opaque
:
""
,
User
:
nil
,
Host
:
""
,
Path
:
""
,
RawPath
:
""
,
ForceQuery
:
false
,
RawQuery
:
""
,
Fragment
:
""
,
},
},
},
Message
:
""
,
}
}
}
func
NewFakeDevops
(
data
map
[
string
]
interface
{})
*
Fake
Devops
{
var
fakeData
Fake
Devops
func
NewFakeDevops
(
data
map
[
string
]
interface
{})
*
Devops
{
var
fakeData
Devops
fakeData
.
Data
=
data
return
&
fakeData
}
// Pipelinne operator interface
func
(
d
*
Fake
Devops
)
GetPipeline
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
Pipeline
,
error
)
{
func
(
d
*
Devops
)
GetPipeline
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
Pipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ListPipelines
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineList
,
error
)
{
func
(
d
*
Devops
)
ListPipelines
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineList
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetPipelineRun
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineRun
,
error
)
{
func
(
d
*
Devops
)
GetPipelineRun
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineRun
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ListPipelineRuns
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineRunList
,
error
)
{
func
(
d
*
Devops
)
ListPipelineRuns
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineRunList
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
StopPipeline
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
StopPipeline
,
error
)
{
func
(
d
*
Devops
)
StopPipeline
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
StopPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ReplayPipeline
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ReplayPipeline
,
error
)
{
func
(
d
*
Devops
)
ReplayPipeline
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ReplayPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
RunPipeline
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
RunPipeline
,
error
)
{
func
(
d
*
Devops
)
RunPipeline
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
RunPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetArtifacts
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
Artifacts
,
error
)
{
func
(
d
*
Devops
)
GetArtifacts
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
Artifacts
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetRunLog
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
GetRunLog
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetStepLog
(
projectName
,
pipelineName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
http
.
Header
,
error
)
{
func
(
d
*
Devops
)
GetStepLog
(
projectName
,
pipelineName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
http
.
Header
,
error
)
{
return
nil
,
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetNodeSteps
(
projectName
,
pipelineName
,
runId
,
nodeId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
NodeSteps
,
error
)
{
func
(
d
*
Devops
)
GetNodeSteps
(
projectName
,
pipelineName
,
runId
,
nodeId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
NodeSteps
,
error
)
{
s
:=
[]
string
{
projectName
,
pipelineName
,
runId
,
nodeId
}
key
:=
strings
.
Join
(
s
,
"-"
)
res
:=
d
.
Data
[
key
]
.
([]
devops
.
NodeSteps
)
return
res
,
nil
}
func
(
d
*
Fake
Devops
)
GetPipelineRunNodes
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
PipelineRunNodes
,
error
)
{
func
(
d
*
Devops
)
GetPipelineRunNodes
(
projectName
,
pipelineName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
PipelineRunNodes
,
error
)
{
s
:=
[]
string
{
projectName
,
pipelineName
,
runId
}
key
:=
strings
.
Join
(
s
,
"-"
)
res
:=
d
.
Data
[
key
]
.
([]
devops
.
PipelineRunNodes
)
return
res
,
nil
}
func
(
d
*
Fake
Devops
)
SubmitInputStep
(
projectName
,
pipelineName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
SubmitInputStep
(
projectName
,
pipelineName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
//BranchPipelinne operator interface
func
(
d
*
Fake
Devops
)
GetBranchPipeline
(
projectName
,
pipelineName
,
branchName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
BranchPipeline
,
error
)
{
func
(
d
*
Devops
)
GetBranchPipeline
(
projectName
,
pipelineName
,
branchName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
BranchPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetBranchPipelineRun
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineRun
,
error
)
{
func
(
d
*
Devops
)
GetBranchPipelineRun
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineRun
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
StopBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
StopPipeline
,
error
)
{
func
(
d
*
Devops
)
StopBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
StopPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ReplayBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ReplayPipeline
,
error
)
{
func
(
d
*
Devops
)
ReplayBranchPipeline
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ReplayPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
RunBranchPipeline
(
projectName
,
pipelineName
,
branchName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
RunPipeline
,
error
)
{
func
(
d
*
Devops
)
RunBranchPipeline
(
projectName
,
pipelineName
,
branchName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
RunPipeline
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetBranchArtifacts
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
Artifacts
,
error
)
{
func
(
d
*
Devops
)
GetBranchArtifacts
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
Artifacts
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetBranchRunLog
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
GetBranchRunLog
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetBranchStepLog
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
http
.
Header
,
error
)
{
func
(
d
*
Devops
)
GetBranchStepLog
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
http
.
Header
,
error
)
{
return
nil
,
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetBranchNodeSteps
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
NodeSteps
,
error
)
{
func
(
d
*
Devops
)
GetBranchNodeSteps
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
NodeSteps
,
error
)
{
s
:=
[]
string
{
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
}
key
:=
strings
.
Join
(
s
,
"-"
)
res
:=
d
.
Data
[
key
]
.
([]
devops
.
NodeSteps
)
return
res
,
nil
}
func
(
d
*
Fake
Devops
)
GetBranchPipelineRunNodes
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
BranchPipelineRunNodes
,
error
)
{
func
(
d
*
Devops
)
GetBranchPipelineRunNodes
(
projectName
,
pipelineName
,
branchName
,
runId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
BranchPipelineRunNodes
,
error
)
{
s
:=
[]
string
{
projectName
,
pipelineName
,
branchName
,
runId
}
key
:=
strings
.
Join
(
s
,
"-"
)
res
:=
d
.
Data
[
key
]
.
([]
devops
.
BranchPipelineRunNodes
)
return
res
,
nil
}
func
(
d
*
Fake
Devops
)
SubmitBranchInputStep
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
SubmitBranchInputStep
(
projectName
,
pipelineName
,
branchName
,
runId
,
nodeId
,
stepId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetPipelineBranch
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineBranch
,
error
)
{
func
(
d
*
Devops
)
GetPipelineBranch
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
PipelineBranch
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ScanBranch
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
ScanBranch
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
// Common pipeline operator interface
func
(
d
*
Fake
Devops
)
GetConsoleLog
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
GetConsoleLog
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetCrumb
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
Crumb
,
error
)
{
func
(
d
*
Devops
)
GetCrumb
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
Crumb
,
error
)
{
return
nil
,
nil
}
// SCM operator interface
func
(
d
*
Fake
Devops
)
GetSCMServers
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
SCMServer
,
error
)
{
func
(
d
*
Devops
)
GetSCMServers
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
SCMServer
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetSCMOrg
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
SCMOrg
,
error
)
{
func
(
d
*
Devops
)
GetSCMOrg
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
SCMOrg
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetOrgRepo
(
scmId
,
organizationId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
OrgRepo
,
error
)
{
func
(
d
*
Devops
)
GetOrgRepo
(
scmId
,
organizationId
string
,
httpParameters
*
devops
.
HttpParameters
)
([]
devops
.
OrgRepo
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
CreateSCMServers
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
SCMServer
,
error
)
{
func
(
d
*
Devops
)
CreateSCMServers
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
SCMServer
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
Validate
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
Validates
,
error
)
{
func
(
d
*
Devops
)
Validate
(
scmId
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
Validates
,
error
)
{
return
nil
,
nil
}
//Webhook operator interface
func
(
d
*
Fake
Devops
)
GetNotifyCommit
(
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
GetNotifyCommit
(
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GithubWebhook
(
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
func
(
d
*
Devops
)
GithubWebhook
(
httpParameters
*
devops
.
HttpParameters
)
([]
byte
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
CheckScriptCompile
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
CheckScript
,
error
)
{
func
(
d
*
Devops
)
CheckScriptCompile
(
projectName
,
pipelineName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
CheckScript
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
CheckCron
(
projectName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
CheckCronRes
,
error
)
{
func
(
d
*
Devops
)
CheckCron
(
projectName
string
,
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
CheckCronRes
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ToJenkinsfile
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ResJenkinsfile
,
error
)
{
func
(
d
*
Devops
)
ToJenkinsfile
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ResJenkinsfile
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
ToJson
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ResJson
,
error
)
{
func
(
d
*
Devops
)
ToJson
(
httpParameters
*
devops
.
HttpParameters
)
(
*
devops
.
ResJson
,
error
)
{
return
nil
,
nil
}
// CredentialOperator
func
(
d
*
Fake
Devops
)
CreateCredentialInProject
(
projectId
string
,
credential
*
devops
.
Credential
)
(
*
string
,
error
)
{
func
(
d
*
Devops
)
CreateCredentialInProject
(
projectId
string
,
credential
*
devops
.
Credential
)
(
*
string
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
UpdateCredentialInProject
(
projectId
string
,
credential
*
devops
.
Credential
)
(
*
string
,
error
)
{
func
(
d
*
Devops
)
UpdateCredentialInProject
(
projectId
string
,
credential
*
devops
.
Credential
)
(
*
string
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetCredentialInProject
(
projectId
,
id
string
,
content
bool
)
(
*
devops
.
Credential
,
error
)
{
func
(
d
*
Devops
)
GetCredentialInProject
(
projectId
,
id
string
,
content
bool
)
(
*
devops
.
Credential
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetCredentialsInProject
(
projectId
string
)
([]
*
devops
.
Credential
,
error
)
{
func
(
d
*
Devops
)
GetCredentialsInProject
(
projectId
string
)
([]
*
devops
.
Credential
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
DeleteCredentialInProject
(
projectId
,
id
string
)
(
*
string
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Devops
)
DeleteCredentialInProject
(
projectId
,
id
string
)
(
*
string
,
error
)
{
return
nil
,
nil
}
// BuildGetter
func
(
d
*
Fake
Devops
)
GetProjectPipelineBuildByType
(
projectId
,
pipelineId
string
,
status
string
)
(
*
devops
.
Build
,
error
)
{
func
(
d
*
Devops
)
GetProjectPipelineBuildByType
(
projectId
,
pipelineId
string
,
status
string
)
(
*
devops
.
Build
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
GetMultiBranchPipelineBuildByType
(
projectId
,
pipelineId
,
branch
string
,
status
string
)
(
*
devops
.
Build
,
error
)
{
func
(
d
*
Devops
)
GetMultiBranchPipelineBuildByType
(
projectId
,
pipelineId
,
branch
string
,
status
string
)
(
*
devops
.
Build
,
error
)
{
return
nil
,
nil
}
// ProjectMemberOperator
func
(
d
*
Fake
Devops
)
AddProjectMember
(
membership
*
devops
.
ProjectMembership
)
(
*
devops
.
ProjectMembership
,
error
)
{
func
(
d
*
Devops
)
AddProjectMember
(
membership
*
devops
.
ProjectMembership
)
(
*
devops
.
ProjectMembership
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
UpdateProjectMember
(
oldMembership
,
newMembership
*
devops
.
ProjectMembership
)
(
*
devops
.
ProjectMembership
,
error
)
{
func
(
d
*
Devops
)
UpdateProjectMember
(
oldMembership
,
newMembership
*
devops
.
ProjectMembership
)
(
*
devops
.
ProjectMembership
,
error
)
{
return
nil
,
nil
}
func
(
d
*
Fake
Devops
)
DeleteProjectMember
(
membership
*
devops
.
ProjectMembership
)
(
*
devops
.
ProjectMembership
,
error
)
{
func
(
d
*
Devops
)
DeleteProjectMember
(
membership
*
devops
.
ProjectMembership
)
(
*
devops
.
ProjectMembership
,
error
)
{
return
nil
,
nil
}
// ProjectPipelineOperator
func
(
d
*
Fake
Devops
)
CreateProjectPipeline
(
projectId
string
,
pipeline
*
devops
.
ProjectPipeline
)
(
string
,
error
)
{
func
(
d
*
Devops
)
CreateProjectPipeline
(
projectId
string
,
pipeline
*
devops
.
ProjectPipeline
)
(
string
,
error
)
{
return
""
,
nil
}
func
(
d
*
Fake
Devops
)
DeleteProjectPipeline
(
projectId
string
,
pipelineId
string
)
(
string
,
error
)
{
func
(
d
*
Devops
)
DeleteProjectPipeline
(
projectId
string
,
pipelineId
string
)
(
string
,
error
)
{
return
""
,
nil
}
func
(
d
*
Fake
Devops
)
UpdateProjectPipeline
(
projectId
string
,
pipeline
*
devops
.
ProjectPipeline
)
(
string
,
error
)
{
func
(
d
*
Devops
)
UpdateProjectPipeline
(
projectId
string
,
pipeline
*
devops
.
ProjectPipeline
)
(
string
,
error
)
{
return
""
,
nil
}
func
(
d
*
Fake
Devops
)
GetProjectPipelineConfig
(
projectId
,
pipelineId
string
)
(
*
devops
.
ProjectPipeline
,
error
)
{
func
(
d
*
Devops
)
GetProjectPipelineConfig
(
projectId
,
pipelineId
string
)
(
*
devops
.
ProjectPipeline
,
error
)
{
return
nil
,
nil
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录