feat(redundancy): add redundancy level configuration for smoke check#556
feat(redundancy): add redundancy level configuration for smoke check#556akrem-chabchoub wants to merge 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds support for configuring erasure coding redundancy levels in smoke tests to enable testing of Bee's redundancy features. The implementation adds a new r-level configuration option that can be set from 0 (NONE) to 4 (PARANOID), allowing smoke tests to verify proper redundancy behavior.
Key changes:
- Added
RLevelfield to smoke test options with configurable YAML parameterr-level - Extended upload/download test methods to accept and handle redundancy levels
- Added conditional
Swarm-Redundancy-LevelHTTP header for uploads when redundancy is enabled - Enabled redundancy fallback mode for downloads when using redundancy levels
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/check/smoke/smoke.go | Added RLevel option field with default value of redundancy.NONE and logging of redundancy level during test execution |
| pkg/config/check.go | Added YAML parsing for r-level option with uint8-to-Level type conversion in applyCheckConfig |
| pkg/test/test.go | Updated Upload and Download methods to accept redundancy level parameter and conditionally set download options |
| pkg/bee/api/options.go | Added RLevel field to UploadOptions struct to pass redundancy level to API |
| pkg/bee/api/bytes.go | Added conditional Swarm-Redundancy-Level HTTP header when redundancy level is not NONE |
| pkg/bee/api/api.go | Added redundancyLevelHeader constant definition |
| pkg/check/load/load.go | Updated to pass redundancy.NONE to maintain backward compatibility for load tests |
| config/local.yaml | Added example configuration with r-level: 2 (STRONG) for ci-smoke check |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pkg/config/check.go
Outdated
| case "RLevel": | ||
| if !lv.Field(i).IsNil() { // set locally | ||
| fieldValue := lv.FieldByName(fieldName).Elem() | ||
| level := uint8(fieldValue.Uint()) | ||
| rLevel := beeRedundancy.Level(level) | ||
| ft, ok := ot.FieldByName(fieldName) | ||
| if ok { | ||
| v := reflect.ValueOf(rLevel) | ||
| if v.Type().AssignableTo(ft.Type) { | ||
| ov.FieldByName(fieldName).Set(v) | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
Missing validation for the redundancy level value. The configuration accepts any uint8 value (0-255), but only values 0-4 are valid according to the PR description. Values outside this range will silently create invalid redundancy.Level values. Consider adding validation in the applyCheckConfig function to ensure the value is within the valid range of 0-4.
There was a problem hiding this comment.
I intentionally omitted validation in Beekeeper.
The Bee API validates redundancy levels, so invalid values (e.g., 5+) are rejected with clear errors.
This keeps Beekeeper future-proof: if Bee adds level 5 or higher, Beekeeper supports it without code changes.
config/local.yaml
Outdated
| download-timeout: 1m | ||
| iteration-wait: 5m | ||
| duration: 10m | ||
| r-level: 2 |
There was a problem hiding this comment.
It would be better if we can have array of levels, that way we could configure upload/download for each defined level.
pkg/check/smoke/smoke.go
Outdated
| UploadTimeout: 60 * time.Minute, | ||
| DownloadTimeout: 60 * time.Minute, | ||
| IterationWait: 5 * time.Minute, | ||
| RLevel: redundancy.NONE, |
There was a problem hiding this comment.
Through Bee code we have the default redundancy level:
// DefaultLevel is the default redundancy level
const DefaultLevel = PARANOIDis this NONE ok here as default?
Add redundancy level option to smoke tests
Summary
Adds support for configuring erasure coding redundancy level in smoke tests via the
r-levelYAML option.Changes
RLevelfield to smoke test options (defaults toredundancy.NONEfor backward compatibility)r-levelYAML configuration option for smoke checksSwarm-Redundancy-LevelHTTP header for uploadsRedundancyFallbackModefor downloads when redundancy is usedConfiguration
Files Changed
pkg/check/smoke/smoke.go- Added RLevel optionpkg/config/check.go- Added YAML parsing for r-levelpkg/test/test.go- Updated upload/download to accept redundancy levelpkg/bee/api/options.go- Added RLevel to UploadOptionspkg/bee/api/bytes.go- Added conditional redundancy headerpkg/bee/api/api.go- Added redundancy header constantconfig/local.yaml- Updated ci-smoke check with r-level: 2