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
|
// create buffer pools for each upload. This is not the actual
|
||||||
// number of uploads, but the max that can be specified. This is
|
// number of uploads, but the max that can be specified. This is
|
||||||
// added as a safeguard in case we misconfigure the values.
|
// added as a safeguard in case we misconfigure the values.
|
||||||
maxConccurrentUploads = 20
|
maxConcurrentUploads = 20
|
||||||
|
|
||||||
// CopyBufferSize is used for chunked upload
|
// CopyBufferSize is used for chunked upload
|
||||||
// Microsoft recommends 5-10MB buffers
|
// Microsoft recommends 5-10MB buffers
|
||||||
@ -94,8 +94,8 @@ func (p parallelism) ItemUpload() int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if p.itemUpload > maxConccurrentUploads {
|
if p.itemUpload > maxConcurrentUploads {
|
||||||
return maxConccurrentUploads
|
return maxConcurrentUploads
|
||||||
}
|
}
|
||||||
|
|
||||||
return p.itemUpload
|
return p.itemUpload
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/alcionai/corso/src/internal/tester"
|
"github.com/alcionai/corso/src/internal/tester"
|
||||||
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
"github.com/alcionai/corso/src/internal/tester/tconfig"
|
||||||
"github.com/alcionai/corso/src/pkg/fault"
|
"github.com/alcionai/corso/src/pkg/fault"
|
||||||
|
"github.com/alcionai/corso/src/pkg/services/m365/api/graph"
|
||||||
)
|
)
|
||||||
|
|
||||||
type GroupUnitSuite struct {
|
type GroupUnitSuite struct {
|
||||||
@ -167,32 +168,42 @@ func (suite *GroupsIntgSuite) TestGroups_GetByID() {
|
|||||||
table := []struct {
|
table := []struct {
|
||||||
name string
|
name string
|
||||||
id string
|
id string
|
||||||
expectErr assert.ErrorAssertionFunc
|
expectErr func(t *testing.T, err error)
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "valid id",
|
name: "valid id",
|
||||||
id: groupID,
|
id: groupID,
|
||||||
expectErr: assert.NoError,
|
expectErr: func(t *testing.T, err error) {
|
||||||
|
assert.NoError(t, err, clues.ToCore(err))
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "valid email as identifier",
|
name: "valid email as identifier",
|
||||||
id: groupsEmail,
|
id: groupsEmail,
|
||||||
expectErr: assert.NoError,
|
expectErr: func(t *testing.T, err error) {
|
||||||
|
assert.NoError(t, err, clues.ToCore(err))
|
||||||
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "invalid id",
|
name: "invalid id",
|
||||||
id: uuid.NewString(),
|
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",
|
name: "valid display name",
|
||||||
id: ptr.Val(grp.GetDisplayName()),
|
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",
|
name: "invalid displayName",
|
||||||
id: "jabberwocky",
|
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 {
|
for _, test := range table {
|
||||||
@ -203,7 +214,7 @@ func (suite *GroupsIntgSuite) TestGroups_GetByID() {
|
|||||||
defer flush()
|
defer flush()
|
||||||
|
|
||||||
_, err := groupsAPI.GetByID(ctx, test.id, CallConfig{})
|
_, 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