OLD | NEW |
1 package goldingester | 1 package goldingester |
2 | 2 |
3 import ( | 3 import ( |
4 "encoding/json" | 4 "encoding/json" |
5 "io/ioutil" | 5 "io/ioutil" |
6 "testing" | 6 "testing" |
7 | 7 |
8 metrics "github.com/rcrowley/go-metrics" | 8 metrics "github.com/rcrowley/go-metrics" |
9 assert "github.com/stretchr/testify/require" | 9 assert "github.com/stretchr/testify/require" |
10 "go.skia.org/infra/go/tiling" | 10 "go.skia.org/infra/go/tiling" |
(...skipping 22 matching lines...) Expand all Loading... |
33 if got, want := dm.Results[0].Digest, "445aa63b2200baaba9b37fd5f80c0447"
; got != want { | 33 if got, want := dm.Results[0].Digest, "445aa63b2200baaba9b37fd5f80c0447"
; got != want { |
34 t.Errorf("Digest wrong: Got %v Want %v", got, want) | 34 t.Errorf("Digest wrong: Got %v Want %v", got, want) |
35 } | 35 } |
36 id, params := dm.idAndParams(dm.Results[0]) | 36 id, params := dm.idAndParams(dm.Results[0]) |
37 if got, want := id, "x86_64:565:Debug:HD7770:ShuttleA:varied_text_clippe
d_no_lcd:Win8"; got != want { | 37 if got, want := id, "x86_64:565:Debug:HD7770:ShuttleA:varied_text_clippe
d_no_lcd:Win8"; got != want { |
38 t.Errorf("Key generation wrong: Got %v Want %v", got, want) | 38 t.Errorf("Key generation wrong: Got %v Want %v", got, want) |
39 } | 39 } |
40 if got, want := len(params), 9; got != want { | 40 if got, want := len(params), 9; got != want { |
41 t.Errorf("Params wrong size: Got %v Want %v", got, want) | 41 t.Errorf("Params wrong size: Got %v Want %v", got, want) |
42 } | 42 } |
| 43 |
| 44 assert.Equal(t, int64(12345), dm.Patchset) |
43 } | 45 } |
44 | 46 |
45 func TestParsing(t *testing.T) { | 47 func TestParsing(t *testing.T) { |
46 tile := tiling.NewTile() | 48 tile := tiling.NewTile() |
47 offset := 1 | 49 offset := 1 |
48 dm := loadDMResults(t) | 50 dm := loadDMResults(t) |
49 | 51 |
50 metricsProcessed := metrics.NewRegisteredCounter("testing.ingestion.proc
essed", metrics.DefaultRegistry) | 52 metricsProcessed := metrics.NewRegisteredCounter("testing.ingestion.proc
essed", metrics.DefaultRegistry) |
51 addResultToTile(dm, tile, offset, metricsProcessed) | 53 addResultToTile(dm, tile, offset, metricsProcessed) |
52 if got, want := len(tile.Traces), 2; got != want { | 54 if got, want := len(tile.Traces), 2; got != want { |
53 t.Errorf("Wrong number of Traces: Got %v Want %v", got, want) | 55 t.Errorf("Wrong number of Traces: Got %v Want %v", got, want) |
54 } | 56 } |
55 tr := tile.Traces["x86_64:565:Debug:HD7770:ShuttleA:varied_text_clipped_
no_lcd:Win8"].(*types.GoldenTrace) | 57 tr := tile.Traces["x86_64:565:Debug:HD7770:ShuttleA:varied_text_clipped_
no_lcd:Win8"].(*types.GoldenTrace) |
56 if got, want := tr.Values[1], "445aa63b2200baaba9b37fd5f80c0447"; got !=
want { | 58 if got, want := tr.Values[1], "445aa63b2200baaba9b37fd5f80c0447"; got !=
want { |
57 t.Errorf("Digest wrong: Got %v Want %v", got, want) | 59 t.Errorf("Digest wrong: Got %v Want %v", got, want) |
58 } | 60 } |
59 if got, want := len(tr.Params()), 9; got != want { | 61 if got, want := len(tr.Params()), 9; got != want { |
60 t.Errorf("Params wrong: Got %v Want %v", got, want) | 62 t.Errorf("Params wrong: Got %v Want %v", got, want) |
61 } | 63 } |
62 if got, want := tr.Params()["ext"], "png"; got != want { | 64 if got, want := tr.Params()["ext"], "png"; got != want { |
63 t.Errorf("Extension not injected:: Got %v Want %v", got, want) | 65 t.Errorf("Extension not injected:: Got %v Want %v", got, want) |
64 } | 66 } |
65 if got, want := int64(2), metricsProcessed.Count(); got != want { | 67 if got, want := int64(2), metricsProcessed.Count(); got != want { |
66 t.Errorf("Wrong number of points ingested: Got %v Want %v", got,
want) | 68 t.Errorf("Wrong number of points ingested: Got %v Want %v", got,
want) |
67 } | 69 } |
68 } | 70 } |
OLD | NEW |