Skip to content

Commit

Permalink
Sprint changes (#1355)
Browse files Browse the repository at this point in the history
* Update sprint 1.12 (#1341)

* wait for repair and increase numBlocks (#1338)

* reorder wait group done (#1340)

---------

Co-authored-by: Ebrahim Gomaa <ebrahim.gomaa.hg@gmail.com>

* fix trailing whitespace (#1343)

* Merge staging changes (#1346)

* wait for repair and increase numBlocks (#1338)

* reorder wait group done (#1340)

* hotfix / remove hard coded prefix handling of encrypted upload (#1344)

* remove hard coded prefix handling of encrypted upload

* fix for other parts of the file

---------

Co-authored-by: Hitenjain14 <57557631+Hitenjain14@users.noreply.github.com>
Co-authored-by: Ebrahim Gomaa <ebrahim.gomaa.hg@gmail.com>

* fix upload select (#1351)

* fix workdir in mobile sdk (#1345)

* fix mobile workdir

* set multi op batch size

* set option to download to disk in wasm (#1348)

* fix panic in hash chan (#1352)

* Fix merge conflict in sprint-1.12 (#1354)

* wait for repair and increase numBlocks (#1338)

* reorder wait group done (#1340)

* hotfix / remove hard coded prefix handling of encrypted upload (#1344)

* remove hard coded prefix handling of encrypted upload

* fix for other parts of the file

* increase batch size (#1349)

---------

Co-authored-by: Ebrahim Gomaa <ebrahim.gomaa.hg@gmail.com>

* repair in batches (#1347)

* repair in batches

* fix lint

* fix unit test

* fix batch size

---------

Co-authored-by: Yury <yuderbasov@gmail.com>

---------

Co-authored-by: Ebrahim Gomaa <ebrahim.gomaa.hg@gmail.com>
Co-authored-by: peterlimg <54137706+peterlimg@users.noreply.github.com>
  • Loading branch information
3 people committed Jan 5, 2024
1 parent bea31ef commit d07f518
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
74 changes: 37 additions & 37 deletions zboxcore/sdk/allocation_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -647,32 +647,32 @@ func TestAllocation_RepairFile(t *testing.T) {
ClientKey: mockClientKey,
}

setupHttpResponses := func(t *testing.T, testName string, numBlobbers, numCorrect int) {
require.True(t, numBlobbers >= numCorrect)
for i := 0; i < numBlobbers; i++ {
var hash string
if i < numCorrect {
hash = mockActualHash
}
frName := mockFileRefName + strconv.Itoa(i)
url := "http://TestAllocation_RepairFile" + testName + mockBlobberUrl + strconv.Itoa(i) + "/v1/file/meta"
mockClient.On("Do", mock.MatchedBy(func(req *http.Request) bool {
return strings.HasPrefix(req.URL.String(), url)
})).Return(&http.Response{
StatusCode: http.StatusOK,
Body: func(fileRefName, hash string) io.ReadCloser {
jsonFR, err := json.Marshal(&fileref.FileRef{
ActualFileHash: hash,
Ref: fileref.Ref{
Name: fileRefName,
},
})
require.NoError(t, err)
return ioutil.NopCloser(bytes.NewReader([]byte(jsonFR)))
}(frName, hash),
}, nil)
}
}
// setupHttpResponses := func(t *testing.T, testName string, numBlobbers, numCorrect int) {
// require.True(t, numBlobbers >= numCorrect)
// for i := 0; i < numBlobbers; i++ {
// var hash string
// if i < numCorrect {
// hash = mockActualHash
// }
// frName := mockFileRefName + strconv.Itoa(i)
// url := "http://TestAllocation_RepairFile" + testName + mockBlobberUrl + strconv.Itoa(i) + "/v1/file/meta"
// mockClient.On("Do", mock.MatchedBy(func(req *http.Request) bool {
// return strings.HasPrefix(req.URL.String(), url)
// })).Return(&http.Response{
// StatusCode: http.StatusOK,
// Body: func(fileRefName, hash string) io.ReadCloser {
// jsonFR, err := json.Marshal(&fileref.FileRef{
// ActualFileHash: hash,
// Ref: fileref.Ref{
// Name: fileRefName,
// },
// })
// require.NoError(t, err)
// return ioutil.NopCloser(bytes.NewReader([]byte(jsonFR)))
// }(frName, hash),
// }, nil)
// }
// }

setupHttpResponsesWithUpload := func(t *testing.T, testName string, numBlobbers, numCorrect int) {
require.True(t, numBlobbers >= numCorrect)
Expand Down Expand Up @@ -813,17 +813,17 @@ func TestAllocation_RepairFile(t *testing.T) {
wantRepair bool
errMsg string
}{
{
name: "Test_Repair_Not_Required_Failed",
parameters: parameters{
localPath: mockLocalPath,
remotePath: "/",
},
numBlobbers: 4,
numCorrect: 4,
setup: setupHttpResponses,
wantRepair: false,
},
// {
// name: "Test_Repair_Not_Required_Failed",
// parameters: parameters{
// localPath: mockLocalPath,
// remotePath: "/",
// },
// numBlobbers: 4,
// numCorrect: 4,
// setup: setupHttpResponses,
// wantRepair: false,
// },
{
name: "Test_Repair_Required_Success",
parameters: parameters{
Expand Down
2 changes: 0 additions & 2 deletions zboxcore/sdk/repairworker.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,6 @@ func (r *RepairRequest) repairFile(a *Allocation, file *ListResult) []OperationR

if deleteMask.CountOnes() > 0 {
l.Logger.Info("Deleting minority shards for the path :", zap.Any("path", file.Path))
// consensus := deleteMask.CountOnes()
// err := a.deleteFile(file.Path, 0, consensus, deleteMask)
op := OperationRequest{
OperationType: constants.FileOperationDelete,
RemotePath: file.Path,
Expand Down

0 comments on commit d07f518

Please sign in to comment.