mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 02:57:37 +01:00
terraform/provider: reject an explicitly empty compaction strategy
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e419cc2888
commit
751c0ce99c
2 files changed
+11
No files matched your search
@@ -377,6 +377,9 @@ func (r *s3TableMaintenanceResource) value(model s3TableMaintenanceResourceModel
|
||||
return s3TableMaintenanceValue{}, fmt.Errorf("snapshot management settings cannot be used with %s", model.Type.ValueString())
|
||||
}
|
||||
strategy := model.Strategy.ValueString()
|
||||
if !model.Strategy.IsNull() && !model.Strategy.IsUnknown() && strategy == "" {
|
||||
return s3TableMaintenanceValue{}, fmt.Errorf("strategy must be auto, binpack, or sort; omit it to use the server default")
|
||||
}
|
||||
if strategy != "" && strategy != "auto" && strategy != "binpack" && strategy != "sort" {
|
||||
return s3TableMaintenanceValue{}, fmt.Errorf("strategy must be auto, binpack, or sort")
|
||||
}
|
||||
|
||||
@@ -153,6 +153,14 @@ func TestS3TableMaintenanceResourceValue(t *testing.T) {
|
||||
if err == nil {
|
||||
t.Fatal("expected unsupported compaction strategy to be rejected")
|
||||
}
|
||||
_, err = compaction.value(s3TableMaintenanceResourceModel{
|
||||
Type: types.StringValue(s3TableMaintenanceCompaction),
|
||||
Status: types.StringValue("enabled"),
|
||||
Strategy: types.StringValue(""),
|
||||
})
|
||||
if err == nil {
|
||||
t.Fatal("expected an explicitly empty compaction strategy to be rejected")
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseTableMaintenanceImportID(t *testing.T) {
|
||||
|
||||
Reference in new issue
Block a user