-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fix timezone printing to be UTC * Revert timestamp printing to be timezone sensitive
- Loading branch information
1 parent
986381d
commit 6797ba4
Showing
1 changed file
with
20 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,11 @@ | ||
package printer | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
|
||
"github.com/gojek/feast/cli/feast/pkg/util" | ||
|
||
"github.com/golang/protobuf/ptypes/timestamp" | ||
|
||
"github.com/gojek/feast/protos/generated/go/feast/core" | ||
|
@@ -42,7 +45,7 @@ func TestPrintFeature(t *testing.T) { | |
LastUpdated: ×tamp.Timestamp{Seconds: 1}, | ||
Created: ×tamp.Timestamp{Seconds: 1}, | ||
}, | ||
expected: `Id: test.none.test_feature_two | ||
expected: fmt.Sprintf(`Id: test.none.test_feature_two | ||
Entity: test | ||
Owner: [email protected] | ||
Description: testing feature | ||
|
@@ -51,11 +54,13 @@ Uri: https://github.com/bob/example | |
DataStores: | ||
Serving: REDIS | ||
Warehouse: BIGQUERY | ||
Created: 1970-01-01T07:30:01+07:30 | ||
LastUpdated: 1970-01-01T07:30:01+07:30 | ||
Created: %s | ||
LastUpdated: %s | ||
Related Jobs: | ||
- job1 | ||
- job2`, | ||
util.ParseTimestamp(timestamp.Timestamp{Seconds: 1}), | ||
util.ParseTimestamp(timestamp.Timestamp{Seconds: 1})), | ||
}, { | ||
name: "no storage", | ||
input: &core.UIServiceTypes_FeatureDetail{ | ||
|
@@ -74,17 +79,19 @@ Related Jobs: | |
LastUpdated: ×tamp.Timestamp{Seconds: 1}, | ||
Created: ×tamp.Timestamp{Seconds: 1}, | ||
}, | ||
expected: `Id: test.none.test_feature_two | ||
expected: fmt.Sprintf(`Id: test.none.test_feature_two | ||
Entity: test | ||
Owner: [email protected] | ||
Description: testing feature | ||
ValueType: INT64 | ||
Uri: https://github.com/bob/example | ||
Created: 1970-01-01T07:30:01+07:30 | ||
LastUpdated: 1970-01-01T07:30:01+07:30 | ||
Created: %s | ||
LastUpdated: %s | ||
Related Jobs: | ||
- job1 | ||
- job2`, | ||
util.ParseTimestamp(timestamp.Timestamp{Seconds: 1}), | ||
util.ParseTimestamp(timestamp.Timestamp{Seconds: 1})), | ||
}, | ||
} | ||
|
||
|
@@ -109,13 +116,14 @@ func TestPrintEntity(t *testing.T) { | |
LastUpdated: ×tamp.Timestamp{Seconds: 1}, | ||
} | ||
out := PrintEntityDetail(entityDetail) | ||
expected := `Name: test | ||
expected := fmt.Sprintf(`Name: test | ||
Description: my test entity | ||
Tags: tag1,tag2 | ||
LastUpdated: 1970-01-01T07:30:01+07:30 | ||
LastUpdated: %s | ||
Related Jobs: | ||
- job1 | ||
- job2` | ||
- job2`, | ||
util.ParseTimestamp(timestamp.Timestamp{Seconds: 1})) | ||
if out != expected { | ||
t.Errorf("Expected output:\n%s \nActual:\n%s \n", expected, out) | ||
} | ||
|
@@ -134,12 +142,13 @@ func TestPrintStorage(t *testing.T) { | |
LastUpdated: ×tamp.Timestamp{Seconds: 1}, | ||
} | ||
out := PrintStorageDetail(storageDetail) | ||
expected := `Id: REDIS1 | ||
expected := fmt.Sprintf(`Id: REDIS1 | ||
Type: redis | ||
Options: | ||
option1: value1 | ||
option2: value2 | ||
LastUpdated: 1970-01-01T07:30:01+07:30` | ||
LastUpdated: %s`, | ||
util.ParseTimestamp(timestamp.Timestamp{Seconds: 1})) | ||
if out != expected { | ||
t.Errorf("Expected output:\n%s \nActual:\n%s \n", expected, out) | ||
} | ||
|