Commit 02590e9a authored by Victor Marmol's avatar Victor Marmol

Merge pull request #5174 from smarterclayton/lowercase_hostname

Kubelet tests broken on Macs with uppercase names
parents ee1e40d4 0f873376
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
"fmt" "fmt"
"os" "os"
"reflect" "reflect"
"strings"
"sync" "sync"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
...@@ -367,5 +368,6 @@ func GeneratePodName(name string) (string, error) { ...@@ -367,5 +368,6 @@ func GeneratePodName(name string) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
hostname = strings.ToLower(hostname)
return fmt.Sprintf("%s-%s", name, hostname), nil return fmt.Sprintf("%s-%s", name, hostname), nil
} }
...@@ -25,6 +25,7 @@ import ( ...@@ -25,6 +25,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"sort" "sort"
"strings"
"time" "time"
"github.com/GoogleCloudPlatform/kubernetes/pkg/api" "github.com/GoogleCloudPlatform/kubernetes/pkg/api"
...@@ -172,6 +173,7 @@ func extractFromFile(filename string) (api.BoundPod, error) { ...@@ -172,6 +173,7 @@ func extractFromFile(filename string) (api.BoundPod, error) {
if err != nil { if err != nil {
return pod, err return pod, err
} }
hostname = strings.ToLower(hostname)
if len(pod.UID) == 0 { if len(pod.UID) == 0 {
hasher := md5.New() hasher := md5.New()
......
...@@ -20,6 +20,7 @@ import ( ...@@ -20,6 +20,7 @@ import (
"encoding/json" "encoding/json"
"net/http/httptest" "net/http/httptest"
"os" "os"
"strings"
"testing" "testing"
"time" "time"
...@@ -118,6 +119,7 @@ func TestExtractInvalidManifest(t *testing.T) { ...@@ -118,6 +119,7 @@ func TestExtractInvalidManifest(t *testing.T) {
func TestExtractFromHTTP(t *testing.T) { func TestExtractFromHTTP(t *testing.T) {
hostname, _ := os.Hostname() hostname, _ := os.Hostname()
hostname = strings.ToLower(hostname)
var testCases = []struct { var testCases = []struct {
desc string desc string
......
...@@ -34,5 +34,5 @@ func GetHostname(hostnameOverride string) string { ...@@ -34,5 +34,5 @@ func GetHostname(hostnameOverride string) string {
} }
hostname = fqdn hostname = fqdn
} }
return strings.TrimSpace(string(hostname)) return strings.ToLower(strings.TrimSpace(string(hostname)))
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment