I have an authenticate scenario which return a token. After 5 minutes (example), the token is expired. But this token is mandatory for the success of other scenarios.
Now, I don't really want to run this scenario each time before the other scenarios.
Ideally, I will run it a first time, get the token, and when the expiration time, rerun the authenticate scenario.
Currently, my yml file follow this logic:
execution:
- scenario: mainload
scenarios:
authenticate:
requests:
- http://auth.com
mainload:
requests:
- include-scenario: http://needToken.com
- http://needToken.com
So, how can I using Taurus inside an yml file do this? Like, waiting 5 minutes before relaunching the scenario?
Have a nice day.
You can create 2 scenario elements, one for authentication and another one for main load, the relevant Taurus YAML syntax would be something like:
execution:
- scenario: authenticate
- scenario: mainload
scenarios:
authenticate:
think-time: 5m
requests:
- http://example.com
mainload:
requests:
- http://blazedemo.com
The think-time attribute basically adds a Constant Timer with 5 minutes "sleep" time so the request to example.com will be executed each 5 minutes while others will be fired without delays.
References:
Building Test Plan from Config
Taurus Configuration Syntax
Taurus - Working with Multiple JMeter Tests
Related
I'm having an issue with the built in gitlab dast scanning and authentication in the pipeline.
The application that is attempting to be scanned is an angular app using the aspnetzero framework.
In gitlab the cicd file uses the dast UI configuration to setup the job and in the cicd yml file the job spec looks like:
# Include the DAST template
include:
- template: DAST.gitlab-ci.yml
# Your selected site and scanner profiles:
dast:
stage: dast
dast_configuration:
site_profile: "auth"
scanner_profile: "default"
In the site profile the proper data is setup for authentication and then running the dast scanning job, I get an error in the logs like
2022-07-12T22:00:16.000 INF NAVDB Load URL added to crawl graph
2022-07-12T22:00:16.000 INF AUTH Attempting to authenticate
2022-07-12T22:00:16.000 INF AUTH Loading login page LoginURL=https://example.com/account
2022-07-12T22:00:23.000 WRN BROWS response body exceeds allowed size allowed_size_bytes=10000000 request_id=interception-job-4.0 response_size_bytes=11100508 url=https://example.com/main.f3808aecbe8d4efb.js
2022-07-12T22:00:38.000 WRN CONTA request failed, attempting to continue scan error=net::ERR_BLOCKED_BY_RESPONSE index=0 requestID=176.5 url=https://example.com/main.f3808aecbe8d4efb.js
2022-07-12T22:00:39.000 INF AUTH Writing authentication report path=/zap/wrk/gl-dast-debug-auth-report.html
2022-07-12T22:00:39.000 INF AUTH skipping writing of JSON cookie report as there are no cookies to write
2022-07-12T22:00:40.000 FTL MAIN Authentication failed: failed to load login page: expected to find a single element for selector css:#manual_login to follow path to login form, found 0
2022-07-12 22:00:40,059 Browserker completed with exit code 1
2022-07-12 22:00:40,060 BrowserkerError: Failure while running Browserker 1.Exiting scan
sion.ExtensionLoader - Initializing Provides the foundation for concrete message types (for example, HTTP, WebSockets) expose fuzzer implementations.
[zap_server] 13499 [ZAP-daemon] INFO org.parosproxy.paros.extension.ExtensionLoader - Initializing Allows to fuzz HTTP messages.
It seems like container that is doing the dast scanning can't properly load the angular javascript file since it exceeds the allowed response size, and the actual login form does not load. Is there a way to increase the allowed size for the request so that we can have the login form properly load.
I've tried various options like setting the stability timeout variables, and even increasing the memory for the ZAP process (DAST_ZAP_CLI_OPTIONS: '-Xmx3072m' ). but am still getting the same result in that the login form isn't loading, most likely because the javascript isn't loading properly.
The fix looks like to be a gitlab/dast cicd variable issue that isn't in any of the current documentation that I could find.
In order to view all the options or parameters available I update the cicd file with the following:
include:
template: DAST.gitlab-ci.yml
dast:
script:
- /analyze --help
so I could see the options available. From this I was able to find DAST_BROWSER_MAX_RESPONSE_SIZE_MB variable to use. Setting that variable fixed my issue
I have written a scheduled function in node.js using typescript that successfully deploys.The related pub/sub topic gets created automatically but somehow the related scheduler job does not.
This is even after getting these lines
i scheduler: ensuring necessary APIs are enabled...
i pubsub: ensuring necessary APIs are enabled...
+ scheduler: all necessary APIs are enabled
+ pubsub: all necessary APIs are enabled
+ functions: created scheduler job firebase-schedule-myFunction-us-central1
+ functions[myFunction(us-central1)]: Successful create operation.
+ Deploy complete!
I have cloned the sample at https://github.com/firebase/functions-samples/tree/master/delete-unused-accounts-cron which deploys and automatically creates both the related pub/sub topic and scheduler job.
What could i be missing?
Try to change .timeZone('utc') (per the docs) to .timeZone('Etc/UTC') (also per the self-contradictory docs).
It seems that when using the 'every 5 minutes' syntax, the deploy does not create the scheduler job.
Switching to the cron syntax solved the problem for me
Maybe your cron syntax isn't correct. There are some tools to validate the syntax
Check your firebase-debug.log
At some point,it will invoke a POST request to:
>> HTTP REQUEST POST https://cloudscheduler.googleapis.com/v1beta1/projects/*project_name*/locations/*location*/jobs
This must be a 200 response.
I'm trying to use an end to end test runner to test that a modal shows up after a delay of 5 minutes.
The app is a single page web app, in this case React, and the testing framework, Cypress, and this has to run in a CircleCI build and deployment pipeline, with multiple environments (testing, staging, prod)
Here are the constraints I have:
I cannot wait 5 minutes for something that would take 50ms to test
If I make the delay configurable in the app's configuration, then all tests that go through this page will have a modal showing in 50ms instead of 5 minutes, polluting all other tests.
I'd prefer not to add hooks in the app just for the purpose of testing
Is there a clean way to test this without delay, keeping it overall very fast?
You could use cy.clock() to programmatically control all the time-related functions, including setTimeout.
Something like this should work:
// in your Cypress test...
cy.clock() // activate the clock mocking
// do your cy.visit() after cy.clock()
cy.tick(5 * 60 * 1000) // move time forwards 5 minutes
expect('.my-time-delay-modal').to.exist
There are more examples in the documentation.
I have the following scenario using Jmeter 3.3:
I would like to run "Get auth token" once every 2.5 minutes and meanwhile to run [GET] thread group non stop.
In other words, [GET] is taking the auth token from the first thread group and I would like to run them in parallel and only change the token once at 2.5 min.
I tried to add a Constant Timer to the first thread but the second thread is not running until the timer passed.
How can I keep the [GET] running non-stop and "Get Auth token" only once at 2.5min?
LE:
[GET] Thread is used for load tests and should be run with ~100 active users (all using the same token)
Constant Timer was added under HTTP Sampler
> Get Auth token
>> [POST] Auth token
>>> HTTP Header Manager
>>> Regular Expression Extractor
>>> Response Assertion
>>> Constant Timer
LE2:
I have tried adding a Test action under the first thread group. I did not manage to make Thread 2 run without waiting after Thread's 1 delay.
As per Functions and Variables User Manual chapter
Properties are not the same as variables. Variables are local to a thread; properties are common to all threads, and need to be referenced using the __P or __property function.
So I would suggest converting your authToken into a JMeter Property via __setProperty() function in Get auth token Thread Group and refering the value in Get Thread Group using __P() function so once the authToken value is updated all the threads will be using the new value instead of the old one.
More information: Knit One Pearl Two: How to Use Variables in Different Thread Groups
Occasionally (rarely) my Azure website will freeze and eventually return 502 errors (seems like it takes 5 min). I see a whole bunch of items in my trace log related to 'snapshot helper'.
I haven't explicitly used this and google only seems to return results for VMWare. Anyone know what this is? If it is azure taking a backup of my site, is there some way I can schedule it for an slower time than 11:00 am EST?
SnapshotHelper::TakeSnapshotInternal - no new files in CodeGen
SnapshotHelper::TakeSnapshot time since last: 01:19:59.9600775
SnapshotHelper::RestoreSnapshotInternal SUCCESS - File.Copy
SnapshotHelper::RestoreSnapshotInternal SUCCESS - process
SnapshotHelper::TakeSnapshotTimerCallback
SnapshotHelper::TakeSnapshotInternal - no new files in CodeGen
SnapshotHelper::TakeSnapshotTimerCallback
SnapshotHelper::TakeSnapshotInternal - no new files in CodeGen
SnapshotHelper::TakeSnapshot time since last: 00:19:59.9866142
SnapshotHelper::TakeSnapshotTimerCallback
SnapshotHelper::TakeSnapshotInternal - no new files in CodeGen
I don't think you have control over when backups occur, but you can add a second redundant VM so that users will hit this one if the first is unavailable.