(t *testing.T)
| 1900 | } |
| 1901 | |
| 1902 | func TestStoreCollHistograms(t *testing.T) { |
| 1903 | tmpDir, _ := ioutil.TempDir("", "mossStore") |
| 1904 | defer os.RemoveAll(tmpDir) |
| 1905 | |
| 1906 | itemCount := 10000 |
| 1907 | batchCount := 100 |
| 1908 | |
| 1909 | // Open store, coll and write about 10000 items |
| 1910 | store, coll := openStoreAndWriteNItems( |
| 1911 | t, tmpDir, itemCount, batchCount, false) |
| 1912 | coll.Close() |
| 1913 | store.Close() |
| 1914 | |
| 1915 | shistograms := store.Histograms() |
| 1916 | numHistograms := len(shistograms) |
| 1917 | |
| 1918 | if shistograms["PersistUsecs"].TotCount == 0 { |
| 1919 | t.Errorf("Expected a few entries for PersistUsecs!") |
| 1920 | } |
| 1921 | |
| 1922 | if shistograms["CompactUsecs"].TotCount != 0 { |
| 1923 | t.Errorf("Expected no entries for CompactUsecs!") |
| 1924 | } |
| 1925 | |
| 1926 | if shistograms["PersistFooterUsecs"].TotCount != |
| 1927 | shistograms["PersistUsecs"].TotCount { |
| 1928 | t.Errorf("Expected PersisterFooterUsecs to match PersistUsecs!") |
| 1929 | } |
| 1930 | |
| 1931 | chistograms := coll.Histograms() |
| 1932 | |
| 1933 | if chistograms["ExecuteBatchUsecs"].TotCount != uint64(batchCount) { |
| 1934 | t.Errorf("Unexpected number of ExecuteBatchUsecs samples!") |
| 1935 | } |
| 1936 | |
| 1937 | if chistograms["MergerUsecs"].TotCount == 0 { |
| 1938 | t.Errorf("Expected a few entries for MergerUsecs!") |
| 1939 | } |
| 1940 | |
| 1941 | if shistograms.AddAll(chistograms) != nil { |
| 1942 | t.Errorf("Expected AddAll to succeed") |
| 1943 | } |
| 1944 | |
| 1945 | if len(shistograms) != numHistograms+len(chistograms) { |
| 1946 | t.Errorf("shistograms carries unexpected number of histograms") |
| 1947 | } |
| 1948 | |
| 1949 | if shistograms["ExecuteBatchUsecs"] == nil || |
| 1950 | shistograms["ExecuteBatchUsecs"].TotCount != |
| 1951 | chistograms["ExecuteBatchUsecs"].TotCount { |
| 1952 | t.Errorf("Expected ExecutedBatchUsecs to match chistograms'") |
| 1953 | } |
| 1954 | |
| 1955 | if shistograms["MergerUsecs"] == nil || |
| 1956 | shistograms["MergerUsecs"].TotCount != |
| 1957 | chistograms["MergerUsecs"].TotCount { |
| 1958 | t.Errorf("Expected MergerUsecs to match chistograms'") |
| 1959 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…