(t *testing.T)
| 770 | } |
| 771 | |
| 772 | func TestCreateLegacyCache(t *testing.T) { |
| 773 | tcs := []struct { |
| 774 | name string |
| 775 | cfg *Config |
| 776 | expectedErr error |
| 777 | expectedRoles []cache.Role |
| 778 | expectedCache bool |
| 779 | }{ |
| 780 | { |
| 781 | name: "no caches", |
| 782 | cfg: &Config{}, |
| 783 | }, |
| 784 | { |
| 785 | name: "redis", |
| 786 | cfg: &Config{ |
| 787 | Cache: "redis", |
| 788 | Redis: &redis.Config{}, |
| 789 | BackgroundCache: &cache.BackgroundConfig{}, |
| 790 | }, |
| 791 | expectedRoles: []cache.Role{cache.RoleBloom, cache.RoleTraceIDIdx}, |
| 792 | expectedCache: true, |
| 793 | }, |
| 794 | { |
| 795 | name: "memcached", |
| 796 | cfg: &Config{ |
| 797 | Cache: "memcached", |
| 798 | Memcached: &memcached.Config{}, |
| 799 | BackgroundCache: &cache.BackgroundConfig{}, |
| 800 | }, |
| 801 | expectedRoles: []cache.Role{cache.RoleBloom, cache.RoleTraceIDIdx}, |
| 802 | expectedCache: true, |
| 803 | }, |
| 804 | { |
| 805 | name: "no cache but cache control", |
| 806 | cfg: &Config{ |
| 807 | Search: &SearchConfig{ |
| 808 | CacheControl: CacheControlConfig{ |
| 809 | Footer: true, |
| 810 | }, |
| 811 | }, |
| 812 | }, |
| 813 | expectedErr: errors.New("no legacy cache configured, but cache_control is enabled. Please use the new top level cache configuration"), |
| 814 | }, |
| 815 | { |
| 816 | name: "memcached + cache control", |
| 817 | cfg: &Config{ |
| 818 | Cache: "memcached", |
| 819 | Memcached: &memcached.Config{}, |
| 820 | BackgroundCache: &cache.BackgroundConfig{}, |
| 821 | Search: &SearchConfig{ |
| 822 | CacheControl: CacheControlConfig{ |
| 823 | Footer: true, |
| 824 | ColumnIndex: true, |
| 825 | OffsetIndex: true, |
| 826 | }, |
| 827 | }, |
| 828 | }, |
| 829 | expectedRoles: []cache.Role{cache.RoleBloom, cache.RoleTraceIDIdx, cache.RoleParquetColumnIdx, cache.RoleParquetFooter, cache.RoleParquetOffsetIdx}, |
nothing calls this directly
no test coverage detected