Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
442c079e
Commit
442c079e
authored
Apr 18, 2016
by
Chao Xu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
generate the fake clients in testoutput
parent
79c3d668
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
269 additions
and
0 deletions
+269
-0
clientset_generated.go
...erated/test_internalclientset/fake/clientset_generated.go
+65
-0
doc.go
...ut/clientset_generated/test_internalclientset/fake/doc.go
+20
-0
doc.go
...lclientset/typed/testgroup.k8s.io/unversioned/fake/doc.go
+20
-0
fake_testgroup_client.go
...estgroup.k8s.io/unversioned/fake/fake_testgroup_client.go
+30
-0
fake_testtype.go
.../typed/testgroup.k8s.io/unversioned/fake/fake_testtype.go
+113
-0
fake_testtype_expansion.go
...tgroup.k8s.io/unversioned/fake/fake_testtype_expansion.go
+21
-0
No files found.
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/fake/clientset_generated.go
0 → 100644
View file @
442c079e
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
fake
import
(
clientset
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset"
unversionedtestgroup
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned"
fakeunversionedtestgroup
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned/fake"
"k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/apimachinery/registered"
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/client/typed/discovery"
fakediscovery
"k8s.io/kubernetes/pkg/client/typed/discovery/fake"
"k8s.io/kubernetes/pkg/runtime"
"k8s.io/kubernetes/pkg/watch"
)
// Clientset returns a clientset that will respond with the provided objects
func
NewSimpleClientset
(
objects
...
runtime
.
Object
)
*
Clientset
{
o
:=
core
.
NewObjects
(
api
.
Scheme
,
api
.
Codecs
.
UniversalDecoder
())
for
_
,
obj
:=
range
objects
{
if
err
:=
o
.
Add
(
obj
);
err
!=
nil
{
panic
(
err
)
}
}
fakePtr
:=
core
.
Fake
{}
fakePtr
.
AddReactor
(
"*"
,
"*"
,
core
.
ObjectReaction
(
o
,
registered
.
RESTMapper
()))
fakePtr
.
AddWatchReactor
(
"*"
,
core
.
DefaultWatchReactor
(
watch
.
NewFake
(),
nil
))
return
&
Clientset
{
fakePtr
}
}
// Clientset implements clientset.Interface. Meant to be embedded into a
// struct to get a default implementation. This makes faking out just the method
// you want to test easier.
type
Clientset
struct
{
core
.
Fake
}
func
(
c
*
Clientset
)
Discovery
()
discovery
.
DiscoveryInterface
{
return
&
fakediscovery
.
FakeDiscovery
{
&
c
.
Fake
}
}
var
_
clientset
.
Interface
=
&
Clientset
{}
// Testgroup retrieves the TestgroupClient
func
(
c
*
Clientset
)
Testgroup
()
unversionedtestgroup
.
TestgroupInterface
{
return
&
fakeunversionedtestgroup
.
FakeTestgroup
{
&
c
.
Fake
}
}
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/fake/doc.go
0 → 100644
View file @
442c079e
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --test=true
// This package has the automatically generated fake clientset.
package
fake
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned/fake/doc.go
0 → 100644
View file @
442c079e
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
// This package is generated by client-gen with arguments: --test=true
// Package fake has the automatically generated clients.
package
fake
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned/fake/fake_testgroup_client.go
0 → 100644
View file @
442c079e
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
fake
import
(
unversioned
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned"
core
"k8s.io/kubernetes/pkg/client/testing/core"
)
type
FakeTestgroup
struct
{
*
core
.
Fake
}
func
(
c
*
FakeTestgroup
)
TestTypes
(
namespace
string
)
unversioned
.
TestTypeInterface
{
return
&
FakeTestTypes
{
c
,
namespace
}
}
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned/fake/fake_testtype.go
0 → 100644
View file @
442c079e
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
fake
import
(
testgroup_k8s_io
"k8s.io/kubernetes/cmd/libs/go2idl/client-gen/testdata/apis/testgroup.k8s.io"
api
"k8s.io/kubernetes/pkg/api"
core
"k8s.io/kubernetes/pkg/client/testing/core"
labels
"k8s.io/kubernetes/pkg/labels"
watch
"k8s.io/kubernetes/pkg/watch"
)
// FakeTestTypes implements TestTypeInterface
type
FakeTestTypes
struct
{
Fake
*
FakeTestgroup
ns
string
}
func
(
c
*
FakeTestTypes
)
Create
(
testType
*
testgroup_k8s_io
.
TestType
)
(
result
*
testgroup_k8s_io
.
TestType
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewCreateAction
(
"testtypes"
,
c
.
ns
,
testType
),
&
testgroup_k8s_io
.
TestType
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
testgroup_k8s_io
.
TestType
),
err
}
func
(
c
*
FakeTestTypes
)
Update
(
testType
*
testgroup_k8s_io
.
TestType
)
(
result
*
testgroup_k8s_io
.
TestType
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewUpdateAction
(
"testtypes"
,
c
.
ns
,
testType
),
&
testgroup_k8s_io
.
TestType
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
testgroup_k8s_io
.
TestType
),
err
}
func
(
c
*
FakeTestTypes
)
UpdateStatus
(
testType
*
testgroup_k8s_io
.
TestType
)
(
*
testgroup_k8s_io
.
TestType
,
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewUpdateSubresourceAction
(
"testtypes"
,
"status"
,
c
.
ns
,
testType
),
&
testgroup_k8s_io
.
TestType
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
testgroup_k8s_io
.
TestType
),
err
}
func
(
c
*
FakeTestTypes
)
Delete
(
name
string
,
options
*
api
.
DeleteOptions
)
error
{
_
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewDeleteAction
(
"testtypes"
,
c
.
ns
,
name
),
&
testgroup_k8s_io
.
TestType
{})
return
err
}
func
(
c
*
FakeTestTypes
)
DeleteCollection
(
options
*
api
.
DeleteOptions
,
listOptions
api
.
ListOptions
)
error
{
action
:=
core
.
NewDeleteCollectionAction
(
"testtypes"
,
c
.
ns
,
listOptions
)
_
,
err
:=
c
.
Fake
.
Invokes
(
action
,
&
testgroup_k8s_io
.
TestTypeList
{})
return
err
}
func
(
c
*
FakeTestTypes
)
Get
(
name
string
)
(
result
*
testgroup_k8s_io
.
TestType
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewGetAction
(
"testtypes"
,
c
.
ns
,
name
),
&
testgroup_k8s_io
.
TestType
{})
if
obj
==
nil
{
return
nil
,
err
}
return
obj
.
(
*
testgroup_k8s_io
.
TestType
),
err
}
func
(
c
*
FakeTestTypes
)
List
(
opts
api
.
ListOptions
)
(
result
*
testgroup_k8s_io
.
TestTypeList
,
err
error
)
{
obj
,
err
:=
c
.
Fake
.
Invokes
(
core
.
NewListAction
(
"testtypes"
,
c
.
ns
,
opts
),
&
testgroup_k8s_io
.
TestTypeList
{})
if
obj
==
nil
{
return
nil
,
err
}
label
:=
opts
.
LabelSelector
if
label
==
nil
{
label
=
labels
.
Everything
()
}
list
:=
&
testgroup_k8s_io
.
TestTypeList
{}
for
_
,
item
:=
range
obj
.
(
*
testgroup_k8s_io
.
TestTypeList
)
.
Items
{
if
label
.
Matches
(
labels
.
Set
(
item
.
Labels
))
{
list
.
Items
=
append
(
list
.
Items
,
item
)
}
}
return
list
,
err
}
// Watch returns a watch.Interface that watches the requested testTypes.
func
(
c
*
FakeTestTypes
)
Watch
(
opts
api
.
ListOptions
)
(
watch
.
Interface
,
error
)
{
return
c
.
Fake
.
InvokesWatch
(
core
.
NewWatchAction
(
"testtypes"
,
c
.
ns
,
opts
))
}
cmd/libs/go2idl/client-gen/testoutput/clientset_generated/test_internalclientset/typed/testgroup.k8s.io/unversioned/fake/fake_testtype_expansion.go
0 → 100644
View file @
442c079e
/*
Copyright 2016 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package
fake
func
(
c
*
FakeTestTypes
)
Hello
()
string
{
return
"hello!"
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment