Skip to content

Test-wide Tags: CLI tags overwrites code tags #220

@chaosbox

Description

@chaosbox

Brief summary

Our current setup uses the "k6-operator" for test orchestration, recent upgrade brought in a change that adds a couple of additional tags which are passed to the runner. As a result, the code level tags are being ignored, we noticed that there is a test that covers this specific use-case. We would like to understand if this is by design? it wasnt very clear from the documentation if its mutually exclusive.

Considering the current tag implementation which is a map, it will be useful to be able to merge the tags from multiple layers. If you think its useful, we can open a PR and push the small change, otherwise we need to open a PR in the operator or refactor our scripts to pass test-wide tags as a CLI args. If we have custom code to determine tag values, it might be useful to have the merge operation especially if we are going the operator route.

Operator adds default instance_id and job_name tags here

k6 version

0.43.1

OS

linux

Docker version and image (if applicable)

No response

Steps to reproduce the problem

Script: Global options contains the "testScenario" tag

import http from 'k6/http';

export default function () {
	http.get('https://test-api.k6.io/');
};

export const options = {
	discardResponseBodies: true,
	tags: {
		testScenario: "peak-load",
	}
};

Expected behaviour

k6 run -d 10s -i 2 ./example.js --out csv --tag cliTag=test

Output:
http_req_receiving,1682596478,0.155000,,,,true,,GET,https://test-api.k6.io/,HTTP/1.1,default,,200,,tls1.3,https://test-api.k6.io/,cliTag=test,testScenario=peak-load,

Actual behaviour

Output:
http_req_receiving,1682596478,0.155000,,,,true,,GET,https://test-api.k6.io/,HTTP/1.1,default,,200,,tls1.3,https://test-api.k6.io/,cliTag=test,

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestevaluation neededRequires research or additional feedback.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions