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:
parent
0294e27f2f
commit
551bfd2b13
@ -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
|
||||
|
||||
@ -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,
|
||||
name: "valid id",
|
||||
id: groupID,
|
||||
expectErr: func(t *testing.T, err error) {
|
||||
assert.NoError(t, err, clues.ToCore(err))
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "valid email as identifier",
|
||||
id: groupsEmail,
|
||||
expectErr: assert.NoError,
|
||||
name: "valid email as identifier",
|
||||
id: groupsEmail,
|
||||
expectErr: func(t *testing.T, err error) {
|
||||
assert.NoError(t, err, clues.ToCore(err))
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "invalid id",
|
||||
id: uuid.NewString(),
|
||||
expectErr: assert.Error,
|
||||
name: "invalid id",
|
||||
id: uuid.NewString(),
|
||||
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,
|
||||
name: "valid display name",
|
||||
id: ptr.Val(grp.GetDisplayName()),
|
||||
expectErr: func(t *testing.T, err error) {
|
||||
assert.NoError(t, err, clues.ToCore(err))
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "invalid displayName",
|
||||
id: "jabberwocky",
|
||||
expectErr: assert.Error,
|
||||
name: "invalid displayName",
|
||||
id: "jabberwocky",
|
||||
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)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user