From 8fe0036aead5c7ceaad1475c4429c17bc4833bb7 Mon Sep 17 00:00:00 2001 From: Prince-Chen <1572839226@qq.com> Date: Sun, 17 Sep 2023 22:03:18 +0800 Subject: [PATCH] Add : Support e2e( under 'concurrency' mode) outputting the summary of 'verify' in YAML format (#117) --- commands/verify/verify.go | 16 ++- test/e2e/concurrency/fail-fast/expected.yaml | 29 ++++ .../fail-fast/internal/expected.yaml | 25 ++++ .../fail-fast/internal/verify.yaml | 124 ++++++++++++++++++ .../concurrency/non-fail-fast/expected.yaml | 54 ++++++++ .../non-fail-fast/internal/expected.yaml | 25 ++++ .../non-fail-fast/internal/verify.yaml | 124 ++++++++++++++++++ test/e2e/e2e.yaml | 21 ++- .../non-concurrency/fail-fast/expected.yaml | 29 ++++ .../fail-fast/internal/expected.yaml | 25 ++++ .../fail-fast/internal/verify.yaml | 59 +++++++++ .../non-fail-fast/expected.yaml | 31 +++++ .../non-fail-fast/internal/expected.yaml | 25 ++++ .../non-fail-fast/internal/verify.yaml | 59 +++++++++ 14 files changed, 635 insertions(+), 11 deletions(-) create mode 100644 test/e2e/concurrency/fail-fast/expected.yaml create mode 100644 test/e2e/concurrency/fail-fast/internal/expected.yaml create mode 100644 test/e2e/concurrency/fail-fast/internal/verify.yaml create mode 100644 test/e2e/concurrency/non-fail-fast/expected.yaml create mode 100644 test/e2e/concurrency/non-fail-fast/internal/expected.yaml create mode 100644 test/e2e/concurrency/non-fail-fast/internal/verify.yaml create mode 100644 test/e2e/non-concurrency/fail-fast/expected.yaml create mode 100644 test/e2e/non-concurrency/fail-fast/internal/expected.yaml create mode 100644 test/e2e/non-concurrency/fail-fast/internal/verify.yaml create mode 100644 test/e2e/non-concurrency/non-fail-fast/expected.yaml create mode 100644 test/e2e/non-concurrency/non-fail-fast/internal/expected.yaml create mode 100644 test/e2e/non-concurrency/non-fail-fast/internal/verify.yaml diff --git a/commands/verify/verify.go b/commands/verify/verify.go index 2411c89..794e4b4 100644 --- a/commands/verify/verify.go +++ b/commands/verify/verify.go @@ -108,6 +108,7 @@ func concurrentlyVerifySingleCase( verifyInfo *verifyInfo, ) (res *output.CaseResult) { res = &output.CaseResult{} + res.Name = caseName(v) defer func() { if res.Err != nil && verifyInfo.failFast { cancel() @@ -164,6 +165,7 @@ func verifyCasesConcurrently(verify *config.Verify, verifyInfo *verifyInfo) erro select { case <-ctx.Done(): res[i].Skip = true + res[i].Name = caseName(&verify.Cases[i]) return default: // It's safe to do this, since each goroutine only modifies a single, different, designated slice element. @@ -173,9 +175,13 @@ func verifyCasesConcurrently(verify *config.Verify, verifyInfo *verifyInfo) erro } wg.Wait() - _, errNum, _ := printer.PrintResult(res) - if errNum > 0 { - return fmt.Errorf("failed to verify %d case(s)", errNum) + if output.SummaryOnly { + output.PrintResult(res) + } else { + _, errNum, _ := printer.PrintResult(res) + if errNum > 0 { + return fmt.Errorf("failed to verify %d case(s)", errNum) + } } return nil @@ -188,6 +194,7 @@ func verifyCasesSerially(verify *config.Verify, verifyInfo *verifyInfo) (err err for i := range res { res[i] = &output.CaseResult{ Skip: true, + Name: caseName(&verify.Cases[i]), } } @@ -205,7 +212,6 @@ func verifyCasesSerially(verify *config.Verify, verifyInfo *verifyInfo) (err err for idx := range verify.Cases { printer.Start() v := &verify.Cases[idx] - res[idx].Name = caseName(v) if v.GetExpected() == "" { res[idx].Skip = false @@ -294,7 +300,7 @@ func DoVerifyAccordingConfig() error { concurrency := e2eConfig.Verify.Concurrency if concurrency { // enable batch output mode when concurrency is enabled - printer = output.NewPrinter(output.WithBatchOutput(true)) + printer = output.NewPrinter(output.WithBatchOutput(true), output.WithSummaryOnly(output.SummaryOnly)) return verifyCasesConcurrently(&e2eConfig.Verify, &VerifyInfo) } printer = output.NewPrinter(output.WithBatchOutput(util.BatchMode), output.WithSummaryOnly(output.SummaryOnly)) diff --git a/test/e2e/concurrency/fail-fast/expected.yaml b/test/e2e/concurrency/fail-fast/expected.yaml new file mode 100644 index 0000000..bb9394e --- /dev/null +++ b/test/e2e/concurrency/fail-fast/expected.yaml @@ -0,0 +1,29 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you 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. + +passed: +{{range .passed}} +- {{ if hasPrefix . "passed" }}{{.}}{{ end }} +{{end}} +failed: +{{range .failed}} +- {{ if hasPrefix . "failed" }}{{.}}{{ end }} +{{end}} +skipped: +{{range .skipped}} +- {{.}} +{{end}} \ No newline at end of file diff --git a/test/e2e/concurrency/fail-fast/internal/expected.yaml b/test/e2e/concurrency/fail-fast/internal/expected.yaml new file mode 100644 index 0000000..1d9d4bc --- /dev/null +++ b/test/e2e/concurrency/fail-fast/internal/expected.yaml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +args: + case: success +headers: + Accept: application/json + Host: 127.0.0.1:8080 + User-Agent: curl/7.81.0 +origin: 172.18.0.1 +url: http://127.0.0.1:8080/get?case=success \ No newline at end of file diff --git a/test/e2e/concurrency/fail-fast/internal/verify.yaml b/test/e2e/concurrency/fail-fast/internal/verify.yaml new file mode 100644 index 0000000..4bd9efa --- /dev/null +++ b/test/e2e/concurrency/fail-fast/internal/verify.yaml @@ -0,0 +1,124 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +verify: + # verify with retry strategy + retry: + # max retry count + count: 1 + # the interval between two attempts, e.g. 10s, 1m. + interval: 1s + + # when a case fails, whether to stop verifying other cases. This property defaults to true. + fail-fast: true + # Whether to verify cases concurrently. This property defaults to false. + concurrency: true + + + cases: + - name: passed-case-1 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-2 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-3 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-4 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-5 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-6 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-7 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-8 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-9 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-10 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + + - name: passed-case-11 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-12 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-13 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-14 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-15 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-16 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-17 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-18 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-19 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-20 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + + - name: passed-case-21 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-22 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-23 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-24 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-25 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-26 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-27 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-28 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-29 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-30 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml \ No newline at end of file diff --git a/test/e2e/concurrency/non-fail-fast/expected.yaml b/test/e2e/concurrency/non-fail-fast/expected.yaml new file mode 100644 index 0000000..42a6951 --- /dev/null +++ b/test/e2e/concurrency/non-fail-fast/expected.yaml @@ -0,0 +1,54 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you 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. + +passed: +{{- contains .passed}} +- passed-case-1 +- passed-case-2 +- passed-case-4 +- passed-case-5 +- passed-case-7 +- passed-case-8 +- passed-case-10 +- passed-case-11 +- passed-case-12 +- passed-case-14 +- passed-case-15 +- passed-case-17 +- passed-case-18 +- passed-case-20 +- passed-case-21 +- passed-case-22 +- passed-case-24 +- passed-case-25 +- passed-case-27 +- passed-case-28 +- passed-case-30 +{{- end}} +failed: +{{- contains .failed }} +- failed-case-3 +- failed-case-6 +- failed-case-9 +- failed-case-13 +- failed-case-16 +- failed-case-19 +- failed-case-23 +- failed-case-26 +- failed-case-29 +{{- end }} +skipped: [] \ No newline at end of file diff --git a/test/e2e/concurrency/non-fail-fast/internal/expected.yaml b/test/e2e/concurrency/non-fail-fast/internal/expected.yaml new file mode 100644 index 0000000..1d9d4bc --- /dev/null +++ b/test/e2e/concurrency/non-fail-fast/internal/expected.yaml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +args: + case: success +headers: + Accept: application/json + Host: 127.0.0.1:8080 + User-Agent: curl/7.81.0 +origin: 172.18.0.1 +url: http://127.0.0.1:8080/get?case=success \ No newline at end of file diff --git a/test/e2e/concurrency/non-fail-fast/internal/verify.yaml b/test/e2e/concurrency/non-fail-fast/internal/verify.yaml new file mode 100644 index 0000000..88a4a9a --- /dev/null +++ b/test/e2e/concurrency/non-fail-fast/internal/verify.yaml @@ -0,0 +1,124 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +verify: + # verify with retry strategy + retry: + # max retry count + count: 1 + # the interval between two attempts, e.g. 10s, 1m. + interval: 1s + + # when a case fails, whether to stop verifying other cases. This property defaults to true. + fail-fast: false + # Whether to verify cases concurrently. This property defaults to false. + concurrency: true + + + cases: + - name: passed-case-1 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-2 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-3 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-4 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-5 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-6 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-7 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-8 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-9 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-10 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + + - name: passed-case-11 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-12 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-13 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-14 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-15 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-16 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-17 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-18 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-19 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-20 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + + - name: passed-case-21 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-22 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-23 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-24 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-25 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-26 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-27 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-28 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: failed-case-29 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: passed-case-30 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml \ No newline at end of file diff --git a/test/e2e/e2e.yaml b/test/e2e/e2e.yaml index c22e99c..244400a 100644 --- a/test/e2e/e2e.yaml +++ b/test/e2e/e2e.yaml @@ -39,10 +39,19 @@ verify: cases: - - name: fail-fast - query: './bin/linux/e2e verify -c ./test/e2e/fail-fast/internal/verify.yaml --summary-only -o yaml' - expected: ./fail-fast/expected.yaml + - name: non-currency & fail-fast mode + query: './bin/linux/e2e verify -c ./test/e2e/non-concurrency/fail-fast/internal/verify.yaml --summary-only -o yaml' + expected: ./non-concurrency/fail-fast/expected.yaml + + - name: non-currency & non-fail-fast mode + query: './bin/linux/e2e verify -c ./test/e2e/non-concurrency/non-fail-fast/internal/verify.yaml --summary-only -o yaml' + expected: ./non-concurrency/non-fail-fast/expected.yaml + +# - name: currency & fail-fast mode +# query: './bin/linux/e2e verify -c ./test/e2e/concurrency/fail-fast/internal/verify.yaml --summary-only -o yaml' +# expected: ./concurrency/fail-fast/expected.yaml +# +# - name: currency & non-fail-fast mode +# query: './bin/linux/e2e verify -c ./test/e2e/concurrency/non-fail-fast/internal/verify.yaml --summary-only -o yaml' +# expected: ./concurrency/non-fail-fast/expected.yaml - - name: non-fail-fast - query: './bin/linux/e2e verify -c ./test/e2e/non-fail-fast/internal/verify.yaml --summary-only -o yaml' - expected: ./non-fail-fast/expected.yaml \ No newline at end of file diff --git a/test/e2e/non-concurrency/fail-fast/expected.yaml b/test/e2e/non-concurrency/fail-fast/expected.yaml new file mode 100644 index 0000000..617744e --- /dev/null +++ b/test/e2e/non-concurrency/fail-fast/expected.yaml @@ -0,0 +1,29 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you 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. + +passed: + - case-1 + - case-2 + - case-3 + - case-4 + - case-5 +failed: + - case-6 +skipped: + - case-7 + - case-8 + - case-9 diff --git a/test/e2e/non-concurrency/fail-fast/internal/expected.yaml b/test/e2e/non-concurrency/fail-fast/internal/expected.yaml new file mode 100644 index 0000000..1d9d4bc --- /dev/null +++ b/test/e2e/non-concurrency/fail-fast/internal/expected.yaml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +args: + case: success +headers: + Accept: application/json + Host: 127.0.0.1:8080 + User-Agent: curl/7.81.0 +origin: 172.18.0.1 +url: http://127.0.0.1:8080/get?case=success \ No newline at end of file diff --git a/test/e2e/non-concurrency/fail-fast/internal/verify.yaml b/test/e2e/non-concurrency/fail-fast/internal/verify.yaml new file mode 100644 index 0000000..d33b8f3 --- /dev/null +++ b/test/e2e/non-concurrency/fail-fast/internal/verify.yaml @@ -0,0 +1,59 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +verify: + # verify with retry strategy + retry: + # max retry count + count: 5 + # the interval between two attempts, e.g. 10s, 1m. + interval: 1s + + # when a case fails, whether to stop verifying other cases. This property defaults to true. + fail-fast: true + # Whether to verify cases concurrently. This property defaults to false. + concurrency: false + + + cases: + - name: case-1 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-2 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-3 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-4 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-5 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-6 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: case-7 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-8 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: case-9 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml \ No newline at end of file diff --git a/test/e2e/non-concurrency/non-fail-fast/expected.yaml b/test/e2e/non-concurrency/non-fail-fast/expected.yaml new file mode 100644 index 0000000..9f7f8f0 --- /dev/null +++ b/test/e2e/non-concurrency/non-fail-fast/expected.yaml @@ -0,0 +1,31 @@ +# Licensed to Apache Software Foundation (ASF) under one or more contributor +# license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright +# ownership. Apache Software Foundation (ASF) licenses this file to you 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. + +passed: + - case-1 + - case-2 + - case-3 + - case-4 + - case-5 + - case-7 +failed: + - case-6 + - case-8 + - case-9 +skipped: [] + + diff --git a/test/e2e/non-concurrency/non-fail-fast/internal/expected.yaml b/test/e2e/non-concurrency/non-fail-fast/internal/expected.yaml new file mode 100644 index 0000000..1d9d4bc --- /dev/null +++ b/test/e2e/non-concurrency/non-fail-fast/internal/expected.yaml @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +args: + case: success +headers: + Accept: application/json + Host: 127.0.0.1:8080 + User-Agent: curl/7.81.0 +origin: 172.18.0.1 +url: http://127.0.0.1:8080/get?case=success \ No newline at end of file diff --git a/test/e2e/non-concurrency/non-fail-fast/internal/verify.yaml b/test/e2e/non-concurrency/non-fail-fast/internal/verify.yaml new file mode 100644 index 0000000..86bd5d5 --- /dev/null +++ b/test/e2e/non-concurrency/non-fail-fast/internal/verify.yaml @@ -0,0 +1,59 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You 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. + +# This file is used to show how to write configuration files and can be used to test. + +verify: + # verify with retry strategy + retry: + # max retry count + count: 1 + # the interval between two attempts, e.g. 10s, 1m. + interval: 1s + + # when a case fails, whether to stop verifying other cases. This property defaults to true. + fail-fast: false + # Whether to verify cases concurrently. This property defaults to false. + concurrency: false + + + cases: + - name: case-1 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-2 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-3 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-4 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-5 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-6 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: case-7 + query: 'curl -s 127.0.0.1:8080/get?case=success -H "accept: application/json"' + expected: ./expected.yaml + - name: case-8 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml + - name: case-9 + query: 'curl -s 127.0.0.1:8080/get?case=failure -H "accept: application/json"' + expected: ./expected.yaml \ No newline at end of file