Merge pull request #1010 from smarterclayton/set_creation_time_on_services

Set creation timestamp on services
This commit is contained in:
Tim Hockin 2014-08-23 14:35:44 -05:00
commit 8c77124a4a
2 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,9 @@ func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
if errs := api.ValidateService(srv); len(errs) > 0 {
return nil, fmt.Errorf("Validation errors: %v", errs)
}
srv.CreationTimestamp = util.Now()
return apiserver.MakeAsync(func() (interface{}, error) {
// TODO: Consider moving this to a rectification loop, so that we make/remove external load balancers
// correctly no matter what http operations happen.
@ -78,7 +81,6 @@ func (rs *RegistryStorage) Create(obj interface{}) (<-chan interface{}, error) {
return nil, err
}
}
// TODO actually wait for the object to be fully created here.
err := rs.registry.CreateService(*srv)
if err != nil {
return nil, err

View File

@ -43,6 +43,9 @@ func TestServiceRegistryCreate(t *testing.T) {
if created_service.ID != "foo" {
t.Errorf("Expected foo, but got %v", created_service.ID)
}
if created_service.CreationTimestamp.IsZero() {
t.Errorf("Expected timestamp to be set, got %:v", created_service.CreationTimestamp)
}
if len(fakeCloud.Calls) != 0 {
t.Errorf("Unexpected call(s): %#v", fakeCloud.Calls)
}