Skip to content

Commit 5983077

Browse files
committed
feat(gke-hyperdisk): improve FIO test validation
Updates the `test-gke-managed-hyperdisk.yml` ansible playbook to reliably execute the FIO benchmark. - Removes redundant debugging tasks. - Makes the job wait condition more specific. - Adds logging of the FIO test output. - Adds a cleanup step to delete the FIO job.
1 parent ca328b6 commit 5983077

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

tools/cloud-build/daily-tests/ansible_playbooks/test-validation/test-gke-managed-hyperdisk.yml

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,45 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
- name: Assert variables are defined
16+
ansible.builtin.assert:
17+
that:
18+
- region is defined
19+
- custom_vars.project is defined
20+
1521
- name: Get cluster credentials for kubectl
1622
delegate_to: localhost
1723
ansible.builtin.command: gcloud container clusters get-credentials {{ deployment_name }} --region {{ cli_deployment_vars.region }} --project {{ custom_vars.project }} --verbosity=debug
1824

19-
- name: List files in deployment directory
20-
delegate_to: localhost
21-
ansible.builtin.shell: |
22-
ls -l {{ workspace }}/{{ deployment_name }}
23-
register: file_list
24-
25-
- name: Print file list
26-
ansible.builtin.debug:
27-
var: file_list.stdout_lines
28-
29-
- name: Execute the job
25+
- name: Run the FIO benchmark job
3026
delegate_to: localhost
3127
ansible.builtin.shell: |
32-
job=({{ workspace }}/{{ deployment_name }}/fio-benchmark.yaml)
33-
kubectl create -f "$job" -v=9
28+
kubectl create -f {{ workspace }}/{{ deployment_name }}/fio-benchmark.yaml -v=9
3429
args:
3530
executable: /bin/bash
36-
changed_when: False
3731

38-
- name: Wait for job to complete
32+
- name: Wait for FIO Job to complete
3933
delegate_to: localhost
40-
ansible.builtin.command: |
41-
kubectl get job --field-selector status.successful=1 -v=9
42-
register: job_completion
43-
until: job_completion.stdout_lines | length > 0
34+
ansible.builtin.shell: |
35+
kubectl get job fio-benchmark --field-selector status.successful=1 -v=9
36+
register: fio_job_completion
37+
until: fio_job_completion.stdout_lines | length > 1
4438
retries: 80
4539
delay: 15
4640

47-
- name: Print job_completion debug output
48-
ansible.builtin.debug:
49-
var: job_completion.stdout_lines
41+
- name: Fetch logs from the FIO job pod and save to fio_pod_logs.txt
42+
delegate_to: localhost
43+
ansible.builtin.shell: |
44+
pod_name="$(kubectl get pods --no-headers -o custom-columns="Name:.metadata.name" -l job-name=fio-benchmark)"
45+
kubectl logs ${pod_name} > fio_pod_logs.txt
46+
cat fio_pod_logs.txt
47+
register: fio_test_logs
48+
49+
- name: Print the FIO test logs
50+
debug:
51+
msg: "{{fio_test_logs.stdout}}"
52+
53+
- name: Clean up FIO job
54+
delegate_to: localhost
55+
ansible.builtin.shell: |
56+
kubectl delete job fio-benchmark -v=9

0 commit comments

Comments
 (0)