Skip to content

Commit c4cc9ff

Browse files
igor-karpukhinjosvazg
andauthoredOct 28, 2024
CLOUDP-280713: Remove data federation PE explicitly at e2e test (#1883)
* Remove data federation PE before deleting data federation * Fixed api call * Fixed api call * Remove data federation pe again * Undo irrelevant fixes * Fix without a sleep * Add link to pending bugfix * Move from a for to eventually with more than one success --------- Co-authored-by: jose.vazquez <jose.vazquez@mongodb.com>
1 parent 5f3c8cd commit c4cc9ff

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed
 

‎test/e2e/datafederation_pe_test.go

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ package e2e_test
22

33
import (
44
"context"
5+
"fmt"
6+
"net/http"
57
"time"
68

79
. "github.com/onsi/ginkgo/v2"
@@ -30,6 +32,7 @@ import (
3032
var _ = Describe("UserLogin", Label("datafederation"), func() {
3133
var testData *model.TestDataProvider
3234
var providerAction cloud.Provider
35+
var pe *cloud.PrivateEndpointDetails
3336

3437
_ = BeforeEach(OncePerOrdered, func() {
3538
checkUpAWSEnvironment()
@@ -66,7 +69,6 @@ var _ = Describe("UserLogin", Label("datafederation"), func() {
6669
})
6770

6871
It("Creates a data federation with private endpoint", func(ctx context.Context) {
69-
var pe *cloud.PrivateEndpointDetails
7072
const dataFederationInstanceName = "test-data-federation-aws"
7173

7274
//nolint:dupl
@@ -127,5 +129,20 @@ var _ = Describe("UserLogin", Label("datafederation"), func() {
127129
}, df)).To(Succeed())
128130
Expect(testData.K8SClient.Delete(testData.Context, df)).Should(Succeed())
129131
})
132+
133+
By("Deleting DataFederation Private Endpoint", func() {
134+
// This is required or will result on error:
135+
// CANNOT_CLOSE_GROUP_ACTIVE_ATLAS_DATA_FEDERATION_PRIVATE_ENDPOINTS
136+
// for some reason, requesting deletion successfully just once doesn't work
137+
// TODO: revisit and cleanup once CLOUDP-280905 is fixed
138+
Eventually(func(g Gomega) {
139+
_, resp, err := atlasClient.Client.DataFederationApi.
140+
DeleteDataFederationPrivateEndpoint(testData.Context, testData.Project.ID(), pe.ID).
141+
Execute()
142+
g.Expect(err).To(BeNil(), fmt.Sprintf("deletion of private endpoint failed with error %v", err))
143+
g.Expect(resp).NotTo(BeNil())
144+
g.Expect(resp.StatusCode).To(BeEquivalentTo(http.StatusNoContent))
145+
}).WithTimeout(5 * time.Minute).WithPolling(15 * time.Second).MustPassRepeatedly(2).Should(Succeed())
146+
})
130147
})
131148
})

0 commit comments

Comments
 (0)