11package printer
22
33import (
4+ "fmt"
45 "testing"
56
7+ "github.com/gojek/feast/cli/feast/pkg/util"
8+
69 "github.com/golang/protobuf/ptypes/timestamp"
710
811 "github.com/gojek/feast/protos/generated/go/feast/core"
@@ -42,7 +45,7 @@ func TestPrintFeature(t *testing.T) {
4245 LastUpdated : & timestamp.Timestamp {Seconds : 1 },
4346 Created : & timestamp.Timestamp {Seconds : 1 },
4447 },
45- expected : `Id: test.none.test_feature_two
48+ expected : fmt . Sprintf ( `Id: test.none.test_feature_two
4649Entity: test
4750Owner: bob@example.com
4851Description: testing feature
@@ -51,11 +54,13 @@ Uri: https://github.com/bob/example
5154DataStores:
5255 Serving: REDIS
5356 Warehouse: BIGQUERY
54- Created: 1970-01-01T07:30:01+07:30
55- LastUpdated: 1970-01-01T07:30:01+07:30
57+ Created: %s
58+ LastUpdated: %s
5659Related Jobs:
5760- job1
5861- job2` ,
62+ util .ParseTimestamp (timestamp.Timestamp {Seconds : 1 }),
63+ util .ParseTimestamp (timestamp.Timestamp {Seconds : 1 })),
5964 }, {
6065 name : "no storage" ,
6166 input : & core.UIServiceTypes_FeatureDetail {
@@ -74,17 +79,19 @@ Related Jobs:
7479 LastUpdated : & timestamp.Timestamp {Seconds : 1 },
7580 Created : & timestamp.Timestamp {Seconds : 1 },
7681 },
77- expected : `Id: test.none.test_feature_two
82+ expected : fmt . Sprintf ( `Id: test.none.test_feature_two
7883Entity: test
7984Owner: bob@example.com
8085Description: testing feature
8186ValueType: INT64
8287Uri: https://github.com/bob/example
83- Created: 1970-01-01T07:30:01+07:30
84- LastUpdated: 1970-01-01T07:30:01+07:30
88+ Created: %s
89+ LastUpdated: %s
8590Related Jobs:
8691- job1
8792- job2` ,
93+ util .ParseTimestamp (timestamp.Timestamp {Seconds : 1 }),
94+ util .ParseTimestamp (timestamp.Timestamp {Seconds : 1 })),
8895 },
8996 }
9097
@@ -109,13 +116,14 @@ func TestPrintEntity(t *testing.T) {
109116 LastUpdated : & timestamp.Timestamp {Seconds : 1 },
110117 }
111118 out := PrintEntityDetail (entityDetail )
112- expected := `Name: test
119+ expected := fmt . Sprintf ( `Name: test
113120Description: my test entity
114121Tags: tag1,tag2
115- LastUpdated: 1970-01-01T07:30:01+07:30
122+ LastUpdated: %s
116123Related Jobs:
117124- job1
118- - job2`
125+ - job2` ,
126+ util .ParseTimestamp (timestamp.Timestamp {Seconds : 1 }))
119127 if out != expected {
120128 t .Errorf ("Expected output:\n %s \n Actual:\n %s \n " , expected , out )
121129 }
@@ -134,12 +142,13 @@ func TestPrintStorage(t *testing.T) {
134142 LastUpdated : & timestamp.Timestamp {Seconds : 1 },
135143 }
136144 out := PrintStorageDetail (storageDetail )
137- expected := `Id: REDIS1
145+ expected := fmt . Sprintf ( `Id: REDIS1
138146Type: redis
139147Options:
140148 option1: value1
141149 option2: value2
142- LastUpdated: 1970-01-01T07:30:01+07:30`
150+ LastUpdated: %s` ,
151+ util .ParseTimestamp (timestamp.Timestamp {Seconds : 1 }))
143152 if out != expected {
144153 t .Errorf ("Expected output:\n %s \n Actual:\n %s \n " , expected , out )
145154 }
0 commit comments