Not sure if we wanna merge it as it might generate way too many conflicts, but this should help us add a linter in CI. If we are good, I'll add something that can do lints for this in a follow up PR.
Super hacky, but this fix was created using `while true ; do tree-grepper -q go '(argument_list "," @nope .)' | tail -n1| awk -F: "{print \$1,\"+\"\$2\" -c ':norm \$xJZZ'\"}" | xargs vim ; done`.
---
#### Does this PR need a docs update or release note?
- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [ ] ⛔ No
#### Type of change
<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Supportability/Tests
- [ ] 💻 CI/Deployment
- [ ] 🧹 Tech Debt/Cleanup
#### Issue(s)
<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* https://github.com/alcionai/corso/issues/3654
#### Test Plan
<!-- How will this be tested prior to merging.-->
- [ ] 💪 Manual
- [ ] ⚡ Unit test
- [ ] 💚 E2E
67 lines
1.5 KiB
Go
67 lines
1.5 KiB
Go
package events_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/alcionai/clues"
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/alcionai/corso/src/internal/events"
|
|
"github.com/alcionai/corso/src/internal/tester"
|
|
"github.com/alcionai/corso/src/pkg/account"
|
|
"github.com/alcionai/corso/src/pkg/control"
|
|
"github.com/alcionai/corso/src/pkg/credentials"
|
|
"github.com/alcionai/corso/src/pkg/storage"
|
|
)
|
|
|
|
type EventsIntegrationSuite struct {
|
|
tester.Suite
|
|
}
|
|
|
|
func TestMetricsIntegrationSuite(t *testing.T) {
|
|
suite.Run(t, &EventsIntegrationSuite{
|
|
Suite: tester.NewIntegrationSuite(t, nil),
|
|
})
|
|
}
|
|
|
|
func (suite *EventsIntegrationSuite) TestNewBus() {
|
|
t := suite.T()
|
|
|
|
ctx, flush := tester.NewContext(t)
|
|
defer flush()
|
|
|
|
s, err := storage.NewStorage(
|
|
storage.ProviderS3,
|
|
storage.S3Config{
|
|
Bucket: "bckt",
|
|
Prefix: "prfx",
|
|
})
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
a, err := account.NewAccount(
|
|
account.ProviderM365,
|
|
account.M365Config{
|
|
M365: credentials.M365{
|
|
AzureClientID: "id",
|
|
AzureClientSecret: "secret",
|
|
},
|
|
AzureTenantID: "tid",
|
|
})
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
b, err := events.NewBus(ctx, s, a.ID(), control.DefaultOptions())
|
|
require.NotEmpty(t, b)
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
err = b.Close()
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
b2, err := events.NewBus(ctx, s, a.ID(), control.Options{DisableMetrics: true})
|
|
require.Empty(t, b2)
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
|
|
err = b2.Close()
|
|
require.NoError(t, err, clues.ToCore(err))
|
|
}
|