Skip to content

Commit

Permalink
test(unit): move custom plugin test to cli folder
Browse files Browse the repository at this point in the history
  • Loading branch information
bernardobridge committed Mar 13, 2024
1 parent 8e59b9e commit e7882eb
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 178 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const http = require('http');
const { $ } = require('zx');
const path = require('path');

const A9 = process.env.A9 || path.join(__dirname, '../../../bin/run');
const A9 = process.env.A9 || path.join(__dirname, '../../bin/run');

function createServer() {
return http.createServer((req, res) => {
Expand Down Expand Up @@ -31,7 +31,10 @@ beforeEach(async () => {
config: {
phases: [{ duration: 2, arrivalRate: 2 }],
target: `http://localhost:${server.address().port}`,
processor: path.join(__dirname, '/processor.js'),
processor: path.join(
__dirname,
'../scripts/scenario-with-custom-plugin/processor.js'
),
plugins: {
httphooks: {}
}
Expand All @@ -46,10 +49,10 @@ afterEach(async () => {
test('plugins can attach functions to processor object', async (t) => {
const output = await $`ARTILLERY_PLUGIN_PATH=${path.join(
__dirname,
'../../plugins'
'../plugins'
)} ${A9} run --quiet --overrides ${overrides} ${path.join(
__dirname,
'/script.json'
'../scripts/scenario-with-custom-plugin/custom-plugin.yml'
)}`;

t.match(output, /afterResponse hook/, 'plugin should have been called');
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
config: {}

before:
flow:
- post:
url: "/"

scenarios:
- flow:
- get:
url: "/"
expect:
statusCode: 204
148 changes: 0 additions & 148 deletions packages/artillery/test/testcases/command-run.bats

This file was deleted.

26 changes: 0 additions & 26 deletions packages/artillery/test/testcases/plugins/script.json

This file was deleted.

0 comments on commit e7882eb

Please sign in to comment.