Skip to content

Commit 5c87591

Browse files
committed
Add e2e tests
1 parent 1f19312 commit 5c87591

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

test/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
| `streams instance log` | Y | Y |
196196
| `streams privateLink` | | |
197197
| `streams privateLink create` | Y | Y |
198+
| `streams privateLink describe` | Y | Y |
198199
| `config` | | |
199200
| `completion` | Y | Y |
200201
| `config delete` | Y | Y |

test/e2e/atlas/streams_test.go

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ func TestStreams(t *testing.T) {
196196
})
197197

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

218219
a := assert.New(t)
219-
a.Equal("Azure", *privateLinkEndpoint.Provider)
220-
a.Equal("US_EAST_2", *privateLinkEndpoint.Region)
221-
a.Equal("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace", *privateLinkEndpoint.ServiceEndpointId)
222-
a.Equal("test-namespace.servicebus.windows.net", *privateLinkEndpoint.DnsDomain)
220+
a.Equal("Azure", privateLinkEndpoint.GetProvider())
221+
a.Equal("US_EAST_2", privateLinkEndpoint.GetRegion())
222+
a.Equal("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace", privateLinkEndpoint.GetServiceEndpointId())
223+
a.Equal("test-namespace.servicebus.windows.net", privateLinkEndpoint.GetDnsDomain())
224+
225+
// Assign the endpoint ID so that it can be used in subsequent tests
226+
endpointID = privateLinkEndpoint.GetId()
227+
})
228+
229+
t.Run("Describing a streams privateLink endpoint", func(t *testing.T) {
230+
streamsCmd := exec.Command(cliPath,
231+
"streams",
232+
"privateLink",
233+
"describe",
234+
endpointID,
235+
"-o=json",
236+
"--projectId",
237+
g.projectID,
238+
)
239+
240+
streamsCmd.Env = os.Environ()
241+
streamsResp, err := e2e.RunAndGetStdOut(streamsCmd)
242+
req.NoError(err, string(streamsResp))
243+
244+
var privateLinkEndpoint atlasv2.StreamsPrivateLinkConnection
245+
req.NoError(json.Unmarshal(streamsResp, &privateLinkEndpoint))
246+
247+
a := assert.New(t)
248+
a.Equal(endpointID, privateLinkEndpoint.GetId())
249+
a.Equal("Azure", privateLinkEndpoint.GetProvider())
250+
a.Equal("US_EAST_2", privateLinkEndpoint.GetRegion())
251+
a.Equal("/subscriptions/fd01adff-b37e-4693-8497-83ecf183a145/resourceGroups/test-rg/providers/Microsoft.EventHub/namespaces/test-namespace", privateLinkEndpoint.GetServiceEndpointId())
252+
a.Equal("test-namespace.servicebus.windows.net", privateLinkEndpoint.GetDnsDomain())
223253
})
224254

225255
// Connections

0 commit comments

Comments
 (0)