UNPKG

@artilleryio/platform-fargate

Version:
12 lines (7 loc) 8.39 kB
"use strict";require("aws-sdk/lib/maintenance_mode_message").suppress=!0;const debugPerf=require("debug")("perf"),debug=(debugPerf("Artillery Pro loading"),require("./lib/create-artillery-log")(),require("debug")("artillery:pro")),path=require("path"),commands=require("./lib/commands"),{Command,Flags,Args}=require("@oclif/core"),chalk=require("chalk"),pkg=require("./package.json"),supportedRegions=require("./lib/util")["supportedRegions"],version=pkg.version,{ALLOWED_CONFIG_PARAMETERS,VALID_STACK_OVERRIDES}=require("./lib/constants");function collect(val,memo){return memo.push(val),memo}const stackOverrides=Object.keys(VALID_STACK_OVERRIDES).map(k=>` ${k} - `+VALID_STACK_OVERRIDES[k].description).join("\n");function getPluginPath(){return path.join(__dirname,"./lib/plugins")}const stopTestSpec={description:"stop a running test",args:{id:Args.string()}},describeTestRunSpec={description:"get information about a test run",args:{id:Args.string()}},deleteTestRunSpec={description:"delete a test run",args:{id:Args.string()}},runTestDescriptions={count:"Number of load generator workers to launch",cluster:"Name of the Fargate/ECS cluster to run the test on",region:`The AWS region to run in (${supportedRegions.join(", ")})`,packages:"Path to package.json file which lists dependencies for the test script",maxDuration:"Maximum duration of the test run",dotenv:"Path to a .env file to load environment variables from"},runTestSpec={description:`launch a test using AWS ECS/Fargate Examples: To launch a test with 10 load generating workers using AWS Fargate in us-east-1: $ artillery run:fargate --count 10 --region us-east-1 my-test.yml `,args:{script:Args.string()},flags:{count:Flags.integer({description:runTestDescriptions.count}),cluster:Flags.string({description:runTestDescriptions.cluster}),region:Flags.string({char:"r",description:runTestDescriptions.region}),secret:Flags.string({multiple:!0}),"launch-type":Flags.string({}),"launch-config":Flags.string({}),"subnet-ids":Flags.string({}),"security-group-ids":Flags.string({}),"task-role-name":Flags.string({}),target:Flags.string({char:"t",description:"Set target endpoint. Overrides the target already set in the test script"}),output:Flags.string({char:"o",description:"Write a JSON report to file"}),insecure:Flags.boolean({char:"k",description:"Allow insecure TLS connections; do not use in production"}),environment:Flags.string({char:"e",description:"Use one of the environments specified in config.environments"}),config:Flags.string({description:"Read configuration for the test from the specified file"}),"scenario-name":Flags.string({description:"Name of the specific scenario to run"}),overrides:Flags.string({description:"Dynamically override values in the test script; a JSON object"}),input:Flags.string({char:"i",description:"Input script file",multiple:!0,hidden:!0}),tags:Flags.string({description:"Comma-separated list of tags in key:value format to tag the test run, for example: --tags team:sre,service:foo"}),note:Flags.string({}),packages:Flags.string({description:runTestDescriptions.packages}),"max-duration":Flags.string({description:runTestDescriptions.maxDuration}),dotenv:Flags.string({description:runTestDescriptions.dotenv}),record:Flags.boolean({description:"Record test run to Artillery Cloud"}),key:Flags.string({description:"API key for Artillery Cloud"})}},runDbMigrations={description:"Upgrade database schema (only if using Aurora Serverless v1)"},runDbMigrationsSpec={description:runDbMigrations.description,args:{},flags:{}},deployDescriptions={description:"Set up Artillery support for ECS/Fargate for an AWS account",target:'Deployment platform. This is a placeholder flag. The default value is "aws"',set:`Set a value to customize. Supported keys: ${stackOverrides} `,region:"AWS region to deploy to",upgrade:"Upgrade an existing Artillery ECS/Fargate components in an AWS account",licenseKeyFile:"Path to file containing a license key",licenseKeyText:"Contents of a license key"},deploySpec={description:deployDescriptions.description,args:{},flags:{target:Flags.string({description:deployDescriptions.target,default:"aws"}),set:Flags.string({description:deployDescriptions.set,multiple:!0}),region:Flags.string({char:"r",description:deployDescriptions.region}),upgrade:Flags.boolean({description:deployDescriptions.upgrade}),"license-key-file":Flags.string({description:deployDescriptions.licenseKeyFile}),"license-key-text":Flags.string({description:deployDescriptions.licenseKeyText})}},subscriptionDescriptions={description:"This command is deprecated",email:"",json:""},subscriptionSpec={description:subscriptionDescriptions.description,args:{},flags:{email:Flags.string({description:subscriptionDescriptions.email}),json:Flags.boolean({description:subscriptionDescriptions.json})}},listTestsDescriptions={description:"list running tests",json:"Format output as JSON"},listTestsSpec={description:listTestsDescriptions.description,args:{},flags:{json:Flags.boolean({description:listTestsDescriptions.json})}},listTestRunsDescriptions={description:"list past test runs",tags:"Comma-separated list of tags in key:value format. Return test run ids that match those tags",maxItems:"Maximum number of results to display",offset:"Pagination offset for querying"},listTestRunsSpec={description:listTestRunsDescriptions.description,args:{},flags:{tags:Flags.string({description:listTestRunsDescriptions.tags}),"max-items":Flags.integer({description:listTestRunsDescriptions.maxItems,default:10}),offset:Flags.string({description:listTestRunsDescriptions.offset})}},listTagsDescriptions={description:"list all tags"},listTagsSpec={description:listTagsDescriptions.description,args:{},flags:{}},postNoteDescriptions={description:"add a note to a test run",testRunId:"Id of the test run that the note should be posted to",text:"Text of the note"},postNoteSpec={description:postNoteDescriptions.description,args:{},flags:{"test-run-id":Flags.string({description:postNoteDescriptions.testRunId,required:!0}),text:Flags.string({description:postNoteDescriptions.text,required:!0})}},createTestBundleSpec={description:"package up a test script and name it to speed up running tests with run-test",args:{script:Args.string()},flags:{name:Flags.string({char:"n",description:"The name for the test (to be used in run-test)"}),config:Flags.string({description:"Use common test configuration for this named test"})}},listTestBundlesSpec={description:"list test definitions that have been created",args:{},flags:{json:Flags.string({description:"Format output as JSON"})}},deleteTestBundleSpec={description:"delete a named test",args:{name:Args.string()},flags:{}},setConfigValueSpec={description:"set a configuration value. Must be one of: "+ALLOWED_CONFIG_PARAMETERS.join(", "),args:{},flags:{name:Flags.string({char:"n",description:"Name of the configuration parameter"}),value:Flags.string({char:"v",description:"Value of the configuration parameter"}),region:Flags.string({char:"r",description:`AWS region where Artillery ECS/Fargate components are deployed (one of: ${supportedRegions.join(", ")})`})}},setSecretSpec={description:"create a secret to use in tests",args:{},flags:{name:Flags.string({char:"n",description:"Name of the secret, e.g. MY_API_KEY"}),value:Flags.string({char:"v",description:"Value of the secret"}),backend:Flags.string({description:'Storage backend; must be set to "ssm" if used'}),region:Flags.string({char:"r",description:"AWS region where the secret should be created"})}},listSecretsSpec={description:"list secrets in a region",args:{},flags:{region:Flags.string({char:"r",description:"AWS region to list secrets in"})}};module.exports={util:{aws:{getCredentialsWithSSO:require("./lib/utils/aws-get-credentials"),setDefaultCredentials:require("./lib/utils/aws-set-default-credentials")}},getPluginPath:getPluginPath,version:version,oclif:{runTest:runTestSpec,stopTest:stopTestSpec,describeTestRun:describeTestRunSpec,deleteTestRun:deleteTestRunSpec,deploy:deploySpec,subscription:subscriptionSpec,listTests:listTestsSpec,listTestRuns:listTestRunsSpec,listTags:listTagsSpec,postNote:postNoteSpec,createTestBundle:createTestBundleSpec,listTestBundles:listTestBundlesSpec,deleteTestBundle:deleteTestBundleSpec,setConfigValue:setConfigValueSpec,setSecret:setSecretSpec,listSecrets:listSecretsSpec,runDbMigrations:runDbMigrationsSpec},commands:commands};