Skip to content

Commit 79c896c

Browse files
Merge pull request #5851 from pacevedom/USHIFT-6358
USHIFT-6358: Fix CoreDNS flaky test
2 parents e956e17 + 2d015db commit 79c896c

File tree

3 files changed

+38
-9
lines changed

3 files changed

+38
-9
lines changed

test/scenarios-bootc/presubmits/[email protected]

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ scenario_remove_vms() {
1212
}
1313

1414
scenario_run_tests() {
15+
# The SYNC_FREQUENCY is set to a shorter-than-default value to speed up
16+
# pre-submit scenario completion time in DNS tests.
1517
run_tests host1 \
1618
--variable "EXPECTED_OS_VERSION:9.6" \
19+
--variable "SYNC_FREQUENCY:5s" \
1720
suites/standard1/ suites/selinux/validate-selinux-policy.robot
1821
}

test/scenarios/presubmits/[email protected]

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@ scenario_remove_vms() {
1212
}
1313

1414
scenario_run_tests() {
15+
# The SYNC_FREQUENCY is set to a shorter-than-default value to speed up
16+
# pre-submit scenario completion time in DNS tests.
1517
run_tests host1 \
1618
--variable "EXPECTED_OS_VERSION:9.6" \
19+
--variable "SYNC_FREQUENCY:5s" \
1720
suites/standard1/ suites/selinux/validate-selinux-policy.robot
1821
}

test/suites/standard1/dns.robot

Lines changed: 32 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,12 @@ ${FAKE_LISTEN_IP} 99.99.99.99
2121
${CUSTOM_HOSTS_FILE} /tmp/hosts23
2222
${PODS_HOSTS_FILE} /tmp/hosts/hosts
2323
${HOSTNAME} ${EMPTY}
24+
${SYNC_FREQUENCY} ${EMPTY}
2425
${HOSTSFILE_ENABLED} SEPARATOR=\n
2526
... ---
2627
... dns:
2728
... \ \ hosts:
2829
... \ \ \ status: Enabled
29-
${HOSTS_CONFIG_CUSTOM} SEPARATOR=\n
30-
... ---
31-
... dns:
32-
... \ \ hosts:
33-
... \ \ \ status: Enabled
34-
... \ \ \ file: ${CUSTOM_HOSTS_FILE}
3530
${HOSTSFILE_DISABLED} SEPARATOR=\n
3631
... ---
3732
... dns:
@@ -48,13 +43,13 @@ Resolve Host from Default Hosts File
4843

4944
Resolve Host from Non-Default Hosts File
5045
[Documentation] Resolve host from default hosts file
51-
[Setup] Setup With Custom Config ${HOSTS_CONFIG_CUSTOM} ${CUSTOM_HOSTS_FILE}
46+
[Setup] Setup With Custom Hosts File
5247
Resolve Host From Pod ${HOSTNAME}
5348
[Teardown] Teardown Hosts File ${HOSTNAME}
5449

5550
Dynamic Hosts File Update Without Restart
5651
[Documentation] Verify hosts file changes are reflected without MicroShift or pod restarts
57-
[Setup] Setup With Custom Config ${HOSTS_CONFIG_CUSTOM} ${CUSTOM_HOSTS_FILE}
52+
[Setup] Setup With Custom Hosts File
5853
Resolve Host From Pod ${HOSTNAME}
5954
${updated_hostname}= Generate Random HostName
6055
Add Entry To Hosts ${FAKE_LISTEN_IP} ${updated_hostname} ${CUSTOM_HOSTS_FILE}
@@ -73,10 +68,33 @@ Disable CoreDNS Hosts And Verify ConfigMap Removed
7368

7469

7570
*** Keywords ***
71+
Get Hosts Config Custom
72+
[Documentation] Build hosts config with optional syncFrequency
73+
... syncFrequency is configurable in order to speed up the ConfigMap synchronization time
74+
... for the pods that mount it.
75+
IF "${SYNC_FREQUENCY}" != "${EMPTY}"
76+
${config}= Catenate SEPARATOR=\n
77+
... ---
78+
... kubelet:
79+
... \ \ syncFrequency: ${SYNC_FREQUENCY}
80+
... dns:
81+
... \ \ hosts:
82+
... \ \ \ status: Enabled
83+
... \ \ \ file: ${CUSTOM_HOSTS_FILE}
84+
ELSE
85+
${config}= Catenate SEPARATOR=\n
86+
... ---
87+
... dns:
88+
... \ \ hosts:
89+
... \ \ \ status: Enabled
90+
... \ \ \ file: ${CUSTOM_HOSTS_FILE}
91+
END
92+
RETURN ${config}
93+
7694
Resolve Host From Pod
7795
[Documentation] Resolve host from pod
7896
[Arguments] ${hostname}
79-
Wait Until Keyword Succeeds 40x 2s
97+
Wait Until Keyword Succeeds 40x 5s
8098
... Router Should Resolve Hostname ${hostname}
8199

82100
Router Should Resolve Hostname
@@ -95,6 +113,11 @@ Setup With Custom Config
95113
Drop In MicroShift Config ${config_content} 20-dns
96114
Restart MicroShift
97115

116+
Setup With Custom Hosts File
117+
[Documentation] Get custom hosts config and setup with it
118+
${config}= Get Hosts Config Custom
119+
Setup With Custom Config ${config} ${CUSTOM_HOSTS_FILE}
120+
98121
Teardown Hosts File
99122
[Documentation] Teardown the hosts file
100123
[Arguments] ${hostname}

0 commit comments

Comments
 (0)