-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CLOUDP-165325: Data Federation and private endpoint Atlas CLI Changes (…
…#2152) Signed-off-by: Jose Vazquez <[email protected]> Co-authored-by: Jose Vazquez <[email protected]> Co-authored-by: Igor Karpukhin <[email protected]>
- Loading branch information
1 parent
10f4043
commit c74dbb4
Showing
18 changed files
with
1,711 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// Copyright 2023 MongoDB Inc | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
//go:build unit | ||
|
||
package operator | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/go-test/deep" | ||
"github.com/golang/mock/gomock" | ||
"github.com/mongodb/mongodb-atlas-cli/internal/mocks" | ||
"github.com/mongodb/mongodb-atlas-cli/internal/pointer" | ||
"go.mongodb.org/atlas-sdk/v20230201004/admin" | ||
) | ||
|
||
const projectID = "TestProjectID" | ||
|
||
func Test_fetchDataFederationNames(t *testing.T) { | ||
ctl := gomock.NewController(t) | ||
atlasOperatorGenericStore := mocks.NewMockAtlasOperatorGenericStore(ctl) | ||
|
||
t.Run("Can fetch Data Federation Instance names", func(t *testing.T) { | ||
dataFederations := []admin.DataLakeTenant{ | ||
{ | ||
DataProcessRegion: &admin.DataLakeDataProcessRegion{ | ||
CloudProvider: "TestProvider", | ||
Region: "TestRegion", | ||
}, | ||
Name: pointer.Get("DataFederationInstance0"), | ||
State: pointer.Get("TestState"), | ||
Storage: &admin.DataLakeStorage{ | ||
Databases: nil, | ||
Stores: nil, | ||
}, | ||
}, | ||
{ | ||
DataProcessRegion: &admin.DataLakeDataProcessRegion{ | ||
CloudProvider: "TestProvider", | ||
Region: "TestRegion", | ||
}, | ||
Name: pointer.Get("DataFederationInstance1"), | ||
State: pointer.Get("TestState"), | ||
Storage: &admin.DataLakeStorage{ | ||
Databases: nil, | ||
Stores: nil, | ||
}, | ||
}, | ||
{ | ||
DataProcessRegion: &admin.DataLakeDataProcessRegion{ | ||
CloudProvider: "TestProvider", | ||
Region: "TestRegion", | ||
}, | ||
Name: pointer.Get("DataFederationInstance2"), | ||
State: pointer.Get("TestState"), | ||
Storage: &admin.DataLakeStorage{ | ||
Databases: nil, | ||
Stores: nil, | ||
}, | ||
}, | ||
} | ||
|
||
atlasOperatorGenericStore.EXPECT().DataFederationList(projectID).Return(dataFederations, nil) | ||
expected := []string{"DataFederationInstance0", "DataFederationInstance1", "DataFederationInstance2"} | ||
ce := NewConfigExporter( | ||
atlasOperatorGenericStore, | ||
nil, // credsProvider (not used) | ||
projectID, "", // orgID (not used) | ||
) | ||
got, err := ce.fetchDataFederationNames() | ||
if err != nil { | ||
t.Fatalf("%v", err) | ||
} | ||
|
||
if diff := deep.Equal(got, expected); diff != nil { | ||
t.Error(diff) | ||
} | ||
}) | ||
} |
Oops, something went wrong.