Skip to content

Commit ab47902

Browse files
committed
moar
1 parent cf633ac commit ab47902

File tree

111 files changed

+2540
-1726
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

111 files changed

+2540
-1726
lines changed

internal/cli/clusters/indexes/create.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@ import (
3131
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
3232
)
3333

34+
//go:generate mockgen -typed -destination=create_mock_test.go -package=indexes . IndexCreator
35+
36+
type IndexCreator interface {
37+
CreateIndex(string, string, *atlasv2.DatabaseRollingIndexRequest) error
38+
}
39+
3440
type CreateOpts struct {
3541
cli.ProjectOpts
3642
clusterName string
@@ -40,7 +46,7 @@ type CreateOpts struct {
4046
filename string
4147
keys []string
4248
sparse bool
43-
store store.IndexCreator
49+
store IndexCreator
4450
fs afero.Fs
4551
}
4652

internal/mocks/mock_indexes.go renamed to internal/cli/clusters/indexes/create_mock_test.go

+30-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cli/clusters/indexes/create_test.go

+2-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,13 @@ package indexes
1919
import (
2020
"testing"
2121

22-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks"
2322
"github.com/spf13/afero"
2423
"go.uber.org/mock/gomock"
2524
)
2625

2726
func TestCreate_Run(t *testing.T) {
2827
ctrl := gomock.NewController(t)
29-
mockStore := mocks.NewMockIndexCreator(ctrl)
28+
mockStore := NewMockIndexCreator(ctrl)
3029

3130
createOpts := &CreateOpts{
3231
name: "ProjectBar",
@@ -51,7 +50,7 @@ func TestCreate_Run(t *testing.T) {
5150

5251
func TestCreateWithFile_Run(t *testing.T) {
5352
ctrl := gomock.NewController(t)
54-
mockStore := mocks.NewMockIndexCreator(ctrl)
53+
mockStore := NewMockIndexCreator(ctrl)
5554
appFS := afero.NewMemMapFs()
5655
fileJSON := `
5756
{

internal/cli/federatedauthentication/federationsettings/describe.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,16 @@ const describeTemplate = `ID IDENTITY PROVIDER ID IDENTITY PROVIDER STATUS
3131
{{.Id}} {{.IdentityProviderId}} {{.IdentityProviderStatus}}
3232
`
3333

34+
//go:generate mockgen -typed -destination=describe_mock_test.go -package=federationsettings . Describer
35+
36+
type Describer interface {
37+
FederationSetting(opts *atlasv2.GetFederationSettingsApiParams) (*atlasv2.OrgFederationSettings, error)
38+
}
39+
3440
type DescribeOpts struct {
3541
cli.OrgOpts
3642
cli.OutputOpts
37-
store store.FederationSettingsDescriber
43+
store Describer
3844
}
3945

4046
func (opts *DescribeOpts) initStore(ctx context.Context) func() error {

internal/cli/federatedauthentication/federationsettings/describe_mock_test.go

+80
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cli/federatedauthentication/federationsettings/describe_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,14 @@ import (
2121
"testing"
2222

2323
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/cli"
24-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks"
2524
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test"
2625
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
2726
"go.uber.org/mock/gomock"
2827
)
2928

3029
func TestDescribe_Run(t *testing.T) {
3130
ctrl := gomock.NewController(t)
32-
mockStore := mocks.NewMockFederationSettingsDescriber(ctrl)
31+
mockStore := NewMockDescriber(ctrl)
3332

3433
buf := new(bytes.Buffer)
3534
describeOpts := &DescribeOpts{

internal/cli/metrics/databases/list.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,22 @@ import (
2424
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/store"
2525
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/usage"
2626
"github.com/spf13/cobra"
27+
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
2728
)
2829

30+
//go:generate mockgen -typed -destination=list_mock_test.go -package=databases . ProcessDatabaseLister
31+
32+
type ProcessDatabaseLister interface {
33+
ProcessDatabases(string, string, int, *store.ListOptions) (*atlasv2.PaginatedDatabase, error)
34+
}
35+
2936
type ListsOpts struct {
3037
cli.ProjectOpts
3138
cli.OutputOpts
3239
cli.ListOpts
3340
host string
3441
port int
35-
store store.ProcessDatabaseLister
42+
store ProcessDatabaseLister
3643
}
3744

3845
func (opts *ListsOpts) initStore(ctx context.Context) func() error {

internal/mocks/mock_process_databases.go renamed to internal/cli/metrics/databases/list_mock_test.go

+30-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/cli/metrics/databases/list_test.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ package databases
1919
import (
2020
"testing"
2121

22-
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/mocks"
2322
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/pointer"
2423
"github.com/mongodb/mongodb-atlas-cli/atlascli/internal/test"
2524
atlasv2 "go.mongodb.org/atlas-sdk/v20250312002/admin"
@@ -28,7 +27,7 @@ import (
2827

2928
func TestDatabasesListsOpts_Run(t *testing.T) {
3029
ctrl := gomock.NewController(t)
31-
mockStore := mocks.NewMockProcessDatabaseLister(ctrl)
30+
mockStore := NewMockProcessDatabaseLister(ctrl)
3231

3332
expected := &atlasv2.PaginatedDatabase{
3433
Results: &[]atlasv2.MesurementsDatabase{

internal/cli/organizations/apikeys/accesslists/create.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,20 @@ import (
3030

3131
const createTemplate = "Created new access list entry(s).\n"
3232

33+
//go:generate mockgen -typed -destination=create_mock_test.go -package=accesslists . OrganizationAPIKeyAccessListCreator
34+
35+
type OrganizationAPIKeyAccessListCreator interface {
36+
CreateOrganizationAPIKeyAccessList(*admin.CreateApiKeyAccessListApiParams) (*admin.PaginatedApiUserAccessListResponse, error)
37+
}
38+
3339
type CreateOpts struct {
3440
cli.OrgOpts
3541
cli.OutputOpts
3642
apyKey string
3743
ips []string
3844
cidrs []string
3945
currentIP bool
40-
store store.OrganizationAPIKeyAccessListCreator
46+
store OrganizationAPIKeyAccessListCreator
4147
}
4248

4349
func (opts *CreateOpts) initStore(ctx context.Context) func() error {

0 commit comments

Comments
 (0)