Don't alert on old compressor (#5222)
When verifying the repo config, don't create an alert if the repo has the old s2-default compressor that we temporarily used. --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [x] ⛔ No #### Type of change - [ ] 🌻 Feature - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
4b56754546
commit
5e8407a970
@ -59,6 +59,15 @@ const (
|
|||||||
minEpochDurationUpperBound = 7 * 24 * time.Hour
|
minEpochDurationUpperBound = 7 * 24 * time.Hour
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// allValidCompressors is the set of compression algorithms either currently
|
||||||
|
// being used or that were previously used. Use this during the config verify
|
||||||
|
// command to avoid spurious errors. We can revisit whether we want to update
|
||||||
|
// the config in those old repos at a later time.
|
||||||
|
var allValidCompressors = map[compression.Name]struct{}{
|
||||||
|
compression.Name(defaultCompressor): {},
|
||||||
|
compression.Name("s2-default"): {},
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
ErrSettingDefaultConfig = clues.New("setting default repo config values")
|
ErrSettingDefaultConfig = clues.New("setting default repo config values")
|
||||||
ErrorRepoAlreadyExists = clues.New("repo already exists")
|
ErrorRepoAlreadyExists = clues.New("repo already exists")
|
||||||
@ -768,7 +777,7 @@ func (w *conn) verifyDefaultPolicyConfigOptions(
|
|||||||
|
|
||||||
ctx = clues.Add(ctx, "current_global_policy", globalPol.String())
|
ctx = clues.Add(ctx, "current_global_policy", globalPol.String())
|
||||||
|
|
||||||
if globalPol.CompressionPolicy.CompressorName != defaultCompressor {
|
if _, ok := allValidCompressors[globalPol.CompressionPolicy.CompressorName]; !ok {
|
||||||
errs.AddAlert(ctx, fault.NewAlert(
|
errs.AddAlert(ctx, fault.NewAlert(
|
||||||
"unexpected compressor",
|
"unexpected compressor",
|
||||||
corsoWrapperAlertNamespace,
|
corsoWrapperAlertNamespace,
|
||||||
|
|||||||
@ -891,6 +891,20 @@ func (suite *ConnRetentionIntegrationSuite) TestVerifyDefaultConfigOptions() {
|
|||||||
},
|
},
|
||||||
expectAlerts: 1,
|
expectAlerts: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "OldValidCompressor",
|
||||||
|
setupRepo: func(ctx context.Context, t *testing.T, con *conn) {
|
||||||
|
pol, err := con.getGlobalPolicyOrEmpty(ctx)
|
||||||
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
|
_, err = updateCompressionOnPolicy("s2-default", pol)
|
||||||
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
|
||||||
|
err = con.writeGlobalPolicy(ctx, "test", pol)
|
||||||
|
require.NoError(t, err, clues.ToCore(err))
|
||||||
|
},
|
||||||
|
expectAlerts: 0,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "NonDefaultCompression",
|
name: "NonDefaultCompression",
|
||||||
setupRepo: func(ctx context.Context, t *testing.T, con *conn) {
|
setupRepo: func(ctx context.Context, t *testing.T, con *conn) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user