Add make test_status command (#7417)

* Add make test_status command

* improvement
This commit is contained in:
Frank Budinsky 2020-05-27 16:34:26 -04:00 committed by GitHub
parent a5fceca006
commit c4e7daaa99
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 86 additions and 1 deletions

View File

@ -162,6 +162,9 @@ endif
include tests/tests.mk
test_status:
@scripts/test_status.sh
# make lint-yaml seems to fail with pipefail, so remove now.
#SHELL = /bin/bash

75
scripts/test_status.sh Executable file
View File

@ -0,0 +1,75 @@
#!/bin/bash
# Copyright Istio Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
set -e
echo "Istio Documents Summary: \
$(find content/en/docs -name '*.md' -exec grep --quiet '^test: yes$' {} \; -print | wc -l) (tested) \
$(find content/en/docs -name '*.md' -exec grep --quiet '^test: no$' {} \; -print | wc -l) (untested) \
$(find content/en/docs -name '*.md' -exec grep --quiet '^test: n/a$' {} \; -print | wc -l) (n/a) \
$(find content/en/docs -name '*.md' -print | wc -l) (total)"
echo ""
echo "Tasks Docs"
echo "=========="
echo "Summary: \
$(find content/en/docs/tasks -name '*.md' -exec grep --quiet '^test: yes$' {} \; -print | wc -l) (tested) \
$(find content/en/docs/tasks -name '*.md' -exec grep --quiet '^test: no$' {} \; -print | wc -l) (untested) \
$(find content/en/docs/tasks -name '*.md' -exec grep --quiet '^test: n/a$' {} \; -print | wc -l) (n/a)"
echo ""
echo "Untested:"
find content/en/docs/tasks -name '*.md' -exec grep --quiet '^test: no$' {} \; -print
echo ""
echo "Examples Docs"
echo "============="
echo "Summary: \
$(find content/en/docs/examples -name '*.md' -exec grep --quiet '^test: yes$' {} \; -print | wc -l) (tested) \
$(find content/en/docs/examples -name '*.md' -exec grep --quiet '^test: no$' {} \; -print | wc -l) (untested) \
$(find content/en/docs/examples -name '*.md' -exec grep --quiet '^test: n/a$' {} \; -print | wc -l) (n/a)"
echo ""
echo "Untested:"
find content/en/docs/examples -name '*.md' -exec grep --quiet '^test: no$' {} \; -print
echo ""
echo "Setup Docs"
echo "=========="
echo "Summary: \
$(find content/en/docs/setup -name '*.md' -exec grep --quiet '^test: yes$' {} \; -print | wc -l) (tested) \
$(find content/en/docs/setup -name '*.md' -exec grep --quiet '^test: no$' {} \; -print | wc -l) (untested) \
$(find content/en/docs/setup -name '*.md' -exec grep --quiet '^test: n/a$' {} \; -print | wc -l) (n/a)"
echo ""
echo "Untested:"
find content/en/docs/setup -name '*.md' -exec grep --quiet '^test: no$' {} \; -print
echo ""
echo "Operations Docs"
echo "==============="
echo "Summary: \
$(find content/en/docs/ops -name '*.md' -exec grep --quiet '^test: yes$' {} \; -print | wc -l) (tested) \
$(find content/en/docs/ops -name '*.md' -exec grep --quiet '^test: no$' {} \; -print | wc -l) (untested) \
$(find content/en/docs/ops -name '*.md' -exec grep --quiet '^test: n/a$' {} \; -print | wc -l) (n/a)"
echo ""
echo "Untested:"
find content/en/docs/ops -name '*.md' -exec grep --quiet '^test: no$' {} \; -print

View File

@ -1,7 +1,7 @@
# Testing istio.io Content
This folder contains tests for the content on [istio.io](http://istio.io).
More specifically, these tests confirm that the example and task documents, which contain
More specifically, these tests confirm that the example, task, and other documents, which contain
instructions in the form of bash commands and expected output, are working as documented.
Generated bash scripts, containing the set of commands and expected output for corresponding
@ -11,6 +11,13 @@ This means that we extract and test the exact same commands that are published i
These tests use the framework defined in the `istioio` package, which is a thin wrapper
around the [Istio test framework](https://github.com/istio/istio/wiki/Istio-Test-Framework).
Run the following command to see the current test coverage, including the list of documents
that are in need of a test:
```sh
make test_status
```
## Test Authoring Overview
To write an `istio.io` test, follow these steps: