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
2324dc15
Commit
2324dc15
authored
Jun 13, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #102 from brendandburns/errors
Make all error strings lower case, for readability.
parents
d62d2ffd
482a360f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
19 additions
and
19 deletions
+19
-19
api_server_test.go
pkg/apiserver/api_server_test.go
+1
-1
resource_printer.go
pkg/cloudcfg/resource_printer.go
+2
-2
kubelet.go
pkg/kubelet/kubelet.go
+1
-1
kubelet_test.go
pkg/kubelet/kubelet_test.go
+2
-2
controller_registry_test.go
pkg/registry/controller_registry_test.go
+1
-1
endpoints_test.go
pkg/registry/endpoints_test.go
+1
-1
etcd_registry.go
pkg/registry/etcd_registry.go
+6
-6
fake_etcd_client.go
pkg/registry/fake_etcd_client.go
+1
-1
pod_registry.go
pkg/registry/pod_registry.go
+1
-1
pod_registry_test.go
pkg/registry/pod_registry_test.go
+1
-1
replication_controller.go
pkg/registry/replication_controller.go
+1
-1
scheduler.go
pkg/registry/scheduler.go
+1
-1
No files found.
pkg/apiserver/api_server_test.go
View file @
2324dc15
...
...
@@ -109,7 +109,7 @@ func TestSimpleList(t *testing.T) {
func
TestErrorList
(
t
*
testing
.
T
)
{
storage
:=
map
[
string
]
RESTStorage
{}
simpleStorage
:=
SimpleRESTStorage
{
err
:
fmt
.
Errorf
(
"
T
est Error"
),
err
:
fmt
.
Errorf
(
"
t
est Error"
),
}
storage
[
"simple"
]
=
&
simpleStorage
handler
:=
New
(
storage
,
"/prefix/version"
)
...
...
pkg/cloudcfg/resource_printer.go
View file @
2324dc15
...
...
@@ -183,7 +183,7 @@ func (h *HumanReadablePrinter) extractObject(data, kind string) (interface{}, er
}
return
list
,
nil
default
:
return
nil
,
fmt
.
Errorf
(
"
U
nknown kind: %s"
,
kind
)
return
nil
,
fmt
.
Errorf
(
"
u
nknown kind: %s"
,
kind
)
}
}
...
...
@@ -196,7 +196,7 @@ func (h *HumanReadablePrinter) Print(data string, output io.Writer) error {
}
if
_
,
contains
:=
obj
.
(
map
[
string
]
interface
{})[
"kind"
];
!
contains
{
return
fmt
.
Errorf
(
"
U
nexpected object with no 'kind' field: %s"
,
data
)
return
fmt
.
Errorf
(
"
u
nexpected object with no 'kind' field: %s"
,
data
)
}
kind
:=
(
obj
.
(
map
[
string
]
interface
{})[
"kind"
])
.
(
string
)
obj
,
err
:=
h
.
extractObject
(
data
,
kind
)
...
...
pkg/kubelet/kubelet.go
View file @
2324dc15
...
...
@@ -504,7 +504,7 @@ func (kl *Kubelet) ExtractYAMLData(buf []byte, output interface{}) error {
func
(
kl
*
Kubelet
)
extractFromEtcd
(
response
*
etcd
.
Response
)
([]
api
.
ContainerManifest
,
error
)
{
var
manifests
[]
api
.
ContainerManifest
if
response
.
Node
==
nil
||
len
(
response
.
Node
.
Value
)
==
0
{
return
manifests
,
fmt
.
Errorf
(
"
N
o nodes field: %#v"
,
response
)
return
manifests
,
fmt
.
Errorf
(
"
n
o nodes field: %#v"
,
response
)
}
err
:=
kl
.
ExtractYAMLData
([]
byte
(
response
.
Node
.
Value
),
&
manifests
)
return
manifests
,
err
...
...
pkg/kubelet/kubelet_test.go
View file @
2324dc15
...
...
@@ -302,7 +302,7 @@ func TestListContainers(t *testing.T) {
func
TestKillContainerWithError
(
t
*
testing
.
T
)
{
fakeDocker
:=
FakeDockerClient
{
err
:
fmt
.
Errorf
(
"
Sample E
rror"
),
err
:
fmt
.
Errorf
(
"
sample e
rror"
),
containerList
:
[]
docker
.
APIContainers
{
{
Names
:
[]
string
{
"foo"
},
...
...
@@ -585,7 +585,7 @@ func TestEventWritingError(t *testing.T) {
kubelet
:=
&
Kubelet
{
Client
:
fakeEtcd
,
}
fakeEtcd
.
Err
=
fmt
.
Errorf
(
"
T
est error"
)
fakeEtcd
.
Err
=
fmt
.
Errorf
(
"
t
est error"
)
err
:=
kubelet
.
LogEvent
(
&
api
.
Event
{
Event
:
"test"
,
Container
:
&
api
.
Container
{
...
...
pkg/registry/controller_registry_test.go
View file @
2324dc15
...
...
@@ -51,7 +51,7 @@ func (registry *MockControllerRegistry) DeleteController(ID string) error {
func
TestListControllersError
(
t
*
testing
.
T
)
{
mockRegistry
:=
MockControllerRegistry
{
err
:
fmt
.
Errorf
(
"
Test E
rror"
),
err
:
fmt
.
Errorf
(
"
test e
rror"
),
}
storage
:=
ControllerRegistryStorage
{
registry
:
&
mockRegistry
,
...
...
pkg/registry/endpoints_test.go
View file @
2324dc15
...
...
@@ -33,7 +33,7 @@ func TestSyncEndpointsEmpty(t *testing.T) {
func
TestSyncEndpointsError
(
t
*
testing
.
T
)
{
serviceRegistry
:=
MockServiceRegistry
{
err
:
fmt
.
Errorf
(
"
Test E
rror"
),
err
:
fmt
.
Errorf
(
"
test e
rror"
),
}
podRegistry
:=
MockPodRegistry
{}
...
...
pkg/registry/etcd_registry.go
View file @
2324dc15
...
...
@@ -147,7 +147,7 @@ func (registry *EtcdRegistry) updateManifests(machine string, manifests []api.Co
func
(
registry
*
EtcdRegistry
)
CreatePod
(
machineIn
string
,
pod
api
.
Pod
)
error
{
podOut
,
machine
,
err
:=
registry
.
findPod
(
pod
.
ID
)
if
err
==
nil
{
return
fmt
.
Errorf
(
"
A
pod named %s already exists on %s (%#v)"
,
pod
.
ID
,
machine
,
podOut
)
return
fmt
.
Errorf
(
"
a
pod named %s already exists on %s (%#v)"
,
pod
.
ID
,
machine
,
podOut
)
}
return
registry
.
runPod
(
pod
,
machineIn
)
}
...
...
@@ -174,7 +174,7 @@ func (registry *EtcdRegistry) runPod(pod api.Pod, machine string) error {
}
func
(
registry
*
EtcdRegistry
)
UpdatePod
(
pod
api
.
Pod
)
error
{
return
fmt
.
Errorf
(
"
U
nimplemented!"
)
return
fmt
.
Errorf
(
"
u
nimplemented!"
)
}
func
(
registry
*
EtcdRegistry
)
DeletePod
(
podID
string
)
error
{
...
...
@@ -218,7 +218,7 @@ func (registry *EtcdRegistry) getPodForMachine(machine, podID string) (api.Pod,
result
,
err
:=
registry
.
etcdClient
.
Get
(
key
,
false
,
false
)
if
err
!=
nil
{
if
isEtcdNotFound
(
err
)
{
return
api
.
Pod
{},
fmt
.
Errorf
(
"
N
ot found (%#v)."
,
err
)
return
api
.
Pod
{},
fmt
.
Errorf
(
"
n
ot found (%#v)."
,
err
)
}
else
{
return
api
.
Pod
{},
err
}
...
...
@@ -239,7 +239,7 @@ func (registry *EtcdRegistry) findPod(podID string) (api.Pod, string, error) {
return
pod
,
machine
,
nil
}
}
return
api
.
Pod
{},
""
,
fmt
.
Errorf
(
"
P
od not found %s"
,
podID
)
return
api
.
Pod
{},
""
,
fmt
.
Errorf
(
"
p
od not found %s"
,
podID
)
}
func
isEtcdNotFound
(
err
error
)
bool
{
...
...
@@ -284,7 +284,7 @@ func (registry *EtcdRegistry) GetController(controllerID string) (*api.Replicati
result
,
err
:=
registry
.
etcdClient
.
Get
(
key
,
false
,
false
)
if
err
!=
nil
{
if
isEtcdNotFound
(
err
)
{
return
nil
,
fmt
.
Errorf
(
"
C
ontroller %s not found"
,
controllerID
)
return
nil
,
fmt
.
Errorf
(
"
c
ontroller %s not found"
,
controllerID
)
}
else
{
return
nil
,
err
}
...
...
@@ -354,7 +354,7 @@ func (registry *EtcdRegistry) GetService(name string) (*api.Service, error) {
response
,
err
:=
registry
.
etcdClient
.
Get
(
key
,
false
,
false
)
if
err
!=
nil
{
if
isEtcdNotFound
(
err
)
{
return
nil
,
fmt
.
Errorf
(
"
S
ervice %s was not found."
,
name
)
return
nil
,
fmt
.
Errorf
(
"
s
ervice %s was not found."
,
name
)
}
else
{
return
nil
,
err
}
...
...
pkg/registry/fake_etcd_client.go
View file @
2324dc15
...
...
@@ -76,7 +76,7 @@ func (f *FakeEtcdClient) Delete(key string, recursive bool) (*etcd.Response, err
}
func
(
f
*
FakeEtcdClient
)
Watch
(
prefix
string
,
waitIndex
uint64
,
recursive
bool
,
receiver
chan
*
etcd
.
Response
,
stop
chan
bool
)
(
*
etcd
.
Response
,
error
)
{
return
nil
,
fmt
.
Errorf
(
"
U
nimplemented"
)
return
nil
,
fmt
.
Errorf
(
"
u
nimplemented"
)
}
func
MakeTestEtcdRegistry
(
client
EtcdClient
,
machines
[]
string
)
*
EtcdRegistry
{
...
...
pkg/registry/pod_registry.go
View file @
2324dc15
...
...
@@ -122,7 +122,7 @@ func (storage *PodRegistryStorage) Extract(body string) (interface{}, error) {
func
(
storage
*
PodRegistryStorage
)
Create
(
pod
interface
{})
error
{
podObj
:=
pod
.
(
api
.
Pod
)
if
len
(
podObj
.
ID
)
==
0
{
return
fmt
.
Errorf
(
"
ID
is unspecified: %#v"
,
pod
)
return
fmt
.
Errorf
(
"
id
is unspecified: %#v"
,
pod
)
}
machine
,
err
:=
storage
.
scheduler
.
Schedule
(
podObj
)
if
err
!=
nil
{
...
...
pkg/registry/pod_registry_test.go
View file @
2324dc15
...
...
@@ -56,7 +56,7 @@ func (registry *MockPodRegistry) DeletePod(podId string) error {
func
TestListPodsError
(
t
*
testing
.
T
)
{
mockRegistry
:=
MockPodRegistry
{
err
:
fmt
.
Errorf
(
"
Test E
rror"
),
err
:
fmt
.
Errorf
(
"
test e
rror"
),
}
storage
:=
PodRegistryStorage
{
registry
:
&
mockRegistry
,
...
...
pkg/registry/replication_controller.go
View file @
2324dc15
...
...
@@ -112,7 +112,7 @@ func (rm *ReplicationManager) handleWatchResponse(response *etcd.Response) (*api
}
return
&
controllerSpec
,
nil
}
else
{
return
nil
,
fmt
.
Errorf
(
"
R
esponse node is null %#v"
,
response
)
return
nil
,
fmt
.
Errorf
(
"
r
esponse node is null %#v"
,
response
)
}
}
return
nil
,
nil
...
...
pkg/registry/scheduler.go
View file @
2324dc15
...
...
@@ -115,7 +115,7 @@ func (s *FirstFitScheduler) Schedule(pod api.Pod) (string, error) {
}
}
if
len
(
machineOptions
)
==
0
{
return
""
,
fmt
.
Errorf
(
"
F
ailed to find fit for %#v"
,
pod
)
return
""
,
fmt
.
Errorf
(
"
f
ailed to find fit for %#v"
,
pod
)
}
else
{
return
machineOptions
[
s
.
random
.
Int
()
%
len
(
machineOptions
)],
nil
}
...
...
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