|
7 | 7 | "testing" |
8 | 8 |
|
9 | 9 | "github.com/canopy-network/canopy/lib" |
| 10 | + "github.com/cockroachdb/pebble/v2/sstable" |
10 | 11 | "github.com/stretchr/testify/require" |
11 | 12 | ) |
12 | 13 |
|
@@ -65,3 +66,24 @@ func TestMakeVersionedKeyConcurrent(t *testing.T) { |
65 | 66 | require.False(t, failed.Load(), "concurrent makeVersionedKey produced malformed keys") |
66 | 67 | } |
67 | 68 |
|
| 69 | +func TestGetCompressionProfile(t *testing.T) { |
| 70 | + tests := []struct { |
| 71 | + input string |
| 72 | + expected *sstable.CompressionProfile |
| 73 | + }{ |
| 74 | + {"zstd", sstable.ZstdCompression}, |
| 75 | + {"ZSTD", sstable.ZstdCompression}, |
| 76 | + {"snappy", sstable.SnappyCompression}, |
| 77 | + {"fastest", sstable.FastestCompression}, |
| 78 | + {"balanced", sstable.BalancedCompression}, |
| 79 | + {"good", sstable.GoodCompression}, |
| 80 | + {"noCompression", sstable.NoCompression}, |
| 81 | + {"unknown", sstable.ZstdCompression}, |
| 82 | + {"", sstable.ZstdCompression}, |
| 83 | + } |
| 84 | + for _, tt := range tests { |
| 85 | + t.Run(tt.input, func(t *testing.T) { |
| 86 | + require.Equal(t, tt.expected, getCompressionProfile(tt.input)) |
| 87 | + }) |
| 88 | + } |
| 89 | +} |
0 commit comments