17014: making cr.container_uuid a string
authorNico Cesar <nico@nicocesar.com>
Wed, 18 Nov 2020 20:35:36 +0000 (15:35 -0500)
committerNico Cesar <nico@nicocesar.com>
Wed, 18 Nov 2020 20:35:36 +0000 (15:35 -0500)
Arvados-DCO-1.1-Signed-off-by: Nico Cesar <nico@curii.com>

lib/controller/router/response.go
sdk/go/arvados/container.go

index 8d143cf6c06109ce7d2bf71b64e7e64813528654..6c578e0a14201353b37d0ea67351722e606ebcd9 100644 (file)
@@ -164,7 +164,11 @@ func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
                                if err != nil {
                                        break
                                }
-                               tmp[k] = t.Format(rfc3339NanoFixed)
+                               if t.IsZero() {
+                                       tmp[k] = nil
+                               } else {
+                                       tmp[k] = t.Format(rfc3339NanoFixed)
+                               }
                        }
                }
                switch k {
@@ -175,17 +179,10 @@ func (rtr *router) mungeItemFields(tmp map[string]interface{}) {
                // as a first step, we'll just try to return the same that railsapi. In the future,
                // when railsapi is not used anymore, this could all be changed to return whatever we define
                // in the specification.
-               case "output_uuid", "output_name", "log_uuid", "description", "requesting_container_uuid":
+               case "output_uuid", "output_name", "log_uuid", "description", "requesting_container_uuid", "container_uuid":
                        if v == "" {
                                tmp[k] = nil
                        }
-               case "expires_at":
-                       // For some reason this case isn't covered by the "case time.Time" above.
-                       // easy to change the code and test it with:
-                       // test lib/controller -gocheck.f TestGetObjects
-                       if tmp[k] == "0001-01-01T00:00:00.000000000Z" {
-                               tmp[k] = nil
-                       }
                case "container_count_max":
                        if v == float64(0) {
                                tmp[k] = nil
index 203b426c96baa1e6751231276d8c3d06060ce8f0..d5f0b5bb183322e7040e55ef134731c503509d4d 100644 (file)
@@ -48,7 +48,7 @@ type ContainerRequest struct {
        Properties              map[string]interface{} `json:"properties"`
        State                   ContainerRequestState  `json:"state"`
        RequestingContainerUUID string                 `json:"requesting_container_uuid"`
-       ContainerUUID           *string                `json:"container_uuid"`
+       ContainerUUID           string                 `json:"container_uuid"`
        ContainerCountMax       int                    `json:"container_count_max"`
        Mounts                  map[string]Mount       `json:"mounts"`
        RuntimeConstraints      RuntimeConstraints     `json:"runtime_constraints"`