Commit aa31d746 authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

clean up based on get results for org, peering, fabrics and registries Task: #10

parent a94fad89
Loading
Loading
Loading
Loading
+3 −3
Changes for src/test/resources/env/staging.json: 3 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -5,7 +5,7 @@
	"values": [
		{
			"key": "host",
			"value": "192.168.5.223",
			"value": "192.168.5.225",
			"type": "default", 
			"enabled": true
		},
@@ -59,7 +59,7 @@
		},
		{
			"key": "host-keycloak",
			"value": "192.168.5.223",
			"value": "192.168.5.225",
			"type": "default",
			"enabled": true
		},
@@ -83,7 +83,7 @@
		},
		{
			"key": "host-vault",
			"value": "192.168.5.223",
			"value": "192.168.5.225",
			"type": "default",
			"enabled": true
		},
+46 −3
Changes for src/test/resources/hypo/cleanUp.feature: 46 added lines, 3 removed lines.
Original line number Diff line number Diff line
Feature: Full clean up of test resources

# Standalone, reusable clean up. Call it from anywhere, e.g.:
#   karate.call('classpath:hypo/cleanUp.feature@cleanUp', { auth_token: token, orgId: orgId })
# Every argument besides auth_token is optional - steps guarded by an unset var are skipped.
# Standalone, reusable clean up

Background:
  * def token = auth_token
@@ -55,3 +53,48 @@ Scenario: Delete services, orders, network, organization, peering, candidates, s

  * karate.call('classpath:hypo/deleteAll.feature@deleteRegistryPackage', { auth_token: token })
  * karate.call('classpath:hypo/deleteAll.feature@deleteRegistryImage', { auth_token: token })


@cleanupAll
Scenario: Delete all fetched organizations, controllers, peerings, and registries
* karate.log('--- STEP: CLEAN UP ALL ---')
* def deleteControllerFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteFabricNetwork', { token: token, networkControllerId: id });
  }
  """
  * karate.forEach(networkControllerIds, deleteControllerFn)


  * def deletePeeringFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deletePeeringbyId', { token: token, orgId: id });
  }
  """
  * karate.forEach(peeringIds, deletePeeringFn)

    * def deleteOrgFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteOrganizationbyId', { token: token, orgId: id });
  }
  """
  * karate.forEach(organizationIds, deleteOrgFn)

  * def deleteRegistryImageFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteRegistryImagebyId', { token: token, registryImageId: id });
  }
  """
  * karate.forEach(registryImageIds, deleteRegistryImageFn)

  * def deleteRegistryPackageFn =
  """
  function(id) {
    karate.call('classpath:hypo/deleteAll.feature@deleteRegistryPackagebyId', { token: token, registryPackageId: id });
  }
  """
  * karate.forEach(registryPackageIds, deleteRegistryPackageFn)
 No newline at end of file
+37
Changes for src/test/resources/hypo/deleteAll.feature: 37 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -95,6 +95,7 @@ Scenario: Delete Registry Package
  When method delete
  Then match [200, 204, 404] contains responseStatus

##### Functions to Delete by ID #########

@deleteFabricNetwork
Scenario: Delete Fabric Network Controller
@@ -104,3 +105,39 @@ Scenario: Delete Fabric Network Controller
  When method delete
  Then match [200, 204, 404] contains responseStatus


@deleteOrganizationbyId
Scenario: Delete organization
  Given url baseUrl
  And path 'tmf-api', 'party', V4, 'organization', orgId
  And header Authorization = 'Bearer ' + token
 
  When method delete
  Then match [200, 204, 404] contains responseStatus

@deletePeeringbyId
Scenario: Delete peering
  Given url peeringUrl
  And path 'peering-api', 'peering', orgId
  And header Authorization = 'Bearer ' + token
 
  When method delete
  Then match [200, 204, 404] contains responseStatus


@deleteRegistryImagebyId
Scenario: Delete Registry Image
  Given url registryUrl
  And path 'registry-api', 'image-pull', 'secret',  registryImageId
  And header Authorization = 'Bearer ' + token
  When method delete
  Then match [200, 204, 404] contains responseStatus


@deleteRegistryPackagebyId
Scenario: Delete Registry Package
  Given url registryUrl
  And path 'registry-api', 'package-registry', 'secret',  registryPackageId
  And header Authorization = 'Bearer ' + token
  When method delete
  Then match [200, 204, 404] contains responseStatus
 No newline at end of file
+31 −1
Changes for src/test/resources/hypo/fabric.feature: 31 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -111,7 +111,7 @@ Scenario: Poll Service Status and Delete on Failure Alt


@updateDomainIdentityResource
Scenario: Patch Domain Identity Resource with
Scenario: Patch Domain Identity Resource 
  * karate.log('--- STEP: UPDATE DOMAIN IDENTITY RESOURCE ---')

  * def updatedPayload = infra == 'ubi' ? read('classpath:payloads/fabric/domain-identity-resource.json') : read('classpath:payloads/fabric/domain-identity-resource-etsi.json')
@@ -139,3 +139,33 @@ Scenario: get Registry Image
  When method get
  * print 'Status returned:', responseStatus
  Then match [200, 201] contains responseStatus



@getControllers
Scenario: GET All Fabric Network Controllers
  * karate.log('--- STEP: GET ALL FABRIC NETWORK CONTROLLERS ---')

  Given url fabricUrl
  And path 'fabric-api', 'network', 'controller'
  And header Content-Type = 'application/json'
  And header Authorization = 'Bearer ' + token
  When method get

  * print 'Status returned:', responseStatus
  Then assert responseStatus == 200
  * def getControllerIds =
  """
  function(items) {
    var ids = [];
    for (var i = 0; i < items.length; i++) {
      var item = items[i];
      if (item.networkControllerId) {
        ids.push(item.networkControllerId);
      }
    }
    return ids;
  }
  """
  * def networkControllerIds = getControllerIds(response)
  * print 'Network Controller IDs:', networkControllerIds
 No newline at end of file
+16
Changes for src/test/resources/hypo/orchestratorPrivate.feature: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -15,6 +15,14 @@ Scenario: Run full sequence once
  * def auth_token = auth.accessToken
  * def token      = auth.accessToken

  * def orgs = call read('classpath:hypo/organization.feature@getOrganizations') { auth_token: '#(auth_token)' }
  * def controllers = call read('classpath:hypo/fabric.feature@getControllers') { auth_token: '#(auth_token)' }
  * def peering = call read('classpath:hypo/peering.feature@getPeerings') { auth_token: '#(auth_token)' }
  * def registries = call read('classpath:hypo/registry.feature@getRegistries') { auth_token: '#(auth_token)' }

  
  * call read('classpath:hypo/cleanUp.feature@cleanupAll'){ auth_token: '#(auth_token)', organizationIds: '#(orgs.organizationIds)', peeringIds: '#(peering.peeringIds)' , networkControllerIds: '#(controllers.networkControllerIds)', registryImageIds: '#(registries.registryImageIds)' ,registryPackageIds: '#(registries.registryPackageIds)'   }

  # Steps 2–6: auth, registry, org, peering, specs (shared) 
  * def setupResults = call read('classpath:hypo/orchestrator-setup.feature') { auth_token: '#(auth_token)' }
  * def orgId = setupResults.orgId
@@ -37,6 +45,14 @@ Scenario: Run full sequence once
  * call read('classpath:hypo/fabric.feature@getDomainIdentityResource') {auth_token: '#(auth_token)', networkControllerId: '#(networkControllerId)', identityId: '#(identityId)'} 



  * def orgs = call read('classpath:hypo/organization.feature@getOrganizations') { auth_token: '#(auth_token)' }
  * def controllers = call read('classpath:hypo/fabric.feature@getControllers') { auth_token: '#(auth_token)' }
  * def peering = call read('classpath:hypo/peering.feature@getPeerings') { auth_token: '#(auth_token)' }
  * def registries = call read('classpath:hypo/registry.feature@getRegistries') { auth_token: '#(auth_token)' }



  # 9) servive order k8s
  # Create request
  * def createRes = call read('service.feature@createServiceOrderResourceK8s') { auth_token: '#(auth_token)', clusterType:'private-prek8s' }
Loading