mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-05 23:47:50 +00:00
Generate valid file Pod Names and test for them
Ensure that pods coming from the unit test configuration validate, and that proper names are generated. Lowercases source filenames, strips all but a-z0-9, and tests for consistent results.
This commit is contained in:
@@ -77,8 +77,8 @@ func TestExtractFromHttpSingle(t *testing.T) {
|
||||
|
||||
func TestExtractFromHttpMultiple(t *testing.T) {
|
||||
manifests := []api.ContainerManifest{
|
||||
{Version: "v1beta1", ID: ""},
|
||||
{Version: "v1beta1", ID: "bar"},
|
||||
{Version: "v1beta1", ID: "", Containers: []api.Container{{Name: "1", Image: "foo"}}},
|
||||
{Version: "v1beta1", ID: "bar", Containers: []api.Container{{Name: "1", Image: "foo"}}},
|
||||
}
|
||||
data, err := json.Marshal(manifests)
|
||||
if err != nil {
|
||||
@@ -103,6 +103,11 @@ func TestExtractFromHttpMultiple(t *testing.T) {
|
||||
if !reflect.DeepEqual(expected, update) {
|
||||
t.Errorf("Expected: %#v, Got: %#v", expected, update)
|
||||
}
|
||||
for i := range update.Pods {
|
||||
if errs := kubelet.ValidatePod(&update.Pods[i]); len(errs) != 0 {
|
||||
t.Errorf("Expected no validation errors on %#v, Got %#v", update.Pods[i], errs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestExtractFromHttpEmptyArray(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user