MCPcopy Create free account
hub / github.com/couchbase/moss / TestStoreReadOnlyOption

Function TestStoreReadOnlyOption

store_test.go:1865–1900  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1863}
1864
1865func TestStoreReadOnlyOption(t *testing.T) {
1866 tmpDir, _ := ioutil.TempDir("", "mossStore")
1867 defer os.RemoveAll(tmpDir)
1868
1869 // Open store, coll in Regular mode, and write 10 items
1870 store, coll := openStoreAndWriteNItems(t, tmpDir, 10, 1, false)
1871
1872 if fetchOpsSetFromFooter(store) != 10 {
1873 t.Errorf("Unexpected number of sets!")
1874 }
1875
1876 coll.Close()
1877 store.Close()
1878
1879 // Reopen store, coll in ReadOnly mode, and write 10 more items
1880 store, coll = openStoreAndWriteNItems(t, tmpDir, 10, 1, true)
1881
1882 // Expect no additional sets since the first batch
1883 if fetchOpsSetFromFooter(store) != 10 {
1884 t.Errorf("Extra number of sets detected!")
1885 }
1886
1887 coll.Close()
1888 store.Close()
1889
1890 // Reopen store, coll in regular mode, and write 10 more items
1891 store, coll = openStoreAndWriteNItems(t, tmpDir, 10, 1, false)
1892
1893 // Expect 10 more sets since the first batch
1894 if fetchOpsSetFromFooter(store) != 20 {
1895 t.Errorf("Unexpected number of sets!")
1896 }
1897
1898 coll.Close()
1899 store.Close()
1900}
1901
1902func TestStoreCollHistograms(t *testing.T) {
1903 tmpDir, _ := ioutil.TempDir("", "mossStore")

Callers

nothing calls this directly

Calls 3

openStoreAndWriteNItemsFunction · 0.85
fetchOpsSetFromFooterFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…