@@ -221,7 +221,7 @@ func TestProcesses_RetrievePageByNumber(t *testing.T) {
221221 }
222222 `
223223
224- mux .HandleFunc ("/api/atlas/v1.0/groups/1 /processes" , func (w http.ResponseWriter , r * http.Request ) {
224+ mux .HandleFunc (fmt . Sprintf ( "/api/atlas/v1.0/groups/%s /processes" , groupID ) , func (w http.ResponseWriter , r * http.Request ) {
225225 testMethod (t , r , http .MethodGet )
226226 expectedQuery := "pageNum=2"
227227 if r .URL .RawQuery != expectedQuery {
@@ -240,3 +240,48 @@ func TestProcesses_RetrievePageByNumber(t *testing.T) {
240240
241241 checkCurrentPage (t , resp , 2 )
242242}
243+
244+ func TestProcessesServiceOp_Get (t * testing.T ) {
245+ client , mux , teardown := setup ()
246+ defer teardown ()
247+ const hostname = "atlas-abcdef-shard-00-00.nta8e.mongodb.net"
248+ const port = 27017
249+ path := fmt .Sprintf ("/api/atlas/v1.0/groups/%s/processes/%s:%d" , groupID , hostname , port )
250+ mux .HandleFunc (path , func (w http.ResponseWriter , r * http.Request ) {
251+ testMethod (t , r , http .MethodGet )
252+ _ , _ = fmt .Fprint (w , `{
253+ "created" : "2020-08-25T18:44:13Z",
254+ "groupId" : "1",
255+ "hostname" : "atlas-abcdef-shard-00-00.nta8e.mongodb.net",
256+ "id" : "atlas-abcdef-shard-00-00.nta8e.mongodb.net:27017",
257+ "lastPing" : "2020-09-01T18:40:06Z",
258+ "port" : 27017,
259+ "replicaSetName" : "atlas-abcdef-shard-0",
260+ "typeName" : "REPLICA_PRIMARY",
261+ "userAlias" : "testcluster-shard-00-00.nta8e.mongodb.net",
262+ "version" : "4.4.0"
263+ }` )
264+ })
265+
266+ cluster , _ , err := client .Processes .Get (ctx , groupID , hostname , port )
267+ if err != nil {
268+ t .Fatalf ("Processes.Get returned error: %v" , err )
269+ }
270+
271+ expected := & Process {
272+ ID : "atlas-abcdef-shard-00-00.nta8e.mongodb.net:27017" ,
273+ GroupID : groupID ,
274+ Hostname : hostname ,
275+ TypeName : "REPLICA_PRIMARY" ,
276+ Created : "2020-08-25T18:44:13Z" ,
277+ LastPing : "2020-09-01T18:40:06Z" ,
278+ Port : port ,
279+ ReplicaSetName : "atlas-abcdef-shard-0" ,
280+ UserAlias : "testcluster-shard-00-00.nta8e.mongodb.net" ,
281+ Version : "4.4.0" ,
282+ }
283+
284+ if diff := deep .Equal (cluster , expected ); diff != nil {
285+ t .Error (diff )
286+ }
287+ }
0 commit comments