feat(redundancy): add redundancy level configuration for smoke check#556
feat(redundancy): add redundancy level configuration for smoke check#556akrem-chabchoub wants to merge 12 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.
…moke-redundancy-option
pkg/check/smoke/smoke.go
Outdated
| UploadTimeout: 60 * time.Minute, | ||
| DownloadTimeout: 60 * time.Minute, | ||
| IterationWait: 5 * time.Minute, | ||
| RLevels: []redundancy.Level{redundancy.PARANOID}, |
There was a problem hiding this comment.
Maybe best to leave it empty (wihout specifying any level), and ensure that default behaviour is used (and that check is working like it worked before)
| if rLevel != nil && *rLevel != redundancy.NONE { | ||
| fallbackMode := true | ||
| downloadOpts = &api.DownloadOptions{ | ||
| RLevel: rLevel, |
There was a problem hiding this comment.
RLevel should be assigned only if it is defined in the yaml file where is the configuration for the checks.
pkg/check/load/load.go
Outdated
|
|
||
| address, duration, err = test.Upload(ctx, uploader, txData, batchID) | ||
| rLevel := redundancy.NONE | ||
| address, duration, err = test.Upload(ctx, uploader, txData, batchID, &rLevel) |
There was a problem hiding this comment.
We do not need to have default value for the rLevel, we should take it from configuration directly as is, to be backwards compatibile. If the rLevel is defined we should forward it. If not, use nil.
There was a problem hiding this comment.
I think we can set it to nil and later we do proper update to load check ? because it will require some modification to the check itself, wdyt ?
|
Also, we should add label for the metrics because the results depending on the specified redundancy-level. Current metrics do not have this label, so if we add it, probably we will break the current dashboards. But we can update them in Grafana. Also, |
…#575) Add redundancy_level label to all smoke check metrics to enable per-redundancy-level and per-file-size analysis in Grafana dashboards. - Add redundancy_level label to all per-operation metric vectors - Change throughput metrics from Gauge to Histogram for quantile support - Add upload_success/download_success counters - Add uploaded_bytes_total/downloaded_bytes_total counters
…moke-redundancy-option
|
Grafana Dashboard Beekeeper - Smoke Check Performance for bee-light-testnet with this changes included |
Smoke check redundancy level option
Summary
Adds configurable redundancy levels to the smoke check so upload/download can be tested at different r-levels (0, 2, 4). The Bee API is extended to send the
Swarm-Redundancy-Levelheader on upload and download, and smoke metrics are extended with aredundancy_leveldimension plus success/bytes counters.What changed
Config and API
config/local.yaml– Smoke check gainsr-levels: [0, 2, 4]so each file size is tested for each level.pkg/bee/api/– NewSwarm-Redundancy-Levelheader:UploadOptions.RLeveland header set in bytes upload.DownloadOptions.RLeveland header set inrequestDataGetHeader; optionalRedundancyFallbackModeused in tests.pkg/config/check.go– NewRLevelsoption: YAMLr-levelsis decoded and applied to the smoke check options.Smoke check
pkg/check/smoke/smoke.go– Smoke runs over file sizes × redundancy levels: for each size, it iterates overr-levels, uploads with that level, then downloads with the same level (and fallback). Retries and error handling (upload skip on failure, topology logging on download failure) are preserved; metrics use aredundancy_levellabel.pkg/check/smoke/metrics.go– New metrics:upload_success,download_success,uploaded_bytes_total,downloaded_bytes_total. Existing smoke metrics get aredundancy_levellabel. Duration histograms get extra buckets (e.g. 1800, 3600 s) for long-running runs.