Merge pull request #273 from monopole/addDemoTest

add demo testing
This commit is contained in:
k8s-ci-robot 2018-02-09 23:26:50 -08:00 committed by GitHub
commit 4784e8b60d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 23 deletions

View File

@ -10,6 +10,7 @@ before_install:
- go get -u github.com/golang/lint/golint
- go get -u golang.org/x/tools/cmd/goimports
- go get -u github.com/onsi/ginkgo/ginkgo
- go get -u github.com/monopole/mdrip
# Install must be set to prevent default `go get` to run.
# The dependencies have already been vendored by `dep` so

View File

@ -30,4 +30,8 @@ echo "Running go test"
go test -v ./...
rc=$((rc || $?))
echo "Testing kinflate demos"
mdrip --mode test --label test ./cmd/kinflate
rc=$((rc || $?))
exit $rc

View File

@ -3,19 +3,19 @@
These resources work as is. To optionally confirm this,
apply it to your cluster.
<!-- @runKinflate @demo -->
<!-- @runKinflate -->
```
kubectl apply -f $TUT_APP
```
<!-- @showResources @demo -->
<!-- @showResources -->
```
kubectl get deployments
```
Define some functions to query the server directly:
<!-- @funcGetAddress @env @test -->
<!-- @funcGetAddress -->
```
function tut_getServiceAddress {
local name=$1
@ -33,14 +33,14 @@ function tut_query {
Query it:
<!-- @query @demo -->
<!-- @query -->
```
tut_query tut-service peach
```
All done. Clear the cluster for the next example.
<!-- @query @demo -->
<!-- @query -->
```
kubectl delete deployment tut-deployment
kubectl delete service tut-service

View File

@ -31,7 +31,7 @@ Compare to see result:
<!-- @checkDiffs @test -->
```
diff $TUT_TMP/original_out $TUT_TMP/customized_out
diff $TUT_TMP/original_out $TUT_TMP/customized_out || true
```
## Labels and annotations
@ -54,7 +54,7 @@ EOF
kinflate inflate -f $TUT_APP >$TUT_TMP/customized_out
```
<!-- @checkDiffsAgain @test -->
<!-- @checkDiffsAgain -->
```
diff $TUT_TMP/original_out $TUT_TMP/customized_out | more
```

View File

@ -26,7 +26,7 @@ kinflate init
<!-- @showIt @test -->
```
clear
more Kube-manifest.yaml
cat Kube-manifest.yaml
```
Write a resource file:
@ -56,20 +56,20 @@ Add it to the manifest:
kinflate add resource configMap.yaml
```
<!-- @showItAgain @test -->
<!-- @confirmIt @test -->
```
more Kube-manifest.yaml
grep configMap.yaml Kube-manifest.yaml
```
Add one that isn't there:
Attempt to add a missing resource; kinflate should complain.
<!-- @addNoResource @test -->
<!-- @addNoResource -->
```
kinflate add resource does_not_exist.yaml
```
Try to reinit
<!-- @initAgain @test -->
Try to reinit; kinflate should complain.
<!-- @initAgain -->
```
kinflate init
```

View File

@ -12,7 +12,7 @@ kinflate expects to find `Kube-manifest.yaml` in `$TUT_APP`.
The above command discovers the resources, processes them,
and emits the result to `stdout`.
<!-- @showOutput @test -->
<!-- @showOutput -->
```
more $TUT_TMP/original_out
```

View File

@ -9,7 +9,7 @@ structure:
find $TUT_APP
```
<!-- @compareKinflateOutput @test -->
<!-- @compareKinflateOutput -->
```
diff \
<(kinflate inflate -f $TUT_APP/staging) \
@ -31,33 +31,33 @@ kinflate inflate -f $TUT_APP/production
Deploy them:
<!-- @deployStaging @test -->
<!-- @deployStaging -->
```
kinflate inflate -f $TUT_APP/staging |\
kubectl apply -f -
```
<!-- @deployProduction @test -->
<!-- @deployProduction -->
```
kinflate inflate -f $TUT_APP/production |\
kubectl apply -f -
```
<!-- @getAll @demo -->
<!-- @getAll -->
```
kubectl get all
```
Delete the resources:
<!-- @deleteStaging @demo -->
<!-- @deleteStaging -->
```
kubectl delete configmap staging-acme-tut-map
kubectl delete service staging-acme-tut-service
kubectl delete deployment staging-acme-tut-deployment
```
<!-- @deleteProduction @demo -->
<!-- @deleteProduction -->
```
kinflate inflate -f $TUT_APP/production |\
kubectl delete -f -

View File

@ -7,12 +7,12 @@ A manifest is always called
> `Kube-manifest.yaml`
<!-- @defineManifest @demo -->
<!-- @defineManifest @test -->
```
export TUT_APP_MANIFEST=$TUT_APP/Kube-manifest.yaml
```
<!-- @makeManifest @demo -->
<!-- @makeManifest @test -->
```
cat <<'EOF' >$TUT_APP_MANIFEST