Commit 69d25252 authored by Nikos Psaromanolakis's avatar Nikos Psaromanolakis
Browse files

add stress tests using the private orchestrator...Related to #5

parent 0b323c1b
Loading
Loading
Loading
Loading
+10
Changes for README.md: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -98,6 +98,16 @@ mvn test "-Dkarate.env=dev-etsi" "-Dkarate.options=--tags @smoke-e2e-workflow-pr
mvn test "-Dkarate.env=dev-etsi" "-Dkarate.options=--tags @nightly-workflow-with-clean-up"
```

**For cleaning up HypO instance:**
```bash
 mvn test "-Dkarate.env=dev-etsi" "-Dkarate.options=--tags @clean-up-workflow"   
```

**For running multiple workflows with a private cluster (Load-Stress Test) :**
```bash
 mvn test "-Dkarate.env=dev-etsi" "-Dkarate.options=--tags @nightly-workflow-bulk-private"   
```

**For independent tests run:**
- Run by File Path:
```bash
+90
Changes for src/test/resources/hypo/orchestrators/orchestratorMasterNightly.feature: 90 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -85,3 +85,93 @@ Scenario: Execute all orchestrators one by one
  }
  """
  * eval cleanupAndMaybeRethrow()


@nightly-workflow-bulk-private
Scenario: Create multiple private service requests without terminating

  * def runCount = 3

  * karate.log('========================================')
  * karate.log('STARTING BULK PRIVATE ORCHESTRATOR RUN')
  * karate.log('========================================')

  # First run: do a real init (org, peering, registry, fabric controller) - everything else skipped
  * karate.log('--- Running Private orchestrator: INITIAL RUN (init steps enabled) ---')
  * def firstRun = karate.call('classpath:hypo/orchestrators/orchestratorPrivate.feature', { skipCleanup: true, skipTerminateSteps: true })

  # Remaining runs: reuse org/fabric, skip init, skip terminate
  * def runBulkPrivate =
  """
  function(i) {
    karate.log('--- Running Private orchestrator: BULK RUN ' + (i + 1) + ' of ' + (runCount - 1) + ' ---');
    karate.call('classpath:hypo/orchestrators/orchestratorPrivate.feature', {
      skipCleanup: true,
      skipInitSteps: true,
      skipTerminateSteps: true
    });
  }
  """

  * def remainingIndices = []
  * eval for (var i = 0; i < runCount - 1; i++) remainingIndices.push(i)
  * karate.forEach(remainingIndices, runBulkPrivate)

  * karate.log('========================================')
  * karate.log('------ ALL ' + runCount + ' BULK RUNS COMPLETE ------')
  * karate.log('========================================')



@nightly-workflow-bulk-private
Scenario: Create multiple private service requests without terminating

  * def runCount = 5

  * def runBulkSequence =
  """
  function() {
    karate.log('========================================');
    karate.log('STARTING BULK PRIVATE ORCHESTRATOR RUN');
    karate.log('========================================');

    // First run: real init (org, peering, registry, fabric controller) - terminate skipped
    karate.log('--- Running Private orchestrator: INITIAL RUN (init steps enabled) ---');
    var firstRun = karate.call('classpath:hypo/orchestrators/orchestratorPrivate.feature', { skipCleanup: true, skipTerminateSteps: true });
  
    // Remaining runs: reuse org/fabric, skip init, skip terminate
    for (var i = 0; i < runCount - 1; i++) {
      karate.log('--- Running Private orchestrator: BULK RUN ' + (i + 1) + ' of ' + (runCount - 1) + ' ---');
      karate.call('classpath:hypo/orchestrators/orchestratorPrivate.feature', {
        skipCleanup: true,
        skipInitSteps: true,
        skipTerminateSteps: true
      });
    }

    karate.log('========================================');
    karate.log('------ ALL ' + runCount + ' BULK RUNS COMPLETE ------');
    karate.log('========================================');
  }
  """

  * def cleanupAndMaybeRethrow =
  """
  function() {
    var caughtError = null;
    try {
      runBulkSequence();
    } catch (e) {
      caughtError = e;
      karate.log('*** ONE OR MORE BULK RUNS FAILED — running master cleanup ***');
    } finally {
      karate.log('>>>>>>>> STARTING TO EXECUTE MASTER CLEAN UP <<<<<<<<');
      karate.call('classpath:hypo/cleanUp.feature@clean-up-workflow');
    }
    if (caughtError) {
      throw caughtError;
    }
  }
  """

  * eval cleanupAndMaybeRethrow()
 No newline at end of file
+36 −32
Changes for src/test/resources/hypo/orchestrators/orchestratorPrivate.feature: 36 added lines, 32 removed lines.
Original line number Diff line number Diff line
@@ -98,38 +98,42 @@ Scenario: Run full sequence once
  * call read('classpath:hypo/telemetry.feature@checkGrafanaDashboardLogs') { grafanaToken: '#(grafanaToken)', dashboardUrlLogs: '#(logApiDashUrl)' }

 
  
  # 15) Update the service (helm configuration)
  # Get the updated payload
  * def updatedPayload = invSer.updatedPayload
  * call read('classpath:hypo/service.feature@updateServiceHelmPackage') { auth_token: '#(auth_token)', serviceId: '#(serviceId)', updatedPayload: '#(updatedPayload)' }
  * eval java.lang.Thread.sleep(15000)
  * def invSerUp = call read('classpath:hypo/service.feature@getServiceInventoryStatePoll') { auth_token: '#(auth_token)', serviceId: '#(serviceId)', requiredStatus:'ACTIVE'}

  * eval java.lang.Thread.sleep(40000)

  # 16) Terminate the end-user service
  * call read('classpath:hypo/service.feature@terminateService') { auth_token: '#(auth_token)', serviceId: '#(serviceId)' }
  * eval java.lang.Thread.sleep(15000)
  * def invSerTer = call read('classpath:hypo/service.feature@getServiceInventoryStatePoll') { auth_token: '#(auth_token)', serviceId: '#(serviceId)', requiredStatus:'TERMINATED'}
  * def terminatedEndUserService = true
  
  # 17) Terminate the resource service
  * eval java.lang.Thread.sleep(20000)
  * call read('classpath:hypo/service.feature@terminateService') { auth_token: '#(auth_token)', serviceId: '#(serviceK8sId)' }
  
  * eval java.lang.Thread.sleep(15000)
  * def invSerUp = call read('classpath:hypo/service.feature@getServiceInventoryStatePoll') { auth_token: '#(auth_token)', serviceId: '#(serviceK8sId)', requiredStatus:'TERMINATED'}
  * def terminatedK8sService = true

  # Cleanup service orders (afterScenario handles the rest)

  * call read('classpath:hypo/deleteAll.feature@deleteServiceOrder') { auth_token: '#(auth_token)', orderId: '#(serviceorderenduserid)'}
  * call read('classpath:hypo/deleteAll.feature@deleteServiceOrder') { auth_token: '#(auth_token)', orderId: '#(serviceorderk8sid)'}

  # those are being triggered from 'afterScenario' 
  # * call read('classpath:hypo/deleteAll.feature@deletePeering') { auth_token: '#(auth_token)'}
  # * call read('classpath:hypo/deleteAll.feature@deleteOrganization') { auth_token: '#(auth_token)'}
  * def skipTerminateSteps = karate.get('skipTerminateSteps', false)

  * def runTerminateSteps =
  """
  function() {
    // 15) Update the service (helm configuration)
    var updatedPayload = invSer.updatedPayload;
    karate.call('classpath:hypo/service.feature@updateServiceHelmPackage', { auth_token: auth_token, serviceId: serviceId, updatedPayload: updatedPayload });
    java.lang.Thread.sleep(15000);
    var invSerUp = karate.call('classpath:hypo/service.feature@getServiceInventoryStatePoll', { auth_token: auth_token, serviceId: serviceId, requiredStatus:'ACTIVE'});

    java.lang.Thread.sleep(40000);

    // 16) Terminate the end-user service
    karate.call('classpath:hypo/service.feature@terminateService', { auth_token: auth_token, serviceId: serviceId });
    java.lang.Thread.sleep(15000);
    var invSerTer = karate.call('classpath:hypo/service.feature@getServiceInventoryStatePoll', { auth_token: auth_token, serviceId: serviceId, requiredStatus:'TERMINATED'});

    // 17) Terminate the resource service
    java.lang.Thread.sleep(20000);
    karate.call('classpath:hypo/service.feature@terminateService', { auth_token: auth_token, serviceId: serviceK8sId });
    java.lang.Thread.sleep(15000);
    var invSerUp2 = karate.call('classpath:hypo/service.feature@getServiceInventoryStatePoll', { auth_token: auth_token, serviceId: serviceK8sId, requiredStatus:'TERMINATED'});

    // Cleanup service orders
    karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrder', { auth_token: auth_token, orderId: serviceorderenduserid });
    karate.call('classpath:hypo/deleteAll.feature@deleteServiceOrder', { auth_token: auth_token, orderId: serviceorderk8sid });

    karate.set('terminatedEndUserService', true);
    karate.set('terminatedK8sService', true);
  }
  """

  * if (!skipTerminateSteps) runTerminateSteps()
  * def terminatedEndUserService = karate.get('terminatedEndUserService', false)
  * def terminatedK8sService = karate.get('terminatedK8sService', false)