mirror of https://github.com/fluxcd/cli-utils.git
				
				
				
			Merge pull request #553 from karlkfi/karl-example-summary
chore: Add example test summary
This commit is contained in:
		
						commit
						8aaf73964a
					
				
							
								
								
									
										11
									
								
								Makefile
								
								
								
								
							
							
						
						
									
										11
									
								
								Makefile
								
								
								
								
							| 
						 | 
				
			
			@ -18,7 +18,7 @@ prow-presubmit-check: \
 | 
			
		|||
 | 
			
		||||
.PHONY: prow-presubmit-check-e2e
 | 
			
		||||
prow-presubmit-check-e2e: \
 | 
			
		||||
	test-e2e verify-kapply-e2e
 | 
			
		||||
	install-column-apt test-e2e verify-kapply-e2e
 | 
			
		||||
 | 
			
		||||
fix:
 | 
			
		||||
	go fix ./...
 | 
			
		||||
| 
						 | 
				
			
			@ -26,6 +26,15 @@ fix:
 | 
			
		|||
fmt:
 | 
			
		||||
	go fmt ./...
 | 
			
		||||
 | 
			
		||||
# Install column (required by verify-kapply-e2e)
 | 
			
		||||
# Update is included because the kubekins-e2e container build strips out the package cache.
 | 
			
		||||
# In newer versions of debian, column is in the bsdextrautils package,
 | 
			
		||||
# but in buster (used by kubekins-e2e) it's in bsdmainutils.
 | 
			
		||||
.PHONY: install-column-apt
 | 
			
		||||
install-column-apt:
 | 
			
		||||
	apt-get update
 | 
			
		||||
	apt-get install -y bsdmainutils
 | 
			
		||||
 | 
			
		||||
install-stringer:
 | 
			
		||||
	(which $(GOPATH)/bin/stringer || go install golang.org/x/tools/cmd/stringer@v0.1.5)
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -11,7 +11,7 @@ GREEN='\033[0;32m'
 | 
			
		|||
RED='\033[0;31m'
 | 
			
		||||
NC='\033[0m' # No Color
 | 
			
		||||
 | 
			
		||||
succeeded=0
 | 
			
		||||
results=()
 | 
			
		||||
failed=0
 | 
			
		||||
 | 
			
		||||
function run_test() {
 | 
			
		||||
| 
						 | 
				
			
			@ -27,19 +27,29 @@ for path in examples/alphaTestExamples/*.md; do
 | 
			
		|||
    if run_test "${path}"; then
 | 
			
		||||
        echo
 | 
			
		||||
        echo -e "${GREEN}Example Test Succeeded: ${test_name}${NC}"
 | 
			
		||||
        let "succeeded+=1"
 | 
			
		||||
        results+=("${test_name}\t${GREEN}Succeeded${NC}")
 | 
			
		||||
    else
 | 
			
		||||
        echo
 | 
			
		||||
        echo -e "${RED}Example Test Failed: ${test_name}${NC}"
 | 
			
		||||
        let "failed+=1"
 | 
			
		||||
        results+=("${test_name}\t${RED}Failed${NC}")
 | 
			
		||||
    fi
 | 
			
		||||
  echo
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
(
 | 
			
		||||
    echo -e "TEST\tRESULT"
 | 
			
		||||
    for result in "${results[@]}"; do
 | 
			
		||||
        echo -e "${result}"
 | 
			
		||||
    done
 | 
			
		||||
) | column -t
 | 
			
		||||
 | 
			
		||||
echo
 | 
			
		||||
 | 
			
		||||
if [[ ${failed} -gt 0 ]]; then
 | 
			
		||||
    echo -e "${RED}Example Tests Complete (succeeded: ${succeeded}, failed: ${failed})${NC}"
 | 
			
		||||
    echo -e "${RED}Example Tests Failed${NC}"
 | 
			
		||||
    exit 1
 | 
			
		||||
else
 | 
			
		||||
    echo -e "${GREEN}Example Tests Complete (succeeded: ${succeeded}, failed: ${failed})${NC}"
 | 
			
		||||
    echo -e "${GREEN}Example Tests Succeeded${NC}"
 | 
			
		||||
    exit 0
 | 
			
		||||
fi
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue