Set uid during object create

This commit is contained in:
derekwaynecarr
2014-11-12 16:27:10 -05:00
parent d4108ec47e
commit 15701ff403
13 changed files with 106 additions and 11 deletions

View File

@@ -100,7 +100,8 @@ func (rs *REST) Create(ctx api.Context, obj runtime.Object) (<-chan apiserver.RE
if errs := validation.ValidatePod(pod); len(errs) > 0 {
return nil, errors.NewInvalid("pod", pod.Name, errs)
}
pod.CreationTimestamp = util.Now()
api.FillObjectMetaSystemFields(ctx, &pod.ObjectMeta)
return apiserver.MakeAsync(func() (runtime.Object, error) {
if err := rs.registry.CreatePod(ctx, pod); err != nil {

View File

@@ -586,13 +586,15 @@ func TestCreatePod(t *testing.T) {
if err != nil {
t.Errorf("unexpected error: %v", err)
}
select {
case <-channel:
// Do nothing, this is expected.
case <-time.After(time.Millisecond * 100):
t.Error("Unexpected timeout on async channel")
}
if !api.HasObjectMetaSystemFieldValues(&podRegistry.Pod.ObjectMeta) {
t.Errorf("Expected ObjectMeta field values were populated")
}
}
type FakePodInfoGetter struct {