mirror of
https://github.com/tw93/Mole.git
synced 2026-03-22 21:20:09 +00:00
feat(clean): add opt-in Docker unused data pruning (#554)
* feat(clean): add opt-in Docker unused data pruning * fix(clean): make docker prune default --------- Co-authored-by: Tw93 <hitw93@gmail.com>
This commit is contained in:
@@ -160,24 +160,50 @@ EOF
|
||||
}
|
||||
|
||||
@test "clean_dev_docker skips when daemon not running" {
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" MO_DEBUG=1 DRY_RUN=false bash --noprofile --norc <<'EOF'
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" DRY_RUN=false bash --noprofile --norc <<'EOF'
|
||||
set -euo pipefail
|
||||
source "$PROJECT_ROOT/lib/core/common.sh"
|
||||
source "$PROJECT_ROOT/lib/clean/dev.sh"
|
||||
start_section_spinner() { :; }
|
||||
stop_section_spinner() { :; }
|
||||
run_with_timeout() { return 1; }
|
||||
clean_tool_cache() { echo "$1"; }
|
||||
safe_clean() { echo "$2"; }
|
||||
debug_log() { echo "$*"; }
|
||||
debug_log() { :; }
|
||||
docker() { return 1; }
|
||||
export -f docker
|
||||
clean_dev_docker
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Docker daemon not running"* ]]
|
||||
[[ "$output" != *"Docker build cache"* ]]
|
||||
[[ "$output" == *"Docker unused data · skipped (daemon not running)"* ]]
|
||||
[[ "$output" == *"Docker BuildX cache"* ]]
|
||||
[[ "$output" != *"Docker unused data|Docker unused data docker system prune -af --volumes"* ]]
|
||||
}
|
||||
|
||||
@test "clean_dev_docker prunes unused docker data when daemon is running" {
|
||||
run env HOME="$HOME" PROJECT_ROOT="$PROJECT_ROOT" DRY_RUN=false bash --noprofile --norc <<'EOF'
|
||||
set -euo pipefail
|
||||
source "$PROJECT_ROOT/lib/core/common.sh"
|
||||
source "$PROJECT_ROOT/lib/clean/dev.sh"
|
||||
start_section_spinner() { :; }
|
||||
stop_section_spinner() { :; }
|
||||
run_with_timeout() { shift; "$@"; }
|
||||
clean_tool_cache() { echo "$1|$*"; }
|
||||
safe_clean() { :; }
|
||||
note_activity() { :; }
|
||||
debug_log() { :; }
|
||||
docker() {
|
||||
if [[ "$1" == "info" ]]; then
|
||||
return 0
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
export -f docker
|
||||
clean_dev_docker
|
||||
EOF
|
||||
|
||||
[ "$status" -eq 0 ]
|
||||
[[ "$output" == *"Docker unused data|Docker unused data docker system prune -af --volumes"* ]]
|
||||
}
|
||||
|
||||
@test "clean_developer_tools runs key stages" {
|
||||
|
||||
Reference in New Issue
Block a user