@@ -939,23 +939,29 @@ stress_testing() {
939
939
fi
940
940
}
941
941
942
- # Run the tests for the current scenario
943
- run_tests () {
944
- local vmname=" ${1} "
945
- local full_vmname
946
- full_vmname=" $( full_vm_name " ${vmname} " ) "
942
+ # Apply RUN_HOST_OVERRIDE logic if needed
943
+ apply_host_override () {
944
+ local -n vmname_ref=" $1 "
947
945
if [[ -n " ${RUN_HOST_OVERRIDE} " ]]; then
948
- vmname=" ${RUN_HOST_OVERRIDE} "
949
- full_vmname=" $( full_vm_name " ${vmname} " ) "
946
+ vmname_ref=" ${RUN_HOST_OVERRIDE} "
947
+ local full_vmname
948
+ local ip
949
+ full_vmname=" $( full_vm_name " ${vmname_ref} " ) "
950
950
ip=$( get_vm_ip " ${full_vmname} " )
951
- set_vm_property " ${vmname } " " ip" " ${ip} "
952
- set_vm_property " ${vmname } " " ssh_port" " 22"
953
- set_vm_property " ${vmname } " " api_port" " 6443"
954
- set_vm_property " ${vmname } " " lb_port" " 5678"
951
+ set_vm_property " ${vmname_ref } " " ip" " ${ip} "
952
+ set_vm_property " ${vmname_ref } " " ssh_port" " 22"
953
+ set_vm_property " ${vmname_ref } " " api_port" " 6443"
954
+ set_vm_property " ${vmname_ref } " " lb_port" " 5678"
955
955
fi
956
+ }
956
957
957
- shift
958
+ # Run the tests for the current scenario
959
+ run_tests () {
960
+ local vmname=" ${1} "
961
+ # Handle RUN_HOST_OVERRIDE
962
+ apply_host_override vmname
958
963
964
+ shift
959
965
echo " Running tests with $# args" " $@ "
960
966
961
967
if [ ! -d " ${RF_VENV} " ]; then
@@ -1016,6 +1022,7 @@ run_tests() {
1016
1022
local -r api_port=$( get_vm_property " ${vmname} " " api_port" )
1017
1023
local -r lb_port=$( get_vm_property " ${vmname} " " lb_port" )
1018
1024
local -r vm_ip=$( get_vm_property " ${vmname} " " ip" )
1025
+ local -r full_vmname=" $( full_vm_name " ${vmname} " ) "
1019
1026
1020
1027
local variable_file=" ${SCENARIO_INFO_DIR} /${SCENARIO} /variables.yaml"
1021
1028
echo " Writing variables to ${variable_file} "
@@ -1069,6 +1076,81 @@ EOF
1069
1076
fi
1070
1077
}
1071
1078
1079
+ # Implementation of Gingko tests
1080
+ run_gingko_tests () {
1081
+ local vmname=" ${1} "
1082
+ shift
1083
+
1084
+ # Handle RUN_HOST_OVERRIDE
1085
+ apply_host_override vmname
1086
+
1087
+ # Save current directory
1088
+ pushd . & > /dev/null
1089
+
1090
+ # Check/install oc
1091
+ " ${ROOTDIR} /scripts/fetch_tools.sh" " oc" || {
1092
+ record_junit " ${vmname} " " oc_installed" " FAILED"
1093
+ exit 1
1094
+ }
1095
+
1096
+ # Check/get openshift-tests-binary
1097
+ if ! " ${ROOTDIR} /scripts/fetch_tools.sh" " ginkgo" ; then
1098
+ record_junit " ${vmname} " " build_test_binary" " FAILED"
1099
+ exit 1
1100
+ fi
1101
+ record_junit " ${vmname} " " build_test_binary" " OK"
1102
+
1103
+ # Set up test environment variables
1104
+ local -r test_results_dir=" ${SCENARIO_INFO_DIR} /${SCENARIO} /gingko-results"
1105
+ mkdir -p " ${test_results_dir} "
1106
+
1107
+ # Set up kubeconfig for tests
1108
+ local -r kubeconfig_file=" ${test_results_dir} /kubeconfig"
1109
+ local -r vm_ip=$( get_vm_property " ${vmname} " " ip" )
1110
+ local -r full_vmname=" $( full_vm_name " ${vmname} " ) "
1111
+ local -r vm_hostname=" ${full_vmname/ ./ -} "
1112
+
1113
+ # Get kubeconfig
1114
+ run_command_on_vm " ${vmname} " " sudo cp /var/lib/microshift/resources/kubeadmin/${vm_hostname} /kubeconfig /home/redhat/kubeconfig-${vm_hostname} " || {
1115
+ error " Failed to copy kubeconfig from /var/lib/microshift/resources/kubeadmin/${vm_hostname} /kubeconfig"
1116
+ record_junit " ${vmname} " " setup_kubeconfig" " FAILED"
1117
+ popd & > /dev/null
1118
+ exit 1
1119
+ }
1120
+ run_command_on_vm " ${vmname} " " sudo chown redhat:redhat /home/redhat/kubeconfig-${vm_hostname} "
1121
+
1122
+ # Download kubeconfig to local file
1123
+ copy_file_from_vm " ${vmname} " " /home/redhat/kubeconfig-${vm_hostname} " " ${kubeconfig_file} " || {
1124
+ error " Failed to download kubeconfig from VM"
1125
+ record_junit " ${vmname} " " setup_kubeconfig" " FAILED"
1126
+ popd & > /dev/null
1127
+ exit 1
1128
+ }
1129
+ record_junit " ${vmname} " " setup_kubeconfig" " OK"
1130
+
1131
+ export KUBECONFIG=" ${kubeconfig_file} "
1132
+
1133
+ # Run the Gingko tests with MicroShift filter
1134
+ echo " Running Gingko tests with MicroShift filter..."
1135
+
1136
+ # Run the tests and capture output
1137
+ if ! " ${GINKGO_TEST_BINARY} " run all --dry-run | grep " MicroShift" | " ${GINKGO_TEST_BINARY} " run -f - --timeout 60m 2>&1 | tee " ${test_results_dir} /test-output.log" ; then
1138
+ echo " Some Gingko tests may have failed. Check results for details."
1139
+ record_junit " ${vmname} " " run_gingko_tests" " FAILED"
1140
+ return 1
1141
+ fi
1142
+
1143
+ record_junit " ${vmname} " " run_gingko_tests" " OK"
1144
+ popd & > /dev/null
1145
+
1146
+ # Display results summary
1147
+ echo " Gingko test execution completed"
1148
+ echo " Results are available in: ${test_results_dir} "
1149
+ if [[ -f " ${test_results_dir} /test-output.log" ]]; then
1150
+ echo " Test output log: ${test_results_dir} /test-output.log"
1151
+ fi
1152
+ }
1153
+
1072
1154
load_global_settings () {
1073
1155
local filename=" ${TESTDIR} /scenario_settings.sh"
1074
1156
if [ ! -f " ${filename} " ]; then
@@ -1224,11 +1306,10 @@ action_run() {
1224
1306
1225
1307
if [ $# -eq 0 ]; then
1226
1308
RUN_HOST_OVERRIDE=" "
1227
- check_dependencies
1309
+ check_dependencies
1228
1310
else
1229
1311
RUN_HOST_OVERRIDE=" $1 "
1230
1312
fi
1231
-
1232
1313
scenario_run_tests
1233
1314
record_junit " run" " scenario_run_tests" " OK"
1234
1315
}
0 commit comments