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

Configuration result is immutable #233

Open
ruud00000 opened this issue Feb 22, 2024 · 2 comments
Open

Configuration result is immutable #233

ruud00000 opened this issue Feb 22, 2024 · 2 comments
Assignees

Comments

@ruud00000
Copy link

ruud00000 commented Feb 22, 2024

I would like to run [loadtest][1] (command npx loadtest http://localhost:3000/endpoint) on production server with configuration file .loadtestrc:

{
    I would like to run loadtest (command  npx loadtest http://localhost:3000/endpoint ) on production server with configuration file .loadtestrc:

 
{
    "method": "POST",
    "body": {
        "to": "[email protected]",
        "subject": "Loadtest",
        "text": "Loadtest text"
    },
    "headers": {
        "Content-Type": "application/json",
        "Accept": "application/json"
    },
    "maxRequests": 1,
    "concurrency": 1
   }

but that gives error "Configuration result is immutable".

How can I solve that?

Also tried running this from the command line:

loadtest https://localhost:3000/endpoint -c 1 -n 1 -H Accept:application/json -T application/json -P '{ "to": "[email protected]", "subject": "Loadtest", "text": "Loadtest text" }' -m POST

but that gives the same error.

Also tried running node request-generator.js with content:

import {loadTest} from 'loadtest'

const options = {
	url: 'http://localhost:3000',
	concurrency: 1,
	method: 'POST',
	body:'',
	requestsPerSecond:1,
	maxSeconds:30,
	requestGenerator: (params, options, client, callback) => {
		const message = '{ "to": "[email protected]", "subject": "Loadtest", "text": "Loadtest text" }';
		options.headers['Content-Length'] = message.length;
		options.headers['Content-Type'] = 'application/json';
        options.headers['Accept'] = 'application/json';
		options.body = message;
		options.path = '/send-email';
		const request = client(options, callback);
		request.write(message);
		return request;
	}
};

loadTest(options, (error, result) => {
	if (error) {
		return console.error('Got an error: %s', error);
	}
	console.log(result);
	console.log('Tests run successfully');
});

That also gives the same result.

On the server Ubuntu is running with NGINX.

BTW is this the place for asking for help using loadtest or is there a better place for that?

@alexfernandez alexfernandez self-assigned this Mar 2, 2024
@alexfernandez
Copy link
Owner

Hi @ruud00000 ! Sorry for the delay. Yes, this is the right place.

I have tried creating the file .loadtestrc and it's failing for me too. I will fix it. Meanwhile please remove it and configure loadtest using the other options.

@alexfernandez
Copy link
Owner

alexfernandez commented Mar 2, 2024

Hi again! I just pushed a fix and published as 8.0.9, can you please try and see if it's working for you now? Otherwise I still suggest you remove .loadtestrc and try again.

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