diff --git a/.github/workflows/re_test-integration-azure.yml b/.github/workflows/re_test-integration-azure.yml index 3714a067b..8e4efadf7 100644 --- a/.github/workflows/re_test-integration-azure.yml +++ b/.github/workflows/re_test-integration-azure.yml @@ -56,7 +56,7 @@ jobs: strategy: max-parallel: 1 matrix: - integration-test: [azure-func, azure-end-to-end] + integration-test: [azure-func, azure-end-to-end, azure-load] runs-on: ubuntu-latest steps: - name: Checkout diff --git a/common/changes/@boostercloud/framework-core/rdiaz82-features-load_test_azure_2023-03-02-17-17.json b/common/changes/@boostercloud/framework-core/rdiaz82-features-load_test_azure_2023-03-02-17-17.json new file mode 100644 index 000000000..369637f70 --- /dev/null +++ b/common/changes/@boostercloud/framework-core/rdiaz82-features-load_test_azure_2023-03-02-17-17.json @@ -0,0 +1,10 @@ +{ + "changes": [ + { + "packageName": "@boostercloud/framework-core", + "comment": "Enabled load tests for Azure", + "type": "none" + } + ], + "packageName": "@boostercloud/framework-core" +} \ No newline at end of file diff --git a/packages/framework-integration-tests/integration/provider-unaware/load/artillery-executor.ts b/packages/framework-integration-tests/integration/provider-unaware/load/artillery-executor.ts index 63a072ec0..df384606a 100644 --- a/packages/framework-integration-tests/integration/provider-unaware/load/artillery-executor.ts +++ b/packages/framework-integration-tests/integration/provider-unaware/load/artillery-executor.ts @@ -1,7 +1,6 @@ import * as fs from 'fs' import * as yaml from 'yaml' import * as path from 'path' -import { ProviderTestHelper } from '@boostercloud/application-tester' import { CloudFormation } from 'aws-sdk' import { Stack } from 'aws-sdk/clients/cloudformation' import { runCommand } from '@boostercloud/framework-common-helpers' @@ -20,11 +19,7 @@ interface OverrideOptions { export class ArtilleryExecutor { private readonly serverlessArtilleryStackPrefix = 'serverless-artillery' - constructor( - private scriptsFolder: string, - private readonly providerTestHelper: ProviderTestHelper, - private readonly stage = 'booster' - ) {} + constructor(private scriptsFolder: string, private readonly graphqlURL: string, private readonly stage = 'booster') {} public async ensureDeployed(): Promise { let slsartStack: Stack | undefined @@ -59,7 +54,7 @@ export class ArtilleryExecutor { private getScriptContent(scriptName: string, options: OverrideOptions): string { const scriptPath = path.join(this.scriptsFolder, scriptName) const parsedScript = yaml.parse(fs.readFileSync(scriptPath).toString()) - parsedScript.config.target = this.providerTestHelper.outputs.graphqlURL + parsedScript.config.target = this.graphqlURL if (options.phases) { parsedScript.config.phases = options.phases diff --git a/packages/framework-integration-tests/integration/provider-unaware/load/entities-are-correctly-reduced.load.ts b/packages/framework-integration-tests/integration/provider-unaware/load/entities-are-correctly-reduced.load.ts index 0aa7efa15..7304133ae 100644 --- a/packages/framework-integration-tests/integration/provider-unaware/load/entities-are-correctly-reduced.load.ts +++ b/packages/framework-integration-tests/integration/provider-unaware/load/entities-are-correctly-reduced.load.ts @@ -29,9 +29,9 @@ describe('Data consistency on entities', () => { it('adds stock to all of them with many events without corrupting data', async () => { const durationWarmup = 10 - const arrivalRateWarmup = 500 + const arrivalRateWarmup = process.env.TESTED_PROVIDER === 'AZURE' ? 200 : 500 const durationBurst = 10 - const arrivalRateBurst = 1200 + const arrivalRateBurst = process.env.TESTED_PROVIDER === 'AZURE' ? 400 : 1200 const expectedStock = durationWarmup * arrivalRateWarmup + durationBurst * arrivalRateBurst await scriptExecutor.executeScript('move-product-stock.yml', { variables: { token, productID: productIDs, destinationWarehouse }, @@ -55,7 +55,9 @@ describe('Data consistency on entities', () => { ).reduce((stockProductA: number, stockProductB: number) => stockProductA + stockProductB, 0) console.debug(`Total stock. Got: ${totalStock}, expected: ${expectedStock}`) return totalStock === expectedStock - } + }, + 10000, + 900000 ) }) }) diff --git a/packages/framework-integration-tests/integration/provider-unaware/load/read-models-are-correctly-projected.load.ts b/packages/framework-integration-tests/integration/provider-unaware/load/read-models-are-correctly-projected.load.ts index 942bb68a5..21f7f1f38 100644 --- a/packages/framework-integration-tests/integration/provider-unaware/load/read-models-are-correctly-projected.load.ts +++ b/packages/framework-integration-tests/integration/provider-unaware/load/read-models-are-correctly-projected.load.ts @@ -43,7 +43,9 @@ describe('Data consistency on read models', () => { const currentProducts = result.data.ProductsBySKU?.products.length console.debug(`Products with the same SKU. Got: ${currentProducts}, expected: ${expectedProductsBySku}`) return currentProducts === expectedProductsBySku - } + }, + 10000, + 900000 ) expect(result.data.ProductsBySKU.id).to.be.equal(sku) expect(result.data.ProductsBySKU.products.length).to.be.equal(expectedProductsBySku) diff --git a/packages/framework-integration-tests/integration/provider-unaware/load/setup.ts b/packages/framework-integration-tests/integration/provider-unaware/load/setup.ts index 1ad17a1ee..26b71c371 100644 --- a/packages/framework-integration-tests/integration/provider-unaware/load/setup.ts +++ b/packages/framework-integration-tests/integration/provider-unaware/load/setup.ts @@ -10,7 +10,7 @@ export let applicationUnderTest: ApplicationTester before(async () => { await setEnv() const providerTestHelper = await getProviderTestHelper() - scriptExecutor = new ArtilleryExecutor(loadTestsFolder, providerTestHelper) + scriptExecutor = new ArtilleryExecutor(loadTestsFolder, providerTestHelper.outputs.graphqlURL) await scriptExecutor.ensureDeployed() applicationUnderTest = new ApplicationTester(providerTestHelper) }) diff --git a/packages/framework-integration-tests/package.json b/packages/framework-integration-tests/package.json index fcc8fd780..d0da0469a 100644 --- a/packages/framework-integration-tests/package.json +++ b/packages/framework-integration-tests/package.json @@ -75,7 +75,8 @@ "ttypescript": "1.5.15", "typescript": "4.7.4", "sinon": "9.2.3", - "eslint-plugin-unicorn": "~44.0.2" + "eslint-plugin-unicorn": "~44.0.2", + "yaml": "1.10.2" }, "engines": { "node": ">=14.0.0" @@ -93,11 +94,11 @@ "postinstall": "rimraf ../../node_modules/serverless/node_modules/archiver && echo 'Deleted buggy \"archiver\" module from \"serveless\" dependencies to use the newer hoisted one'", "integration": "npm run integration/cli && npm run integration/local && npm run integration/aws && npm run integration/azure", "integration/cli": "mocha --exit --config \"integration/provider-unaware/cli/.mocharc.yml\" \"integration/provider-unaware/cli/**/*.integration.ts\"", - "integration/aws": "npm run integration/aws-deploy && npm run integration/aws-func && npm run integration/aws-end-to-end && npm run integration/aws-load && npm run integration/aws-nuke", + "integration/aws": "npm run integration/aws-deploy && npm run integration/aws-func && npm run integration/aws-end-to-end && npm run integration/aws-nuke", "integration/aws-deploy": "AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=production mocha --forbid-only --exit --config \"integration/provider-specific/aws/deployment/.mocharc.yml\" \"integration/provider-specific/aws/deployment/**/*.integration.ts\"", "integration/aws-func": "TESTED_PROVIDER=AWS AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=production mocha --forbid-only --exit --config \"integration/provider-unaware/functionality/.mocharc.yml\" \"integration/provider-unaware/functionality/**/*.integration.ts\"", "integration/aws-end-to-end": "TESTED_PROVIDER=AWS AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=production mocha --forbid-only --exit --config \"integration/provider-unaware/end-to-end/.mocharc.yml\" \"integration/provider-unaware/end-to-end/**/*.integration.ts\"", - "integration/aws-load": "echo 'Skipping integration tests.' # TESTED_PROVIDER=AWS AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=production mocha --forbid-only --exit --config \"integration/provider-unaware/load/.mocharc.yml\" \"integration/provider-unaware/load/**/*.load.ts\"", + "integration/aws-load": "TESTED_PROVIDER=AWS AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=production mocha --forbid-only --exit --config \"integration/provider-unaware/load/.mocharc.yml\" \"integration/provider-unaware/load/**/*.load.ts\"", "integration/aws-nuke": "AWS_SDK_LOAD_CONFIG=true BOOSTER_ENV=production mocha --forbid-only --exit --config \"integration/provider-specific/aws/nuke/.mocharc.yml\" \"integration/provider-specific/aws/nuke/**/*.integration.ts\"", "integration/local": "BOOSTER_ENV=local mocha --forbid-only --exit --config \"integration/provider-specific/local/.mocharc.yml\" \"integration/provider-specific/local/**/*.integration.ts\"", "integration/local-ongoing": "npm run integration/local-start && npm run integration/local-stop", @@ -109,7 +110,8 @@ "integration/azure-deploy": "TESTED_PROVIDER=AZURE BOOSTER_ENV=azure mocha --forbid-only --exit --config \"integration/provider-specific/azure/deployment/.mocharc.yml\" \"integration/provider-specific/azure/deployment/**/*.integration.ts\"", "integration/azure-nuke": "TESTED_PROVIDER=AZURE BOOSTER_ENV=azure mocha --forbid-only --exit --config \"integration/provider-specific/azure/nuke/.mocharc.yml\" \"integration/provider-specific/azure/nuke/**/*.integration.ts\"", "integration/azure-end-to-end": "TESTED_PROVIDER=AZURE BOOSTER_ENV=azure mocha --forbid-only --exit --config \"integration/provider-unaware/end-to-end/.mocharc.yml\" \"integration/provider-unaware/end-to-end/**/*.integration.ts\"", - "integration/azure-func": "TESTED_PROVIDER=AZURE BOOSTER_ENV=azure mocha --forbid-only --exit --config \"integration/provider-unaware/end-to-end/.mocharc.yml\" \"integration/provider-unaware/functionality/**/*.integration.ts\"" + "integration/azure-func": "TESTED_PROVIDER=AZURE BOOSTER_ENV=azure mocha --forbid-only --exit --config \"integration/provider-unaware/end-to-end/.mocharc.yml\" \"integration/provider-unaware/functionality/**/*.integration.ts\"", + "integration/azure-load": "TESTED_PROVIDER=AZURE BOOSTER_ENV=azure mocha --forbid-only --exit --config \"integration/provider-unaware/load/.mocharc.yml\" \"integration/provider-unaware/load/**/*.load.ts\"" }, "types": "dist/index.d.ts" }