Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test not exiting if any response is a non-redirecting 301 #3458

Open
somecho opened this issue Jan 21, 2025 · 2 comments
Open

Test not exiting if any response is a non-redirecting 301 #3458

somecho opened this issue Jan 21, 2025 · 2 comments

Comments

@somecho
Copy link

somecho commented Jan 21, 2025

Version info:

VERSION INFO:

Artillery: 2.0.22
Node.js:   v20.12.2
OS:        win32

Running this command:

npx artillery run .\301.yml
# 301.yml
config:
  target: "http://localhost:3000"
  phases:
    - duration: 3
      arrivalRate: 1
      maxVusers: 1
  http:
    timeout: 5

scenarios:
    - flow:
        - get:
            url: "/"
// server.js
// npm i express is needed
const express = require('express');

const app = express();
const PORT = 3000;

app.get('*', (req, res) => {
    res.status(301).send('Moved Permanently');
});

app.listen(PORT, () => {
    console.log(`Server is running and listening on port ${PORT}`);
    console.log('Responding with 301 status code to all requests.');
});

Description

With the above configuration, Artillery does not exit after the test has completed. DEBUG is http. I am left with this output:

> artillery run .\301.yml

Test run id: tcggj_qdcpx9z7xmjx6gy9m3yt3eabchewr_zgn7
Phase started: unnamed (index: 0, duration: 3s) 14:51:55(+0100)

- 2025-01-21T13:51:56.709Z http request: {
  "url": "http://localhost:3000/",
  "method": "GET",
  "headers": {
    "user-agent": "Artillery (https://artillery.io)"
  }
}
Phase completed: unnamed (index: 0, duration: 3s) 14:51:58(+0100)

--------------------------------------
Metrics for period to: 14:52:00(+0100) (width: 1.999s)
--------------------------------------

http.codes.301: ................................................................ 1
http.downloaded_bytes: ......................................................... 17
http.request_rate: ............................................................. 1/sec
http.requests: ................................................................. 1
http.response_time:
  min: ......................................................................... 1
  max: ......................................................................... 1
  mean: ........................................................................ 1
  median: ...................................................................... 1
  p95: ......................................................................... 1
  p99: ......................................................................... 1
http.response_time.3xx:
  min: ......................................................................... 1
  max: ......................................................................... 1
  mean: ........................................................................ 1
  median: ...................................................................... 1
  p95: ......................................................................... 1
  p99: ......................................................................... 1
http.responses: ................................................................ 1
vusers.created: ................................................................ 1
vusers.created_by_name.0: ...................................................... 1
vusers.skipped: ................................................................ 2

Artillery does not log any futher information after this and runs indefinitely. The cursor is spinning. Since I do not control the web service I am testing, I have no influence on how redirects are handled.

@hassy
Copy link
Member

hassy commented Jan 22, 2025

This seems like a bug. It should work as expected if followRedirect is set to false but I haven't checked. i.e. with:

scenarios:
    - flow:
        - get:
            url: "/"
+           followRedirect: false

@somecho
Copy link
Author

somecho commented Jan 23, 2025

I tested with followRedirect: false. It does work as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants