(b testing.TB)
| 2885 | } |
| 2886 | |
| 2887 | func blockForBenchmarks(b testing.TB) *backendBlock { |
| 2888 | id, ok := os.LookupEnv("VP5_BENCH_BLOCKID") |
| 2889 | if !ok { |
| 2890 | b.Fatal("VP5_BENCH_BLOCKID is not set. These benchmarks are designed to run against a block on local disk. Set VP5_BENCH_BLOCKID to the guid of the block to run benchmarks against. e.g. `export VP5_BENCH_BLOCKID=030c8c4f-9d47-4916-aadc-26b90b1d2bc4`") |
| 2891 | } |
| 2892 | |
| 2893 | path, ok := os.LookupEnv("VP5_BENCH_PATH") |
| 2894 | if !ok { |
| 2895 | b.Fatal("VP5_BENCH_PATH is not set. These benchmarks are designed to run against a block on local disk. Set VP5_BENCH_PATH to the root of the backend such that the block to benchmark is at <VP5_BENCH_PATH>/<VP5_BENCH_TENANTID>/<VP5_BENCH_BLOCKID>.") |
| 2896 | } |
| 2897 | |
| 2898 | tenantID, ok := os.LookupEnv("VP5_BENCH_TENANTID") |
| 2899 | |
| 2900 | if !ok { |
| 2901 | tenantID = "1" |
| 2902 | } |
| 2903 | |
| 2904 | blockID := uuid.MustParse(id) |
| 2905 | r, _, _, err := local.New(&local.Config{ |
| 2906 | Path: path, |
| 2907 | }) |
| 2908 | require.NoError(b, err) |
| 2909 | |
| 2910 | rr := backend.NewReader(r) |
| 2911 | meta, err := rr.BlockMeta(context.Background(), blockID, tenantID) |
| 2912 | require.NoError(b, err) |
| 2913 | |
| 2914 | return newBackendBlock(meta, rr) |
| 2915 | } |
no test coverage detected