Skip to content

Commit

Permalink
feat(ui): improve the memory check output (#511)
Browse files Browse the repository at this point in the history
* feat(ui): improve the memory check output

* feat(test): update memory check output tests
  • Loading branch information
bitcoin-tools authored Apr 6, 2024
1 parent 1a235c9 commit f1ef7ec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nodebuilder
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ Darwin) ;; #TODO: Add macOS memory check
swap_memory_free_in_mib="$(get_memory_metric_in_mib 'SwapFree')"
memory_total_in_mib=$((physical_memory_total_in_mib + swap_memory_total_in_mib))
memory_free_in_mib=$((physical_memory_free_in_mib + swap_memory_free_in_mib))
printf '%0.1f GiB free of %0.1f GiB.\n' \
printf '%0.1f of %0.1f GiB free.\n' \
"$(awk -v mem_free_mib="${memory_free_in_mib}" -v mib_gib_factor="${MIB_TO_GIB}" 'BEGIN{printf "%f\n", mem_free_mib / mib_gib_factor}')" \
"$(awk -v mem_total_mib="${memory_total_in_mib}" -v mib_gib_factor="${MIB_TO_GIB}" 'BEGIN{printf "%f\n", mem_total_mib / mib_gib_factor}')"

Expand Down
8 changes: 4 additions & 4 deletions test/test_nodebuilder
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if [ "$(uname -s)" != "Darwin" ]; then
"Performing a system upgrade... ok.$" \
"Checking for dependencies... ok.$" \
"Creating application shortcuts... ok.$" \
"Checking the memory on your system... [0-9]+\.[0-9] GiB free of [0-9]+\.[0-9] GiB.$"; do
"Checking the memory on your system... [0-9]+\.[0-9] of [0-9]+\.[0-9] GiB free.$"; do
if ! grep -Eq "${message}" output_stdout.txt > /dev/null 2>&1; then
printf '%s\n' "FAILURE: Expected message ${message} not found."
exit 1
Expand All @@ -72,12 +72,12 @@ if [ "$(uname -s)" != "Darwin" ]; then
fi

for message in \
"apt-utils 1" \
"apt-utils" \
"libzmq" \
"BDB" \
"Berkeley DB" \
"Checking the memory on your system... 0 GiB free of 0 GiB." \
"Checking the memory on your system... 0.0 GiB free of 0.0 GiB." \
"Checking the memory on your system... 0 GiB of 0 GiB free." \
"Checking the memory on your system... 0.0 GiB of 0.0 GiB free." \
"Checking free space in home directory... 0 GiB." \
"Sync progress: [0-9]+\.[0-9]{4} %" \
"Disk free space: (0 G|[0-9]+ M)iB"; do
Expand Down

0 comments on commit f1ef7ec

Please sign in to comment.