(t *testing.T)
| 44 | } |
| 45 | |
| 46 | func TestValidateConfig(t *testing.T) { |
| 47 | tests := []struct { |
| 48 | cfg *Config |
| 49 | expectedConfig *Config |
| 50 | err error |
| 51 | }{ |
| 52 | // nil config fails |
| 53 | { |
| 54 | err: errors.New("config should be non-nil"), |
| 55 | }, |
| 56 | // nil wal fails |
| 57 | { |
| 58 | cfg: &Config{}, |
| 59 | err: errors.New("wal config should be non-nil"), |
| 60 | }, |
| 61 | // nil block fails |
| 62 | { |
| 63 | cfg: &Config{ |
| 64 | WAL: &wal.Config{}, |
| 65 | }, |
| 66 | err: errors.New("block config should be non-nil"), |
| 67 | }, |
| 68 | // WAL version is always set to block version |
| 69 | { |
| 70 | cfg: &Config{ |
| 71 | WAL: &wal.Config{}, |
| 72 | Block: &common.BlockConfig{ |
| 73 | BloomFP: 0.01, |
| 74 | BloomShardSizeBytes: 1, |
| 75 | Version: vparquet5.VersionString, |
| 76 | }, |
| 77 | }, |
| 78 | expectedConfig: &Config{ |
| 79 | WAL: &wal.Config{ |
| 80 | Version: vparquet5.VersionString, |
| 81 | }, |
| 82 | Block: &common.BlockConfig{ |
| 83 | BloomFP: 0.01, |
| 84 | BloomShardSizeBytes: 1, |
| 85 | Version: vparquet5.VersionString, |
| 86 | }, |
| 87 | }, |
| 88 | }, |
| 89 | // WAL version is always overwritten with block version, even if previously set |
| 90 | { |
| 91 | cfg: &Config{ |
| 92 | WAL: &wal.Config{ |
| 93 | Version: "vParquet3", |
| 94 | }, |
| 95 | Block: &common.BlockConfig{ |
| 96 | BloomFP: 0.01, |
| 97 | BloomShardSizeBytes: 1, |
| 98 | Version: vparquet5.VersionString, |
| 99 | }, |
| 100 | }, |
| 101 | expectedConfig: &Config{ |
| 102 | WAL: &wal.Config{ |
| 103 | Version: vparquet5.VersionString, |
nothing calls this directly
no test coverage detected