(t *testing.T)
| 569 | } |
| 570 | |
| 571 | func TestGetClusterStats(t *testing.T) { |
| 572 | proxyURL := tutils.RandomProxyURL(t) |
| 573 | smap := tutils.GetClusterMap(t, proxyURL) |
| 574 | stats := tutils.GetClusterStats(t, proxyURL) |
| 575 | |
| 576 | for k, v := range stats.Target { |
| 577 | tdstats := tutils.GetDaemonStats(t, smap.Tmap[k].PubNet.URL) |
| 578 | tdcapstats := tdstats["capacity"].(map[string]interface{}) |
| 579 | dcapstats := v.MPCap |
| 580 | for fspath, fstats := range dcapstats { |
| 581 | tfstats := tdcapstats[fspath].(map[string]interface{}) |
| 582 | used, err := strconv.ParseInt(tfstats["used"].(string), 10, 64) |
| 583 | if err != nil { |
| 584 | t.Fatalf("Could not decode Target Stats: fstats.Used") |
| 585 | } |
| 586 | avail, err := strconv.ParseInt(tfstats["avail"].(string), 10, 64) |
| 587 | if err != nil { |
| 588 | t.Fatalf("Could not decode Target Stats: fstats.Avail") |
| 589 | } |
| 590 | pct := int64(tfstats["pct_used"].(float64)) |
| 591 | if used != int64(fstats.Used) || avail != int64(fstats.Avail) || pct != int64(fstats.PctUsed) { |
| 592 | t.Errorf("Stats are different when queried from Target and Proxy: "+ |
| 593 | "Used: %v, %v | Available: %v, %v | Percentage: %v, %v", |
| 594 | tfstats["used"], fstats.Used, tfstats["avail"], |
| 595 | fstats.Avail, tfstats["pct_used"], fstats.PctUsed) |
| 596 | } |
| 597 | } |
| 598 | } |
| 599 | } |
| 600 | |
| 601 | func TestLRU(t *testing.T) { |
| 602 | var ( |
nothing calls this directly
no test coverage detected