Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/re_test-integration-azure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@boostercloud/framework-core",
"comment": "Enabled load tests for Azure",
"type": "none"
}
],
"packageName": "@boostercloud/framework-core"
}
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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<void> {
let slsartStack: Stack | undefined
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -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
)
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
10 changes: 6 additions & 4 deletions packages/framework-integration-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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",
Expand All @@ -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"
}