-
Notifications
You must be signed in to change notification settings - Fork 11
feat(fracmanager): add handling for upload queue overflow and disk space exhaustion #266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+436
−39
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
1d9247b
feat(fracmanager) add handling for upload queue overflow and disk spa…
eguguchkin c38f529
review fixes
eguguchkin 66dfbda
review fixes 2
eguguchkin 398fdd7
review fixes 3
eguguchkin 2d0726d
add logging
eguguchkin 4866644
linting
eguguchkin File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| package config | ||
|
|
||
| import ( | ||
| "os" | ||
| "path" | ||
| "path/filepath" | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| ) | ||
|
|
||
| func TestValidation(t *testing.T) { | ||
| base := `storage: | ||
| data_dir: /seq-db-data | ||
| frac_size: 16MiB | ||
| total_size: 10GiB | ||
|
|
||
| mapping: | ||
| path: /configs/mapping.yaml | ||
|
|
||
| resources: | ||
| cache_size: 2GiB | ||
|
|
||
| limits: | ||
| query_rate: 1024 | ||
| search_requests: 1024 | ||
| bulk_requests: 128 | ||
| inflight_bulks: 128 | ||
| doc_size: 1MiB | ||
| ` | ||
|
|
||
| baseCfg := createCfgFile(t, base) | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| cfg string | ||
| env map[string]string | ||
| expectErr bool | ||
| }{ | ||
| { | ||
| name: "Invalid storage.sealing_queue_len 1", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_STORAGE_SEALING_QUEUE_LEN": "-1"}, | ||
| expectErr: true, | ||
| }, | ||
| { | ||
| name: "Valid storage.sealing_queue_len 2", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_STORAGE_SEALING_QUEUE_LEN": "0"}, | ||
| expectErr: false, | ||
| }, | ||
| { | ||
| name: "Valid storage.sealing_queue_len 3", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_STORAGE_SEALING_QUEUE_LEN": "100"}, | ||
| expectErr: false, | ||
| }, | ||
|
|
||
| { | ||
| name: "Invalid offloading.queue_size_percent 1", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_OFFLOADING_QUEUE_SIZE_PERCENT": "-1"}, | ||
| expectErr: true, | ||
| }, | ||
| { | ||
| name: "Invalid offloading.queue_size_percent 2", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_OFFLOADING_QUEUE_SIZE_PERCENT": "100.1"}, | ||
| expectErr: true, | ||
| }, | ||
| { | ||
| name: "Valid offloading.queue_size_percent 3", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_OFFLOADING_QUEUE_SIZE_PERCENT": "0"}, | ||
| expectErr: false, | ||
| }, | ||
| { | ||
| name: "Valid offloading.queue_size_percent 4", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_OFFLOADING_QUEUE_SIZE_PERCENT": "100"}, | ||
| expectErr: false, | ||
| }, | ||
| { | ||
| name: "Valid offloading.queue_size_percent 5", | ||
| cfg: baseCfg, | ||
| env: map[string]string{"SEQDB_OFFLOADING_QUEUE_SIZE_PERCENT": "50"}, | ||
| expectErr: false, | ||
| }, | ||
| } | ||
|
|
||
| for _, tt := range tests { | ||
| t.Run(tt.name, func(t *testing.T) { | ||
| for k, v := range tt.env { | ||
| t.Setenv(k, v) | ||
| } | ||
|
|
||
| c, err := Parse(tt.cfg) | ||
| assert.NoError(t, err) | ||
|
|
||
| res := c.Validate("store") | ||
| if tt.expectErr { | ||
| assert.Error(t, res) | ||
| } else { | ||
| assert.NoError(t, res) | ||
| } | ||
| }) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| func createCfgFile(t *testing.T, data string) string { | ||
| f := path.Join(t.TempDir(), "config.yaml") | ||
| err := os.WriteFile(f, []byte(data), 0o666) | ||
| assert.NoError(t, err) | ||
|
|
||
| abs, err := filepath.Abs(f) | ||
| assert.NoError(t, err) | ||
| return abs | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.