move largeItem client constructor into new GC (#3130)
It's an unnecessary paramter. Plus, this sets up the next pr to have a smaller footprint. --- #### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🧹 Tech Debt/Cleanup #### Issue(s) * #3129 #### Test Plan - [x] ⚡ Unit test - [x] 💚 E2E
This commit is contained in:
parent
fe644ae2be
commit
d5eee4479d
@ -13,7 +13,6 @@ import (
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/connector"
|
||||
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/version"
|
||||
"github.com/alcionai/corso/src/pkg/account"
|
||||
@ -137,7 +136,6 @@ func getGCAndVerifyUser(ctx context.Context, userID string) (*connector.GraphCon
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
acct,
|
||||
connector.Users,
|
||||
errs)
|
||||
|
||||
@ -270,7 +270,7 @@ func getGC(ctx context.Context) (account.Account, *connector.GraphConnector, err
|
||||
// TODO: log/print recoverable errors
|
||||
errs := fault.New(false)
|
||||
|
||||
gc, err := connector.NewGraphConnector(ctx, graph.HTTPClient(graph.NoTimeout()), acct, connector.Users, errs)
|
||||
gc, err := connector.NewGraphConnector(ctx, acct, connector.Users, errs)
|
||||
if err != nil {
|
||||
return account.Account{}, nil, Only(ctx, clues.Wrap(err, "connecting to graph api"))
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ func (suite *DataCollectionIntgSuite) TestExchangeDataCollection() {
|
||||
|
||||
selUsers := []string{suite.user}
|
||||
|
||||
connector := loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Users)
|
||||
connector := loadConnector(ctx, suite.T(), Users)
|
||||
tests := []struct {
|
||||
name string
|
||||
getSelector func(t *testing.T) selectors.Selector
|
||||
@ -141,7 +141,7 @@ func (suite *DataCollectionIntgSuite) TestDataCollections_invalidResourceOwner()
|
||||
|
||||
owners := []string{"snuffleupagus"}
|
||||
|
||||
connector := loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Users)
|
||||
connector := loadConnector(ctx, suite.T(), Users)
|
||||
tests := []struct {
|
||||
name string
|
||||
getSelector func(t *testing.T) selectors.Selector
|
||||
@ -226,7 +226,7 @@ func (suite *DataCollectionIntgSuite) TestSharePointDataCollection() {
|
||||
|
||||
selSites := []string{suite.site}
|
||||
|
||||
connector := loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Sites)
|
||||
connector := loadConnector(ctx, suite.T(), Sites)
|
||||
tests := []struct {
|
||||
name string
|
||||
expected int
|
||||
@ -315,7 +315,7 @@ func (suite *SPCollectionIntgSuite) SetupSuite() {
|
||||
ctx, flush := tester.NewContext()
|
||||
defer flush()
|
||||
|
||||
suite.connector = loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Sites)
|
||||
suite.connector = loadConnector(ctx, suite.T(), Sites)
|
||||
suite.user = tester.M365UserID(suite.T())
|
||||
|
||||
tester.LogTimeOfTest(suite.T())
|
||||
@ -328,7 +328,7 @@ func (suite *SPCollectionIntgSuite) TestCreateSharePointCollection_Libraries() {
|
||||
var (
|
||||
t = suite.T()
|
||||
siteID = tester.M365SiteID(t)
|
||||
gc = loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), Sites)
|
||||
gc = loadConnector(ctx, t, Sites)
|
||||
siteIDs = []string{siteID}
|
||||
)
|
||||
|
||||
@ -372,7 +372,7 @@ func (suite *SPCollectionIntgSuite) TestCreateSharePointCollection_Lists() {
|
||||
var (
|
||||
t = suite.T()
|
||||
siteID = tester.M365SiteID(t)
|
||||
gc = loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), Sites)
|
||||
gc = loadConnector(ctx, t, Sites)
|
||||
siteIDs = []string{siteID}
|
||||
)
|
||||
|
||||
|
||||
@ -58,7 +58,6 @@ type GraphConnector struct {
|
||||
|
||||
func NewGraphConnector(
|
||||
ctx context.Context,
|
||||
itemClient *http.Client,
|
||||
acct account.Account,
|
||||
r resource,
|
||||
errs *fault.Bus,
|
||||
@ -89,7 +88,7 @@ func NewGraphConnector(
|
||||
Service: service,
|
||||
|
||||
credentials: creds,
|
||||
itemClient: itemClient,
|
||||
itemClient: graph.HTTPClient(graph.NoTimeout()),
|
||||
ownerLookup: rc,
|
||||
tenant: acct.ID(),
|
||||
wg: &sync.WaitGroup{},
|
||||
|
||||
@ -5,7 +5,6 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"net/http"
|
||||
"reflect"
|
||||
"strings"
|
||||
"testing"
|
||||
@ -1284,10 +1283,10 @@ func getSelectorWith(
|
||||
}
|
||||
}
|
||||
|
||||
func loadConnector(ctx context.Context, t *testing.T, itemClient *http.Client, r resource) *GraphConnector {
|
||||
func loadConnector(ctx context.Context, t *testing.T, r resource) *GraphConnector {
|
||||
a := tester.NewM365Account(t)
|
||||
|
||||
connector, err := NewGraphConnector(ctx, itemClient, a, r, fault.New(true))
|
||||
connector, err := NewGraphConnector(ctx, a, r, fault.New(true))
|
||||
require.NoError(t, err, clues.ToCore(err))
|
||||
|
||||
return connector
|
||||
|
||||
@ -445,7 +445,7 @@ func (suite *GraphConnectorSharePointIntegrationSuite) SetupSuite() {
|
||||
defer flush()
|
||||
|
||||
si := suiteInfoImpl{
|
||||
connector: loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Sites),
|
||||
connector: loadConnector(ctx, suite.T(), Sites),
|
||||
user: tester.M365UserID(suite.T()),
|
||||
secondaryUser: tester.SecondaryM365UserID(suite.T()),
|
||||
acct: tester.NewM365Account(suite.T()),
|
||||
@ -492,7 +492,7 @@ func (suite *GraphConnectorOneDriveIntegrationSuite) SetupSuite() {
|
||||
defer flush()
|
||||
|
||||
si := suiteInfoImpl{
|
||||
connector: loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Users),
|
||||
connector: loadConnector(ctx, suite.T(), Users),
|
||||
user: tester.M365UserID(suite.T()),
|
||||
secondaryUser: tester.SecondaryM365UserID(suite.T()),
|
||||
acct: tester.NewM365Account(suite.T()),
|
||||
@ -551,7 +551,7 @@ func (suite *GraphConnectorOneDriveNightlySuite) SetupSuite() {
|
||||
defer flush()
|
||||
|
||||
si := suiteInfoImpl{
|
||||
connector: loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Users),
|
||||
connector: loadConnector(ctx, suite.T(), Users),
|
||||
user: tester.M365UserID(suite.T()),
|
||||
secondaryUser: tester.SecondaryM365UserID(suite.T()),
|
||||
acct: tester.NewM365Account(suite.T()),
|
||||
|
||||
@ -15,7 +15,6 @@ import (
|
||||
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
exchMock "github.com/alcionai/corso/src/internal/connector/exchange/mock"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/mock"
|
||||
"github.com/alcionai/corso/src/internal/connector/support"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
@ -312,7 +311,7 @@ func (suite *GraphConnectorIntegrationSuite) SetupSuite() {
|
||||
ctx, flush := tester.NewContext()
|
||||
defer flush()
|
||||
|
||||
suite.connector = loadConnector(ctx, suite.T(), graph.HTTPClient(graph.NoTimeout()), Users)
|
||||
suite.connector = loadConnector(ctx, suite.T(), Users)
|
||||
suite.user = tester.M365UserID(suite.T())
|
||||
suite.secondaryUser = tester.SecondaryM365UserID(suite.T())
|
||||
suite.acct = tester.NewM365Account(suite.T())
|
||||
@ -490,7 +489,7 @@ func runRestore(
|
||||
|
||||
start := time.Now()
|
||||
|
||||
restoreGC := loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), config.resource)
|
||||
restoreGC := loadConnector(ctx, t, config.resource)
|
||||
restoreSel := getSelectorWith(t, config.service, config.resourceOwners, true)
|
||||
deets, err := restoreGC.ConsumeRestoreCollections(
|
||||
ctx,
|
||||
@ -552,7 +551,7 @@ func runBackupAndCompare(
|
||||
nameToID[ro] = ro
|
||||
}
|
||||
|
||||
backupGC := loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), config.resource)
|
||||
backupGC := loadConnector(ctx, t, config.resource)
|
||||
backupGC.IDNameLookup = common.IDsNames{IDToName: idToName, NameToID: nameToID}
|
||||
|
||||
backupSel := backupSelectorForExpected(t, config.service, expectedDests)
|
||||
@ -1066,7 +1065,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
||||
dest.ContainerName,
|
||||
)
|
||||
|
||||
restoreGC := loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), test.resource)
|
||||
restoreGC := loadConnector(ctx, t, test.resource)
|
||||
deets, err := restoreGC.ConsumeRestoreCollections(
|
||||
ctx,
|
||||
version.Backup,
|
||||
@ -1095,7 +1094,7 @@ func (suite *GraphConnectorIntegrationSuite) TestMultiFolderBackupDifferentNames
|
||||
|
||||
// Run a backup and compare its output with what we put in.
|
||||
|
||||
backupGC := loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), test.resource)
|
||||
backupGC := loadConnector(ctx, t, test.resource)
|
||||
backupSel := backupSelectorForExpected(t, test.service, expectedDests)
|
||||
t.Log("Selective backup of", backupSel)
|
||||
|
||||
@ -1246,7 +1245,7 @@ func (suite *GraphConnectorIntegrationSuite) TestBackup_CreatesPrefixCollections
|
||||
|
||||
var (
|
||||
t = suite.T()
|
||||
backupGC = loadConnector(ctx, t, graph.HTTPClient(graph.NoTimeout()), test.resource)
|
||||
backupGC = loadConnector(ctx, t, test.resource)
|
||||
backupSel = test.selectorFunc(t)
|
||||
errs = fault.New(true)
|
||||
start = time.Now()
|
||||
|
||||
@ -115,7 +115,6 @@ func prepNewTestBackupOp(
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
acct,
|
||||
connectorResource,
|
||||
fault.New(true))
|
||||
@ -750,7 +749,6 @@ func (suite *BackupOpIntegrationSuite) TestBackup_Run_exchangeIncrementals() {
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
acct,
|
||||
connector.Users,
|
||||
fault.New(true))
|
||||
@ -1203,7 +1201,6 @@ func (suite *BackupOpIntegrationSuite) TestBackup_Run_oneDriveIncrementals() {
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
acct,
|
||||
connector.Users,
|
||||
fault.New(true))
|
||||
|
||||
@ -273,7 +273,6 @@ func setupExchangeBackup(
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
acct,
|
||||
connector.Users,
|
||||
fault.New(true))
|
||||
@ -335,7 +334,6 @@ func setupSharePointBackup(
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
acct,
|
||||
connector.Sites,
|
||||
fault.New(true))
|
||||
@ -493,7 +491,6 @@ func (suite *RestoreOpIntegrationSuite) TestRestore_Run_errorNoResults() {
|
||||
|
||||
gc, err := connector.NewGraphConnector(
|
||||
ctx,
|
||||
graph.HTTPClient(graph.NoTimeout()),
|
||||
suite.acct,
|
||||
connector.Users,
|
||||
fault.New(true))
|
||||
|
||||
@ -11,7 +11,6 @@ import (
|
||||
"github.com/alcionai/corso/src/internal/common"
|
||||
"github.com/alcionai/corso/src/internal/common/crash"
|
||||
"github.com/alcionai/corso/src/internal/connector"
|
||||
"github.com/alcionai/corso/src/internal/connector/graph"
|
||||
"github.com/alcionai/corso/src/internal/connector/onedrive"
|
||||
"github.com/alcionai/corso/src/internal/data"
|
||||
"github.com/alcionai/corso/src/internal/events"
|
||||
@ -643,7 +642,7 @@ func connectToM365(
|
||||
resource = connector.Sites
|
||||
}
|
||||
|
||||
gc, err := connector.NewGraphConnector(ctx, graph.HTTPClient(graph.NoTimeout()), acct, resource, errs)
|
||||
gc, err := connector.NewGraphConnector(ctx, acct, resource, errs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user