Creates hidden CLI command to run maintenance. Flag names and descriptions can be updated if something else would fit better --- #### Does this PR need a docs update or release note? - [ ] ✅ Yes, it's included - [ ] 🕐 Yes, but in a later PR - [ ] ⛔ No #### Type of change - [x] 🌻 Feature - [ ] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Supportability/Tests - [ ] 💻 CI/Deployment - [ ] 🧹 Tech Debt/Cleanup #### Issue(s) * #3077 #### Test Plan - [x] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
42 lines
757 B
Go
42 lines
757 B
Go
package repo
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/spf13/cobra"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/alcionai/corso/src/internal/tester"
|
|
)
|
|
|
|
type RepoUnitSuite struct {
|
|
tester.Suite
|
|
}
|
|
|
|
func TestRepoUnitSuite(t *testing.T) {
|
|
suite.Run(t, &RepoUnitSuite{Suite: tester.NewUnitSuite(t)})
|
|
}
|
|
|
|
func (suite *RepoUnitSuite) TestAddRepoCommands() {
|
|
t := suite.T()
|
|
cmd := &cobra.Command{}
|
|
|
|
AddCommands(cmd)
|
|
|
|
var found bool
|
|
|
|
// This is the repo command.
|
|
repoCmds := cmd.Commands()
|
|
require.Len(t, repoCmds, 1)
|
|
|
|
for _, c := range repoCmds[0].Commands() {
|
|
if c.Use == maintenanceCommand {
|
|
found = true
|
|
}
|
|
}
|
|
|
|
assert.True(t, found, "looking for maintenance command")
|
|
}
|