minor test enhancement (#4530)

#### Does this PR need a docs update or release note?

- [x]  No

#### Type of change

- [x] 🧹 Tech Debt/Cleanup
This commit is contained in:
Keepers 2023-11-15 10:21:10 -07:00 committed by GitHub
parent 0294e27f2f
commit 551bfd2b13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 20 deletions

View File

@ -14,7 +14,7 @@ const (
// create buffer pools for each upload. This is not the actual
// number of uploads, but the max that can be specified. This is
// added as a safeguard in case we misconfigure the values.
maxConccurrentUploads = 20
maxConcurrentUploads = 20
// CopyBufferSize is used for chunked upload
// Microsoft recommends 5-10MB buffers
@ -94,8 +94,8 @@ func (p parallelism) ItemUpload() int {
return 1
}
if p.itemUpload > maxConccurrentUploads {
return maxConccurrentUploads
if p.itemUpload > maxConcurrentUploads {
return maxConcurrentUploads
}
return p.itemUpload

View File

@ -14,6 +14,7 @@ import (
"github.com/alcionai/corso/src/internal/tester"
"github.com/alcionai/corso/src/internal/tester/tconfig"
"github.com/alcionai/corso/src/pkg/fault"
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
)
type GroupUnitSuite struct {
@ -167,32 +168,42 @@ func (suite *GroupsIntgSuite) TestGroups_GetByID() {
table := []struct {
name string
id string
expectErr assert.ErrorAssertionFunc
expectErr func(t *testing.T, err error)
}{
{
name: "valid id",
id: groupID,
expectErr: assert.NoError,
expectErr: func(t *testing.T, err error) {
assert.NoError(t, err, clues.ToCore(err))
},
},
{
name: "valid email as identifier",
id: groupsEmail,
expectErr: assert.NoError,
expectErr: func(t *testing.T, err error) {
assert.NoError(t, err, clues.ToCore(err))
},
},
{
name: "invalid id",
id: uuid.NewString(),
expectErr: assert.Error,
expectErr: func(t *testing.T, err error) {
assert.ErrorIs(t, err, graph.ErrResourceOwnerNotFound, clues.ToCore(err))
},
},
{
name: "valid display name",
id: ptr.Val(grp.GetDisplayName()),
expectErr: assert.NoError,
expectErr: func(t *testing.T, err error) {
assert.NoError(t, err, clues.ToCore(err))
},
},
{
name: "invalid displayName",
id: "jabberwocky",
expectErr: assert.Error,
expectErr: func(t *testing.T, err error) {
assert.ErrorIs(t, err, graph.ErrResourceOwnerNotFound, clues.ToCore(err))
},
},
}
for _, test := range table {
@ -203,7 +214,7 @@ func (suite *GroupsIntgSuite) TestGroups_GetByID() {
defer flush()
_, err := groupsAPI.GetByID(ctx, test.id, CallConfig{})
test.expectErr(t, err, clues.ToCore(err))
test.expectErr(t, err)
})
}
}