mitchell852 closed pull request #2139: fix TO go unit tests
URL: https://github.com/apache/incubator-trafficcontrol/pull/2139
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/lib/go-tc/time_test.go b/lib/go-tc/time_test.go
index 433999408..223d55845 100644
--- a/lib/go-tc/time_test.go
+++ b/lib/go-tc/time_test.go
@@ -25,16 +25,21 @@ import (
        "time"
 )
 
-var jsonTests = []struct {
-       time Time
-       json string
-}{
-       {Time{Time: time.Date(9999, 4, 12, 23, 20, 50, 520*1e6, time.Local)}, 
`"9999-04-12 23:20:50-07"`},
-       {Time{Time: time.Date(1996, 12, 19, 16, 39, 57, 0, time.UTC)}, 
`"1996-12-19 16:39:57+00"`},
-}
-
 // TestJSON tests that we get format tc uses for lastUpdated fields
-func TestJSON(t *testing.T) {
+func TestTimeJSON(t *testing.T) {
+       mst, err := time.LoadLocation("MST")
+       if err != nil {
+               t.Fatalf("unable to get MST location: %v", err)
+       }
+
+       var jsonTests = []struct {
+               time Time
+               json string
+       }{
+               {Time{Time: time.Date(9999, 4, 12, 23, 20, 50, 520*1e6, mst)}, 
`"9999-04-12 23:20:50-07"`},
+               {Time{Time: time.Date(1996, 12, 19, 16, 39, 57, 0, time.UTC)}, 
`"1996-12-19 16:39:57+00"`},
+       }
+
        for _, tm := range jsonTests {
                got, err := json.Marshal(tm.time)
 
diff --git a/traffic_ops/app/bin/tests/Dockerfile-golangtest 
b/traffic_ops/app/bin/tests/Dockerfile-golangtest
index 74f164d4d..c24531423 100644
--- a/traffic_ops/app/bin/tests/Dockerfile-golangtest
+++ b/traffic_ops/app/bin/tests/Dockerfile-golangtest
@@ -20,6 +20,6 @@ ADD lib /go/src/$DIR/lib
 
 WORKDIR /go/src/$DIR/traffic_ops/traffic_ops_golang
 
-CMD bash -c 'go get -v && go test -cover -v $(go list ./...) ../../lib/go-*'
+CMD bash -c 'go get -v && go test -cover -v $(go list ./... | grep -v vendor/) 
../../lib/go-*'
 #
 # vi:syntax=Dockerfile


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to