Skip to content

Commit

Permalink
ci: add test for the files should be created
Browse files Browse the repository at this point in the history
Signed-off-by: Vicente Cheng <[email protected]>
(cherry picked from commit 28fb14a)
  • Loading branch information
Vicente-Cheng committed Jan 4, 2024
1 parent df39bc7 commit 4b6f3a6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ci/run_vagrant_install_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@
args:
chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform"

- name: Testing existing files
vars:
settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml"
shell: >
./check_files.sh {{ settings_file}}
args:
chdir: "{{ WORKSPACE }}/harvester-installer/ci/terraform"

- name: Testing services status
vars:
settings_file: "{{ WORKSPACE }}/ipxe-examples/vagrant-pxe-harvester/settings.yml"
Expand Down
23 changes: 23 additions & 0 deletions ci/terraform/check_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/bash -ex

if [[ $# != 1 ]]
then
echo "We need the settings.yaml from ipxe repo"
exit 1
fi

SETTINGS=$1

EXISTING_FILES="/oem/grubenv /oem/grubcustom"
NODE0_IP=$(yq e ".harvester_network_config.cluster[0].ip" ${SETTINGS})

echo "Check files that should exist."

SSHKEY=./tmp-ssh-key
for filepath in ${EXISTING_FILES}; do
echo "Prepare to check file: ${filepath} ..."
if ! ssh -o "StrictHostKeyChecking no" -i tmp-ssh-key rancher@$NODE0_IP "sudo stat ${filepath}" | grep -q ${filepath}; then
echo "${filepath} should exist, exit!"
exit 1
fi
done

0 comments on commit 4b6f3a6

Please sign in to comment.