-
Notifications
You must be signed in to change notification settings - Fork 103
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
Setting the customized path in handleSummary #69
Comments
Hello. The file name and output path can be changed as needed. For example, here there is a timestamp added to the filename, and a relative file path is specified as well, assuming /bfai is in the project root directory, which can be changed depending on your directory structure: export function handleSummary(data) {
const filePath = `./bfai/programs/report-summary/${formatDate(new Date())}--summary.html`;
return {
stdout: textSummary(data, { indent: ' ', enableColors: true }),
[filePath]: htmlReport(data),
};
} |
Hello, thank you for the comment. I have reviewed it carefully, but your comment appears to be on the file name rather than the path where the file will be saved. I think your process might be as follows. #inside the k6 runner pod
ls
/home/k6 ./bfai/programs/report-summary/${formatDate(new Date())}--summary.html However, I want #inside the k6 runner pod
ls
/home/k6 summary.html
#path inside the server
pwd
/bfai/program/report-summary summary.html So, I was wondering if there’s a way to achieve this without using a volume mount. If there are no other options, I am considering using a volume mount. To further elaborate on this comment, I was wondering if setting ENV variable is possible. I have some anticipated example. By executing the testrun-test.yaml as k6 distributed test, at first I thought the environment variable testrun-test.yaml
#test.js
export const fileName = __ENV.SUMMARY_NAME;
export function handleSummary(data, fileName) {
return { [`${fileName}.html`]: htmlReport(data) };
} However, after the k6 distributed test, the result showed up as
If this process is eventually resolved, I think setting the customized path would be also available; since I can just set the customized environment variable to save the summary result. |
I am not sure if you can save the file directly from |
Hello, how do you go into the pod to view the output file, I understand that this summary.html file will be generated after the end of the test, but the pod is not allowed to enter the pod after the end of the view |
Sorry for the late reply. You need to add Methodology is as follows. Testrun ScriptapiVersion: k6.io/v1alpha1
kind: TestRun
metadata:
name: testrun-module
namespace: k6-operator-system
...
# add volumeMounts in testrun script
volumeMounts:
- name: k6-report-summary-volume
mountPath: /home/k6
volumes:
- name: k6-report-summary-volume
persistentVolumeClaim:
claimName: report-summary-volume-claim PV, PVCapiVersion: v1
kind: PersistentVolume
metadata:
name: k6-report-summary-volume
spec:
persistentVolumeReclaimPolicy: Retain
capacity:
storage: 1Gi
accessModes:
- ReadWriteMany
hostPath:
path: "/bfai/programs/report-summary" # path to save summary.html file
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: report-summary-volume-claim
spec:
storageClassName: ""
volumeName: k6-report-summary-volume
accessModes:
- ReadWriteMany
resources:
requests:
storage: 1Gi Since I'm using 1. kubectl get pvc -n k6-operator-system
NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS VOLUMEATTRIBUTESCLASS AGE
report-summary-volume-claim Bound k6-report-summary-volume 1Gi RWX <unset> 34d
2. kubectl get pv -A
k6-report-summary-volume 1Gi RWX Retain Bound k6-operator-system/report-summary-volume-claim <unset> 34d
3. kubectl describe pv k6-report-summary-volume
Name: k6-report-summary-volume
Labels: <none>
Annotations: pv.kubernetes.io/bound-by-controller: yes
Finalizers: [kubernetes.io/pv-protection]
StorageClass:
Status: Bound
Claim: k6-operator-system/report-summary-volume-claim
Reclaim Policy: Retain
Access Modes: RWX
VolumeMode: Filesystem
Capacity: 1Gi
Node Affinity: <none>
Message:
Source:
Type: HostPath (bare host directory volume)
Path: /bfai/programs/report-summary
HostPathType:
Events: <none> So in my case, by adding
is mounted together. Therefore, right after the Hope this helps! |
Dear k6-reporter Community,
I hope this finds you well.
I am currently using the htmlReport function from the k6-reporter package to generate HTML reports for my distributed k6 test results, and I am encountering a specific challenge.
Would it be possible to specify the output path for
summary.html
within handleSummary? I understand that the default path is/home/k6
in the k6 runner pod. However, I would like to save it directly to/bfai/programs/report-summary
on the server, as I plan to volume mount this path in nginx to viewsummary.html
via the server.My goal is to include additional code to define the file path for
summary.html
explicitly.I would deeply appreciate your consideration.
Best regards,
Shin
The text was updated successfully, but these errors were encountered: