Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
add mmvdump and more client tests #18
Merged
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
2d8be68
mmvdump: initial library
suyash 0d922a0
mmvdump: initial working cli
suyash af411a3
mmvdump: fix some lint warnings
suyash a2faa89
make: increase dupl threshold for lint
suyash 93bfea4
mmvdump: make InstanceDomains consistent and make Tocs array
suyash 4bf59f2
mmvdump: add support for printing instances and indoms
suyash 3a6bb89
mmvdump: refactor
suyash 0807418
mmvdump: add a basic test
suyash 5066275
client: initial mmvdump backed tests for testing singleton metric wri…
suyash 046d3d3
client: add test for testing writing instance metrics
suyash 1823704
mmvdump: refactor data fetching
suyash b7cc971
mmvdump: add package documentation
suyash a1be304
client: test instance metrics and values
suyash 9625c4d
client: add test for writing string values
suyash 5f4d62d
mmvdump: remove StringVal
suyash 31ad2c9
make: increase dupl threshold to 150
suyash 0be976e
mmvdump: make reader concurrent
suyash
Jump to file or symbol
Failed to load files and symbols.
Viewing a subset of changes. View all
121
client_test.go
| @@ -0,0 +1,55 @@ | ||
| +package mmvdump | ||
| + | ||
| +import ( | ||
| + "os" | ||
| + "testing" | ||
| +) | ||
| + | ||
| +func TestMmvDump1(t *testing.T) { | ||
| + f, err := os.Open("testdata/test1.mmv") | ||
| + if err != nil { | ||
| + panic(err) | ||
| + } | ||
| + | ||
| + s, err := os.Stat("testdata/test1.mmv") | ||
| + if err != nil { | ||
| + panic(err) | ||
| + } | ||
| + | ||
| + data := make([]byte, s.Size()) | ||
| + f.Read(data) | ||
| + | ||
| + h, tocs, metrics, values, instances, indoms, strings, err := Dump(data) | ||
| + if err != nil { | ||
| + t.Error(err) | ||
| + return | ||
| + } | ||
| + | ||
| + if h.G1 != h.G2 { | ||
| + t.Error("Invalid Header") | ||
| + } | ||
| + | ||
| + if len(tocs) != 3 { | ||
| + t.Errorf("expected number of tocs %d, got %d", 3, len(tocs)) | ||
| + } | ||
| + | ||
| + if len(indoms) != 0 { | ||
| + t.Errorf("expected number of indoms %d, got %d", 0, len(indoms)) | ||
| + } | ||
| + | ||
| + if len(strings) != 2 { | ||
| + t.Errorf("expected number of strings %d, got %d", 2, len(strings)) | ||
| + } | ||
| + | ||
| + if len(metrics) != 1 { | ||
| + t.Errorf("expected number of strings %d, got %d", 1, len(metrics)) | ||
| + } | ||
| + | ||
| + if len(values) != 1 { | ||
| + t.Errorf("expected number of strings %d, got %d", 1, len(values)) | ||
| + } | ||
| + | ||
| + if len(instances) != 0 { | ||
| + t.Errorf("expected number of strings %d, got %d", 0, len(instances)) | ||
| + } | ||
| +} |