@@ -28,6 +28,7 @@ import (
28
28
agents "github.com/percona/pmm/api/inventory/v1/json/client/agents_service"
29
29
nodes "github.com/percona/pmm/api/inventory/v1/json/client/nodes_service"
30
30
services "github.com/percona/pmm/api/inventory/v1/json/client/services_service"
31
+ "github.com/percona/pmm/api/inventory/v1/types"
31
32
"github.com/percona/pmm/api/management/v1/json/client"
32
33
mservice "github.com/percona/pmm/api/management/v1/json/client/management_service"
33
34
)
@@ -428,11 +429,9 @@ func TestRemoveExternal(t *testing.T) {
428
429
defer pmmapitests .RemoveNodes (t , nodeID )
429
430
430
431
removeServiceOK , err := client .Default .ManagementService .RemoveService (& mservice.RemoveServiceParams {
431
- Body : mservice.RemoveServiceBody {
432
- ServiceName : serviceName ,
433
- ServiceType : pointer .ToString (mservice .RemoveServiceBodyServiceTypeSERVICETYPEEXTERNALSERVICE ),
434
- },
435
- Context : pmmapitests .Context ,
432
+ ServiceID : serviceName ,
433
+ ServiceType : pointer .ToString (types .ServiceTypeExternalService ),
434
+ Context : pmmapitests .Context ,
436
435
})
437
436
noError := assert .NoError (t , err )
438
437
notNil := assert .NotNil (t , removeServiceOK )
@@ -456,11 +455,9 @@ func TestRemoveExternal(t *testing.T) {
456
455
defer pmmapitests .RemoveNodes (t , nodeID )
457
456
458
457
removeServiceOK , err := client .Default .ManagementService .RemoveService (& mservice.RemoveServiceParams {
459
- Body : mservice.RemoveServiceBody {
460
- ServiceID : serviceID ,
461
- ServiceType : pointer .ToString (mservice .RemoveServiceBodyServiceTypeSERVICETYPEEXTERNALSERVICE ),
462
- },
463
- Context : pmmapitests .Context ,
458
+ ServiceID : serviceID ,
459
+ ServiceType : pointer .ToString (types .ServiceTypeExternalService ),
460
+ Context : pmmapitests .Context ,
464
461
})
465
462
noError := assert .NoError (t , err )
466
463
notNil := assert .NotNil (t , removeServiceOK )
@@ -477,25 +474,6 @@ func TestRemoveExternal(t *testing.T) {
477
474
assert .Nil (t , listAgents )
478
475
})
479
476
480
- t .Run ("Both params" , func (t * testing.T ) {
481
- serviceName := pmmapitests .TestString (t , "service-remove-both-params" )
482
- nodeName := pmmapitests .TestString (t , "node-remove-both-params" )
483
- nodeID , serviceID := addExternal (t , serviceName , nodeName )
484
- defer pmmapitests .RemoveNodes (t , nodeID )
485
- defer pmmapitests .RemoveServices (t , serviceID )
486
-
487
- removeServiceOK , err := client .Default .ManagementService .RemoveService (& mservice.RemoveServiceParams {
488
- Body : mservice.RemoveServiceBody {
489
- ServiceID : serviceID ,
490
- ServiceName : serviceName ,
491
- ServiceType : pointer .ToString (mservice .RemoveServiceBodyServiceTypeSERVICETYPEEXTERNALSERVICE ),
492
- },
493
- Context : pmmapitests .Context ,
494
- })
495
- assert .Nil (t , removeServiceOK )
496
- pmmapitests .AssertAPIErrorf (t , err , 400 , codes .InvalidArgument , "service_id or service_name expected; not both" )
497
- })
498
-
499
477
t .Run ("Wrong type" , func (t * testing.T ) {
500
478
serviceName := pmmapitests .TestString (t , "service-remove-wrong-type" )
501
479
nodeName := pmmapitests .TestString (t , "node-remove-wrong-type" )
@@ -504,19 +482,16 @@ func TestRemoveExternal(t *testing.T) {
504
482
defer pmmapitests .RemoveServices (t , serviceID )
505
483
506
484
removeServiceOK , err := client .Default .ManagementService .RemoveService (& mservice.RemoveServiceParams {
507
- Body : mservice.RemoveServiceBody {
508
- ServiceID : serviceID ,
509
- ServiceType : pointer .ToString (mservice .RemoveServiceBodyServiceTypeSERVICETYPEPOSTGRESQLSERVICE ),
510
- },
511
- Context : pmmapitests .Context ,
485
+ ServiceID : serviceID ,
486
+ ServiceType : pointer .ToString (types .ServiceTypePostgreSQLService ),
487
+ Context : pmmapitests .Context ,
512
488
})
513
489
assert .Nil (t , removeServiceOK )
514
490
pmmapitests .AssertAPIErrorf (t , err , 400 , codes .InvalidArgument , "wrong service type" )
515
491
})
516
492
517
493
t .Run ("No params" , func (t * testing.T ) {
518
494
removeServiceOK , err := client .Default .ManagementService .RemoveService (& mservice.RemoveServiceParams {
519
- Body : mservice.RemoveServiceBody {},
520
495
Context : pmmapitests .Context ,
521
496
})
522
497
assert .Nil (t , removeServiceOK )
0 commit comments