mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 02:41:25 +00:00
Make all error strings lower case, for readability.
This commit is contained in:
parent
505f01a7ca
commit
482a360f9e
@ -109,7 +109,7 @@ func TestSimpleList(t *testing.T) {
|
||||
func TestErrorList(t *testing.T) {
|
||||
storage := map[string]RESTStorage{}
|
||||
simpleStorage := SimpleRESTStorage{
|
||||
err: fmt.Errorf("Test Error"),
|
||||
err: fmt.Errorf("test Error"),
|
||||
}
|
||||
storage["simple"] = &simpleStorage
|
||||
handler := New(storage, "/prefix/version")
|
||||
|
@ -183,7 +183,7 @@ func (h *HumanReadablePrinter) extractObject(data, kind string) (interface{}, er
|
||||
}
|
||||
return list, nil
|
||||
default:
|
||||
return nil, fmt.Errorf("Unknown kind: %s", kind)
|
||||
return nil, fmt.Errorf("unknown 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("Unexpected object with no 'kind' field: %s", data)
|
||||
return fmt.Errorf("unexpected object with no 'kind' field: %s", data)
|
||||
}
|
||||
kind := (obj.(map[string]interface{})["kind"]).(string)
|
||||
obj, err := h.extractObject(data, kind)
|
||||
|
@ -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("No nodes field: %#v", response)
|
||||
return manifests, fmt.Errorf("no nodes field: %#v", response)
|
||||
}
|
||||
err := kl.ExtractYAMLData([]byte(response.Node.Value), &manifests)
|
||||
return manifests, err
|
||||
|
@ -302,7 +302,7 @@ func TestListContainers(t *testing.T) {
|
||||
|
||||
func TestKillContainerWithError(t *testing.T) {
|
||||
fakeDocker := FakeDockerClient{
|
||||
err: fmt.Errorf("Sample Error"),
|
||||
err: fmt.Errorf("sample error"),
|
||||
containerList: []docker.APIContainers{
|
||||
{
|
||||
Names: []string{"foo"},
|
||||
@ -585,7 +585,7 @@ func TestEventWritingError(t *testing.T) {
|
||||
kubelet := &Kubelet{
|
||||
Client: fakeEtcd,
|
||||
}
|
||||
fakeEtcd.Err = fmt.Errorf("Test error")
|
||||
fakeEtcd.Err = fmt.Errorf("test error")
|
||||
err := kubelet.LogEvent(&api.Event{
|
||||
Event: "test",
|
||||
Container: &api.Container{
|
||||
|
@ -51,7 +51,7 @@ func (registry *MockControllerRegistry) DeleteController(ID string) error {
|
||||
|
||||
func TestListControllersError(t *testing.T) {
|
||||
mockRegistry := MockControllerRegistry{
|
||||
err: fmt.Errorf("Test Error"),
|
||||
err: fmt.Errorf("test error"),
|
||||
}
|
||||
storage := ControllerRegistryStorage{
|
||||
registry: &mockRegistry,
|
||||
|
@ -33,7 +33,7 @@ func TestSyncEndpointsEmpty(t *testing.T) {
|
||||
|
||||
func TestSyncEndpointsError(t *testing.T) {
|
||||
serviceRegistry := MockServiceRegistry{
|
||||
err: fmt.Errorf("Test Error"),
|
||||
err: fmt.Errorf("test error"),
|
||||
}
|
||||
podRegistry := MockPodRegistry{}
|
||||
|
||||
|
@ -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("Unimplemented!")
|
||||
return fmt.Errorf("unimplemented!")
|
||||
}
|
||||
|
||||
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("Not found (%#v).", err)
|
||||
return api.Pod{}, fmt.Errorf("not 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("Pod not found %s", podID)
|
||||
return api.Pod{}, "", fmt.Errorf("pod 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("Controller %s not found", controllerID)
|
||||
return nil, fmt.Errorf("controller %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("Service %s was not found.", name)
|
||||
return nil, fmt.Errorf("service %s was not found.", name)
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -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("Unimplemented")
|
||||
return nil, fmt.Errorf("unimplemented")
|
||||
}
|
||||
|
||||
func MakeTestEtcdRegistry(client EtcdClient, machines []string) *EtcdRegistry {
|
||||
|
@ -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 {
|
||||
|
@ -56,7 +56,7 @@ func (registry *MockPodRegistry) DeletePod(podId string) error {
|
||||
|
||||
func TestListPodsError(t *testing.T) {
|
||||
mockRegistry := MockPodRegistry{
|
||||
err: fmt.Errorf("Test Error"),
|
||||
err: fmt.Errorf("test error"),
|
||||
}
|
||||
storage := PodRegistryStorage{
|
||||
registry: &mockRegistry,
|
||||
|
@ -112,7 +112,7 @@ func (rm *ReplicationManager) handleWatchResponse(response *etcd.Response) (*api
|
||||
}
|
||||
return &controllerSpec, nil
|
||||
} else {
|
||||
return nil, fmt.Errorf("Response node is null %#v", response)
|
||||
return nil, fmt.Errorf("response node is null %#v", response)
|
||||
}
|
||||
}
|
||||
return nil, nil
|
||||
|
@ -115,7 +115,7 @@ func (s *FirstFitScheduler) Schedule(pod api.Pod) (string, error) {
|
||||
}
|
||||
}
|
||||
if len(machineOptions) == 0 {
|
||||
return "", fmt.Errorf("Failed to find fit for %#v", pod)
|
||||
return "", fmt.Errorf("failed to find fit for %#v", pod)
|
||||
} else {
|
||||
return machineOptions[s.random.Int()%len(machineOptions)], nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user