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
6bb3aba2
Commit
6bb3aba2
authored
Jul 06, 2018
by
Dr. Stefan Schimanski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kube-apiserver: fix tests which don't use tls yet
parent
e15ac9eb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
0 deletions
+47
-0
master_test.go
pkg/master/master_test.go
+20
-0
config_test.go
staging/src/k8s.io/apiserver/pkg/server/config_test.go
+2
-0
genericapiserver_test.go
.../src/k8s.io/apiserver/pkg/server/genericapiserver_test.go
+1
-0
master_utils.go
test/integration/framework/master_utils.go
+24
-0
No files found.
pkg/master/master_test.go
View file @
6bb3aba2
...
...
@@ -113,6 +113,9 @@ func setUp(t *testing.T) (*etcdtesting.EtcdTestServer, Config, informers.SharedI
TLSClientConfig
:
&
tls
.
Config
{},
})
// set fake SecureServingInfo because the listener port is needed for the kubernetes service
config
.
GenericConfig
.
SecureServing
=
&
genericapiserver
.
SecureServingInfo
{
Listener
:
fakeLocalhost443Listener
{}}
clientset
,
err
:=
kubernetes
.
NewForConfig
(
config
.
GenericConfig
.
LoopbackClientConfig
)
if
err
!=
nil
{
t
.
Fatalf
(
"unable to create client set due to %v"
,
err
)
...
...
@@ -122,6 +125,23 @@ func setUp(t *testing.T) (*etcdtesting.EtcdTestServer, Config, informers.SharedI
return
server
,
*
config
,
sharedInformers
,
assert
.
New
(
t
)
}
type
fakeLocalhost443Listener
struct
{}
func
(
fakeLocalhost443Listener
)
Accept
()
(
net
.
Conn
,
error
)
{
return
nil
,
nil
}
func
(
fakeLocalhost443Listener
)
Close
()
error
{
return
nil
}
func
(
fakeLocalhost443Listener
)
Addr
()
net
.
Addr
{
return
&
net
.
TCPAddr
{
IP
:
net
.
IPv4
(
127
,
0
,
0
,
1
),
Port
:
443
,
}
}
// TestLegacyRestStorageStrategies ensures that all Storage objects which are using the generic registry Store have
// their various strategies properly wired up. This surfaced as a bug where strategies defined Export functions, but
// they were never used outside of unit tests because the export strategies were not assigned inside the Store.
...
...
staging/src/k8s.io/apiserver/pkg/server/config_test.go
View file @
6bb3aba2
...
...
@@ -34,6 +34,7 @@ import (
func
TestNewWithDelegate
(
t
*
testing
.
T
)
{
delegateConfig
:=
NewConfig
(
codecs
)
delegateConfig
.
ExternalAddress
=
"192.168.10.4:443"
delegateConfig
.
PublicAddress
=
net
.
ParseIP
(
"192.168.10.4"
)
delegateConfig
.
LegacyAPIGroupPrefixes
=
sets
.
NewString
(
"/api"
)
delegateConfig
.
LoopbackClientConfig
=
&
rest
.
Config
{}
...
...
@@ -64,6 +65,7 @@ func TestNewWithDelegate(t *testing.T) {
delegateServer
.
PrepareRun
()
wrappingConfig
:=
NewConfig
(
codecs
)
wrappingConfig
.
ExternalAddress
=
"192.168.10.4:443"
wrappingConfig
.
PublicAddress
=
net
.
ParseIP
(
"192.168.10.4"
)
wrappingConfig
.
LegacyAPIGroupPrefixes
=
sets
.
NewString
(
"/api"
)
wrappingConfig
.
LoopbackClientConfig
=
&
rest
.
Config
{}
...
...
staging/src/k8s.io/apiserver/pkg/server/genericapiserver_test.go
View file @
6bb3aba2
...
...
@@ -125,6 +125,7 @@ func testGetOpenAPIDefinitions(_ kubeopenapi.ReferenceCallback) map[string]kubeo
// setUp is a convience function for setting up for (most) tests.
func
setUp
(
t
*
testing
.
T
)
(
Config
,
*
assert
.
Assertions
)
{
config
:=
NewConfig
(
codecs
)
config
.
ExternalAddress
=
"192.168.10.4:443"
config
.
PublicAddress
=
net
.
ParseIP
(
"192.168.10.4"
)
config
.
LegacyAPIGroupPrefixes
=
sets
.
NewString
(
"/api"
)
config
.
LoopbackClientConfig
=
&
restclient
.
Config
{}
...
...
test/integration/framework/master_utils.go
View file @
6bb3aba2
...
...
@@ -225,6 +225,10 @@ func NewIntegrationTestMasterConfig() *master.Config {
masterConfig
:=
NewMasterConfig
()
masterConfig
.
GenericConfig
.
PublicAddress
=
net
.
ParseIP
(
"192.168.10.4"
)
masterConfig
.
ExtraConfig
.
APIResourceConfigSource
=
master
.
DefaultAPIResourceConfigSource
()
// TODO: get rid of these tests or port them to secure serving
masterConfig
.
GenericConfig
.
SecureServing
=
&
genericapiserver
.
SecureServingInfo
{
Listener
:
fakeLocalhost443Listener
{}}
return
masterConfig
}
...
...
@@ -291,6 +295,9 @@ func NewMasterConfig() *master.Config {
genericConfig
.
Version
=
&
kubeVersion
genericConfig
.
Authorization
.
Authorizer
=
authorizerfactory
.
NewAlwaysAllowAuthorizer
()
// TODO: get rid of these tests or port them to secure serving
genericConfig
.
SecureServing
=
&
genericapiserver
.
SecureServingInfo
{
Listener
:
fakeLocalhost443Listener
{}}
err
:=
etcdOptions
.
ApplyWithStorageFactoryTo
(
storageFactory
,
genericConfig
)
if
err
!=
nil
{
panic
(
err
)
...
...
@@ -329,3 +336,20 @@ func SharedEtcd() *storagebackend.Config {
cfg
.
ServerList
=
[]
string
{
GetEtcdURL
()}
return
cfg
}
type
fakeLocalhost443Listener
struct
{}
func
(
fakeLocalhost443Listener
)
Accept
()
(
net
.
Conn
,
error
)
{
return
nil
,
nil
}
func
(
fakeLocalhost443Listener
)
Close
()
error
{
return
nil
}
func
(
fakeLocalhost443Listener
)
Addr
()
net
.
Addr
{
return
&
net
.
TCPAddr
{
IP
:
net
.
IPv4
(
127
,
0
,
0
,
1
),
Port
:
443
,
}
}
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