Files
lasuite-drive/load-tests/scripts/prep_file.groovy
Nathan Vasse f7136473af 🔧(load-tests) declare the file size in the upload scenarios
Item creation now rejects a file without a reservation, so both session
scenarios would fail at the upload step. The size is read from the file the
scenario is about to send, keeping the generated traffic realistic.
2026-10-01 09:54:11 +02:00

12 lines
636 B
Groovy

// Splits the current upfile_N entry ("relative dir" + SEP + "absolute path"
// + SEP + "name", see plan_upload.groovy) and resolves the parent item id
// and mimetype for the file about to be uploaded.
def parts = vars.get("current_upfile").split("\u001F", 3)
def relDir = parts[0]
vars.put("cf_parent", relDir.isEmpty() ? vars.get("folder_id") : vars.get("upfid_" + relDir))
vars.put("cf_abs", parts[1])
vars.put("cf_size", String.valueOf(new File(vars.get("cf_abs")).length()))
vars.put("cf_name", parts[2])
def mime = java.net.URLConnection.guessContentTypeFromName(parts[2])
vars.put("cf_mime", mime ?: "application/octet-stream")