Changeset - bf565812b1e6
[Not reviewed]
0 1 0
Branko Majic (branko) - 18 days ago 2024-09-09 22:09:27
branko@majic.rs
MAR-218: Reimplement linting supports in test runner scrupt:

- Molecule no longer has command for running the linters, so a small
wrapper around linters has to be implemented.
1 file changed with 19 insertions and 2 deletions:
0 comments (0 inline, 0 general)
scripts/run_tests.sh
Show inline comments
 
@@ -284,14 +284,31 @@ for role in "${roles_to_test[@]}"; do
 
    fi
 

	
 
    info "Running tests for: $role"
 
    molecule_result=0
 
    if [[ $tests == all ]]; then
 

	
 
        molecule test --destroy always 2>&1 | tee "$report_file"
 
        last_pipe_status="${PIPESTATUS[0]}"
 
        [[ $last_pipe_status == 0 ]] || molecule_result="$last_pipe_status"
 

	
 
    elif [[ $tests == lint ]]; then
 
        molecule lint 2>&1 | tee "$report_file"
 

	
 
        flake8 . 2>&1 | tee "$report_file"
 
        last_pipe_status="${PIPESTATUS[0]}"
 
        [[ $last_pipe_status == 0 ]] || molecule_result="$last_pipe_status"
 

	
 
        yamllint . 2>&1 | tee "$report_file"
 
        last_pipe_status="${PIPESTATUS[0]}"
 
        [[ $last_pipe_status == 0 ]] || molecule_result="$last_pipe_status"
 

	
 
        ansible-lint --quiet . 2>&1 | tee "$report_file"
 
        last_pipe_status="${PIPESTATUS[0]}"
 
        [[ $last_pipe_status == 0 ]] || molecule_result="$last_pipe_status"
 

	
 
    fi
 

	
 
    # Determine result.
 
    if [[ "${PIPESTATUS[0]}" == 0 ]]; then
 
    if [[ $molecule_result == 0 ]]; then
 
        passed_roles+=("$role")
 

	
 
        # Log failure in summary if requested.
0 comments (0 inline, 0 general)