From 658a8dd20e56026eb871ed6a42bcc5b8fede578f Mon Sep 17 00:00:00 2001 From: Gianluca Arbezzano Date: Thu, 25 Feb 2021 17:37:33 +0100 Subject: [PATCH] Fix CreatedAt, UpdatedAt for get workflow and template CreatedAt and UpdatedAt was wrong, this commit changed it to RFC.RFC3339 +--------------------------------------+--------------------------------------+---------------+------------+------------+ | ID | TEMPLATE ID | STATE | CREATED AT | UPDATED AT | +--------------------------------------+--------------------------------------+---------------+------------+------------+ | 17ff6da3-7780-11eb-a192-ba5d1f2c0c0b | 63b550da-76e7-11eb-a192-ba5d1f2c0c0b | STATE_PENDING | 0xa71f90 | 0xa71f90 | +--------------------------------------+--------------------------------------+---------------+------------+------------+ Signed-off-by: Gianluca Arbezzano --- cmd/tink-cli/cmd/template/get.go | 5 ++++- cmd/tink-cli/cmd/template/get_test.go | 10 +++++----- cmd/tink-cli/cmd/workflow/get.go | 5 +++-- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/cmd/tink-cli/cmd/template/get.go b/cmd/tink-cli/cmd/template/get.go index 1d438eb32..3b7f5bec7 100644 --- a/cmd/tink-cli/cmd/template/get.go +++ b/cmd/tink-cli/cmd/template/get.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "log" + "time" "github.com/google/uuid" "github.com/jedib0t/go-pretty/table" @@ -83,7 +84,9 @@ func (h *getTemplate) RetrieveData(ctx context.Context, cl *client.FullClient) ( func (h *getTemplate) PopulateTable(data []interface{}, t table.Writer) error { for _, v := range data { if tmp, ok := v.(*template.WorkflowTemplate); ok { - t.AppendRow(table.Row{tmp.Id, tmp.Name, tmp.CreatedAt.AsTime().Unix(), tmp.UpdatedAt.AsTime().Unix()}) + t.AppendRow(table.Row{tmp.Id, tmp.Name, + tmp.CreatedAt.AsTime().Format(time.RFC3339), + tmp.UpdatedAt.AsTime().Format(time.RFC3339)}) } } return nil diff --git a/cmd/tink-cli/cmd/template/get_test.go b/cmd/tink-cli/cmd/template/get_test.go index a99289087..e6e225f1d 100644 --- a/cmd/tink-cli/cmd/template/get_test.go +++ b/cmd/tink-cli/cmd/template/get_test.go @@ -40,11 +40,11 @@ func TestGetTemplate(t *testing.T) { }(), }, }, - ExpectedStdout: `+--------------+------------+------------+------------+ -| ID | NAME | CREATED AT | UPDATED AT | -+--------------+------------+------------+------------+ -| template-123 | hello-test | 1451606400 | 1451606400 | -+--------------+------------+------------+------------+ + ExpectedStdout: `+--------------+------------+----------------------+----------------------+ +| ID | NAME | CREATED AT | UPDATED AT | ++--------------+------------+----------------------+----------------------+ +| template-123 | hello-test | 2016-01-01T00:00:00Z | 2016-01-01T00:00:00Z | ++--------------+------------+----------------------+----------------------+ `, }, } diff --git a/cmd/tink-cli/cmd/workflow/get.go b/cmd/tink-cli/cmd/workflow/get.go index bf23ed9d0..96727e3f6 100644 --- a/cmd/tink-cli/cmd/workflow/get.go +++ b/cmd/tink-cli/cmd/workflow/get.go @@ -5,6 +5,7 @@ import ( "fmt" "io" "log" + "time" "github.com/jedib0t/go-pretty/table" "github.com/spf13/cobra" @@ -86,8 +87,8 @@ func (h *getWorkflow) PopulateTable(data []interface{}, t table.Writer) error { if w, ok := v.(*workflow.Workflow); ok { t.AppendRow(table.Row{w.Id, w.Template, w.State.String(), - w.CreatedAt.AsTime().Unix, - w.UpdatedAt.AsTime().Unix}) + w.CreatedAt.AsTime().UTC().Format(time.RFC3339), + w.UpdatedAt.AsTime().UTC().Format(time.RFC3339)}) } } return nil