Commit 1dd950e7 authored by Vasilis Katopodis's avatar Vasilis Katopodis
Browse files

Merge branch 'revert-6338e74b' into 'develop'

Revert "Merge branch 'feature/service-monitor-health-check' into 'develop'"

See merge request !10
parents 6338e74b 8cd18fb2
Loading
Loading
Loading
Loading
Loading
+1 −3
Changes for src/test/resources/hypo/orchestrators/orchestratorPrivate.feature: 1 added line, 3 removed lines.
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ Scenario: Run full sequence once
  * match invSer.response.state == 'ACTIVE'
  # Get the terminated payload for end user
  

  # Force the string to be parsed as JSON
  * json asJson = foundNamespace
  * def cleanNamespace = asJson[0]
@@ -79,9 +80,6 @@ Scenario: Run full sequence once
  * def metricsDashboardUrl = invRes.metricsDashboardUrl
  * def logsDashboardUrl = invRes.logsDashboardUrl

  # Poll tmf-api until service.monitor reports a healthy resource for the service
  * call read('classpath:hypo/service.feature@checkServiceMonitorHealth') { auth_token: '#(auth_token)', serviceId: '#(serviceId)' }

  # 14) Telemetry checks
  #create and get token 
  * def grafanaTokenRes = call read('classpath:hypo/telemetry.feature@grafana-token') 
−3
Changes for src/test/resources/hypo/orchestrators/orchestratorPublic.feature: 0 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -79,9 +79,6 @@ Scenario: Run full sequence once
  * def metricsDashboardUrl = invRes.metricsDashboardUrl
  * def logsDashboardUrl = invRes.logsDashboardUrl

  # Poll tmf-api until service.monitor reports a healthy resource for the service
  * call read('classpath:hypo/service.feature@checkServiceMonitorHealth') { auth_token: '#(auth_token)', serviceId: '#(serviceId)' }

  # 14) Telemetry — metrics + prometheus + logs checks
  #create and get token 
  * def grafanaTokenRes = call read('classpath:hypo/telemetry.feature@grafana-token') 
−56
Changes for src/test/resources/hypo/service.feature: 0 added lines, 56 removed lines.
Original line number Diff line number Diff line
@@ -360,62 +360,6 @@ Scenario: Get Resource Inventory and Extract Dashboard URLs
  * karate.log('Extracted Metrics URL:', metricsDashboardUrl)
  * karate.log('Extracted Logs URL:', logsDashboardUrl)

@getResourceById
Scenario: Get a single Resource by id
  Given url baseUrl
  And path 'tmf-api', 'resourceInventoryManagement', V4, 'resource', resourceId
  And header Authorization = 'Bearer ' + token
  When method get
  Then status 200

@checkServiceMonitorHealth
Scenario: Poll tmf-api until service.monitor reports a healthy resource for the service
  * karate.log('--- POLLING FOR SERVICE MONITOR HEALTH REPORT ---')
  * karate.log('For Service ID:', serviceId)

  * def maxRetries = 15
  * def pollInterval = 15000

  * def hasHealthyMonitoredResource =
    """
    function() {
      var invSer = karate.call('classpath:hypo/service.feature@getServiceInventoryResource', { token: token, serviceId: serviceId });
      var refs = invSer.response.supportingResource;
      if (!refs) return false;
      for (var i = 0; i < refs.length; i++) {
        var res = karate.call('classpath:hypo/service.feature@getResourceById', { token: token, resourceId: refs[i].id });
        var resource = res.response;
        var isMonitorManaged = !resource.resourceStatus && resource.operationalState;
        if (isMonitorManaged) {
          karate.log('service.monitor reported resource', resource.name, '->', resource.operationalState);
          if (resource.operationalState === 'ENABLE') {
            return true;
          }
        }
      }
      return false;
    }
    """

  * def doPoll =
    """
    function() {
      for (var i = 0; i < maxRetries; i++) {
        if (hasHealthyMonitoredResource()) {
          karate.log('service.monitor health confirmed at attempt #' + (i + 1));
          return true;
        }
        karate.log('Attempt #' + (i + 1) + ' - no healthy service.monitor resource yet, retrying...');
        if (i < maxRetries - 1) {
          java.lang.Thread.sleep(pollInterval);
        }
      }
      karate.fail('service.monitor did not report a healthy resource for service ' + serviceId + ' within ' + (maxRetries * pollInterval / 1000) + 's.');
    }
    """

  * doPoll()

@terminateService
Scenario: Terminate the Service
  * karate.log('--- STEP: PATCH SERVICE TO TERMINATED ---')