Skip to content

Commit

Permalink
Add e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tcannon91 committed Feb 13, 2025
1 parent 1f19312 commit 5c87591
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 4 deletions.
1 change: 1 addition & 0 deletions test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
| `streams instance log` | Y | Y |
| `streams privateLink` | | |
| `streams privateLink create` | Y | Y |
| `streams privateLink describe` | Y | Y |
| `config` | | |
| `completion` | Y | Y |
| `config delete` | Y | Y |
Expand Down
38 changes: 34 additions & 4 deletions test/e2e/atlas/streams_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func TestStreams(t *testing.T) {
})

// Endpoints
var endpointID string
t.Run("Creating a streams privateLink endpoint", func(t *testing.T) {
streamsCmd := exec.Command(cliPath,
"streams",
Expand All @@ -216,10 +217,39 @@ func TestStreams(t *testing.T) {
req.NoError(json.Unmarshal(streamsResp, &privateLinkEndpoint))

a := assert.New(t)
a.Equal("Azure", *privateLinkEndpoint.Provider)
a.Equal("US_EAST_2", *privateLinkEndpoint.Region)
a.Equal("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace", *privateLinkEndpoint.ServiceEndpointId)
a.Equal("test-namespace.servicebus.windows.net", *privateLinkEndpoint.DnsDomain)
a.Equal("Azure", privateLinkEndpoint.GetProvider())
a.Equal("US_EAST_2", privateLinkEndpoint.GetRegion())
a.Equal("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace", privateLinkEndpoint.GetServiceEndpointId())
a.Equal("test-namespace.servicebus.windows.net", privateLinkEndpoint.GetDnsDomain())

// Assign the endpoint ID so that it can be used in subsequent tests
endpointID = privateLinkEndpoint.GetId()
})

t.Run("Describing a streams privateLink endpoint", func(t *testing.T) {
streamsCmd := exec.Command(cliPath,
"streams",
"privateLink",
"describe",
endpointID,
"-o=json",
"--projectId",
g.projectID,
)

streamsCmd.Env = os.Environ()
streamsResp, err := e2e.RunAndGetStdOut(streamsCmd)
req.NoError(err, string(streamsResp))

var privateLinkEndpoint atlasv2.StreamsPrivateLinkConnection
req.NoError(json.Unmarshal(streamsResp, &privateLinkEndpoint))

a := assert.New(t)
a.Equal(endpointID, privateLinkEndpoint.GetId())
a.Equal("Azure", privateLinkEndpoint.GetProvider())
a.Equal("US_EAST_2", privateLinkEndpoint.GetRegion())
a.Equal("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace", privateLinkEndpoint.GetServiceEndpointId())
a.Equal("test-namespace.servicebus.windows.net", privateLinkEndpoint.GetDnsDomain())
})

// Connections
Expand Down

0 comments on commit 5c87591

Please sign in to comment.