test: separated with tags common language runtime e2e tests from othe… (#492)

* test: separated with tags common language runtime e2e tests from other e2e tests

* test: rewording e2e scripts and tags to better represent its purposes
This commit is contained in:
jrangelramos 2021-08-25 17:14:31 -03:00 committed by GitHub
parent f2efbe5b42
commit 5f843f09f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 68 additions and 29 deletions

View File

@ -150,11 +150,3 @@ jobs:
run: ./hack/test.sh
- name: E2E Test
run: make test-e2e
#- name: E2E Test Go
# run: ./test/run_e2e_test.sh go
#- name: E2E Test Python
# run: ./test/run_e2e_test.sh python
#- name: E2E Test Quarkus
# run: ./test/run_e2e_test.sh quarkus
#- name: E2E Test Springboot
# run: ./test/run_e2e_test.sh springboot

View File

@ -124,7 +124,8 @@ test-integration: ## Run integration tests using an available cluster.
go test -tags integration ./... -v
test-e2e: ## Run end-to-end tests using an available cluster.
./test/run_e2e_test.sh
./test/e2e_lifecycle_tests.sh node
./test/e2e_extended_tests.sh
######################

View File

@ -1,4 +1,4 @@
// +build e2e e2efunc
// +build e2elc
package e2e

View File

@ -1,4 +1,4 @@
// +build e2e
// +build e2e e2elc
package e2e

View File

@ -25,11 +25,10 @@ func (s SimpleTestEvent) pushTo(url string, t *testing.T) (body string, statusCo
req.Header.Add("Content-Type", s.ContentType)
resp, err := client.Do(req)
t.Logf("event POST %v -> %v", url, resp.Status)
if err != nil {
return "", 0, err
}
t.Logf("event POST %v -> %v", url, resp.Status)
defer resp.Body.Close()
b, err := ioutil.ReadAll(resp.Body)
if err != nil {

51
test/e2e_extended_tests.sh Executable file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
# 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
#
# https://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.
#
# Runs E2E additional set of tests against kn func cli.
# By default it will run e2e tests against 'func' binary, but you can change it to use 'kn func' instead
#
# The following environment variable can be set in order to customize e2e execution:
#
# E2E_USE_KN_FUNC When set to "true" indicates e2e to issue func command using kn cli.
#
# E2E_REGISTRY_URL Indicates a specific registry (i.e: "quay.io/user") should be used. Make sure
# to authenticate to the registry (i.e: docker login ...) prior to execute the script
#
# E2E_FUNC_BIN_PATH Path to func binary. Derived by this script
#
set -o errexit
set -o nounset
set -o pipefail
use_kn_func=${E2E_USE_KN_FUNC:-}
curdir=$(pwd)
cd $(dirname $0)
cd ../
# Make sure 'func' binary is built in case KN FUNC was not required for testing
if [[ ! -f func && "$use_kn_func" != "true" ]]; then
echo "func binary not found. Please run 'make build' prior to run e2e."
exit 1
fi
export E2E_FUNC_BIN_PATH=$(pwd)/func
go clean -testcache
go test -v -test.v -tags="e2e" ./test/_e2e/
ret=$?
cd $curdir
exit $ret

View File

@ -12,9 +12,14 @@
# limitations under the License.
#
# Runs E2E tests against for func cli.
# Runs basic lifecycle E2E tests against kn func cli for a given language/runtime.
# By default it will run e2e tests against 'func' binary, but you can change it to use 'kn func' instead
#
# Use:
# ./e2e_lifecycle_tests.sh <language> (defaults to "node")
# Example:
# ./e2e_lifecycle_tests.sh python
#
# The following environment variable can be set in order to customize e2e execution:
#
# E2E_USE_KN_FUNC When set to "true" indicates e2e to issue func command using kn cli.
@ -24,26 +29,19 @@
#
# E2E_FUNC_BIN_PATH Path to func binary. Derived by this script
#
# In additional to these env variables, for convinience you can run only the tests specific per runtime
# without running other e2e tests, by passing the runtime as an argument for this script. Example:
#
# ./run_e2e_test.sh python
#
set -o errexit
set -o nounset
set -o pipefail
runtime=${1:-}
tag=e2e
use_kn_func=${E2E_USE_KN_FUNC:-}
curdir=`pwd`
cd `dirname $0`
projectdir=../
cd $projectdir
curdir=$(pwd)
cd $(dirname $0)
cd ../
# Make sure 'func' binary is built in case KN FUNC was not required for this test
# Make sure 'func' binary is built in case KN FUNC was not required for testing
if [[ ! -f func && "$use_kn_func" != "true" ]]; then
echo "func binary not found. Please run 'make build' prior to run e2e."
exit 1
@ -51,14 +49,12 @@ fi
if [[ "$runtime" != "" ]]; then
export E2E_RUNTIME=$runtime
tag=e2efunc
fi
export E2E_FUNC_BIN_PATH=`pwd`/func
echo Binary $E2E_FUNC_BIN_PATH
export E2E_FUNC_BIN_PATH=$(pwd)/func
go clean -testcache
go test -v -test.v -tags="${tag}" ./test/_e2e/
go test -v -test.v -tags="e2elc" ./test/_e2e/
ret=$?
cd $curdir