Test Automation for ops/configuration/mesh/config-resource-ready (#8823)

* Test Automation

* Fix cleanup after test

* Pass 'y' to 'istioctl install'

* clean up the cleanup section
This commit is contained in:
Ed Snible 2021-01-26 09:43:28 -05:00 committed by GitHub
parent 456bc9e78f
commit d475797544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 3 deletions

View File

@ -3,7 +3,7 @@ title: Wait on Resource Status for Applied Configuration
description: Describes how to wait until a resource reaches a given status of readiness.
weight: 15
owner: istio/wg-user-experience-maintainers
test: no
test: yes
---
{{< warning >}}
@ -30,7 +30,7 @@ status, which Istio updates as it propagates configuration changes.
This feature is off by default. Enable the `status` field as part of Istio
installation using the following command.
{{< text bash >}}
{{< text syntax=bash snip_id=install_with_enable_status >}}
$ istioctl install --set values.pilot.env.PILOT_ENABLE_STATUS=true --set values.global.istiod.enableAnalysis=true
{{< /text >}}
@ -40,10 +40,11 @@ You can apply a change and then wait for completion. For example, to wait for a
service, use
the following commands:
{{< text bash >}}
{{< text syntax=bash snip_id=apply_and_wait_for_httpbin_vs >}}
$ kubectl apply -f @samples/httpbin/httpbin.yaml@
$ kubectl apply -f @samples/httpbin/httpbin-gateway.yaml@
$ kubectl wait --for=condition=Reconciled virtualservice/httpbin
virtualservice.networking.istio.io/httpbin condition met
{{< /text >}}
This blocking command does not release until the virtual service has been

View File

@ -0,0 +1,35 @@
#!/bin/bash
# shellcheck disable=SC2034,SC2153,SC2155,SC2164
# Copyright Istio Authors. All Rights Reserved.
#
# 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.
####################################################################################################
# WARNING: THIS IS AN AUTO-GENERATED FILE, DO NOT EDIT. PLEASE MODIFY THE ORIGINAL MARKDOWN FILE:
# docs/ops/configuration/mesh/config-resource-ready/index.md
####################################################################################################
snip_install_with_enable_status() {
istioctl install --set values.pilot.env.PILOT_ENABLE_STATUS=true --set values.global.istiod.enableAnalysis=true
}
snip_apply_and_wait_for_httpbin_vs() {
kubectl apply -f samples/httpbin/httpbin.yaml
kubectl apply -f samples/httpbin/httpbin-gateway.yaml
kubectl wait --for=condition=Reconciled virtualservice/httpbin
}
! read -r -d '' snip_apply_and_wait_for_httpbin_vs_out <<\ENDSNIP
virtualservice.networking.istio.io/httpbin condition met
ENDSNIP

View File

@ -0,0 +1,39 @@
#!/usr/bin/env bash
# shellcheck disable=SC1090,SC2154
# 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 # Exit on failure
set -u # Unset is an error
# There is no need to echo, output appears in TestDocs/ops/configuration/mesh/config-resource-ready/test.sh/test.sh/_test_context/test.sh_debug.txt
set -o pipefail
# This script doesn't need a control plane initially and will install Istio when needed
# @setup profile=none
echo '*** config-resource-ready step 1 ***'
echo y | snip_install_with_enable_status
echo '*** istioctl-analyze step 2 ***'
_verify_contains snip_apply_and_wait_for_httpbin_vs "$snip_apply_and_wait_for_httpbin_vs_out"
# @cleanup
# Note that the framework automatically turns off errexit, thus this works if the test partially fails
kubectl delete -f samples/httpbin/httpbin.yaml
kubectl delete -f samples/httpbin/httpbin-gateway.yaml
# Delete the Istio this test installed
echo y | istioctl x uninstall --revision "default"
kubectl delete ns istio-system