You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by ho...@apache.org on 2022/11/06 13:48:30 UTC
[skywalking-infra-e2e] branch add-command-option updated: add batchOutput to config
This is an automated email from the ASF dual-hosted git repository.
hoshea pushed a commit to branch add-command-option
in repository https://gitbox.apache.org/repos/asf/skywalking-infra-e2e.git
The following commit(s) were added to refs/heads/add-command-option by this push:
new 2534aa4 add batchOutput to config
2534aa4 is described below
commit 2534aa4f2edc43396d4b16a10451b1b932652a22
Author: Hoshea <fg...@gmail.com>
AuthorDate: Sun Nov 6 21:48:19 2022 +0800
add batchOutput to config
---
commands/root.go | 3 +--
commands/verify/verify.go | 13 ++++++-------
docs/en/setup/Configuration-File.md | 1 +
internal/config/e2eConfig.go | 1 +
internal/config/globalConfig.go | 1 +
5 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/commands/root.go b/commands/root.go
index 29572f7..6e72458 100644
--- a/commands/root.go
+++ b/commands/root.go
@@ -23,8 +23,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
- "github.com/apache/skywalking-infra-e2e/internal/logger"
-
"github.com/apache/skywalking-infra-e2e/commands/cleanup"
"github.com/apache/skywalking-infra-e2e/commands/run"
"github.com/apache/skywalking-infra-e2e/commands/setup"
@@ -32,6 +30,7 @@ import (
"github.com/apache/skywalking-infra-e2e/commands/verify"
"github.com/apache/skywalking-infra-e2e/internal/config"
"github.com/apache/skywalking-infra-e2e/internal/constant"
+ "github.com/apache/skywalking-infra-e2e/internal/logger"
"github.com/apache/skywalking-infra-e2e/internal/util"
)
diff --git a/commands/verify/verify.go b/commands/verify/verify.go
index 4f2bf8e..7ee6950 100644
--- a/commands/verify/verify.go
+++ b/commands/verify/verify.go
@@ -32,18 +32,16 @@ import (
)
var (
- query string
- actual string
- expected string
- batchOutput bool
- printer output.Printer
+ query string
+ actual string
+ expected string
+ printer output.Printer
)
func init() {
Verify.Flags().StringVarP(&query, "query", "q", "", "the query to get the actual data, the result of the query should in YAML format")
Verify.Flags().StringVarP(&actual, "actual", "a", "", "the actual data file, only YAML file format is supported")
Verify.Flags().StringVarP(&expected, "expected", "e", "", "the expected data file, only YAML file format is supported")
- Verify.Flags().BoolVarP(&batchOutput, "batchOutput", "b", false, "output the result of each case in batch, it's recommended to enable this in CI")
}
// Verify verifies that the actual data satisfies the expected data pattern.
@@ -54,6 +52,7 @@ var Verify = &cobra.Command{
if expected != "" {
return verifySingleCase(expected, actual, query)
}
+
// If there is no given flags.
return DoVerifyAccordingConfig()
},
@@ -308,7 +307,7 @@ func DoVerifyAccordingConfig() error {
return verifyCasesConcurrently(&e2eConfig.Verify, &VerifyInfo)
}
- printer = output.NewPrinter(batchOutput)
+ printer = output.NewPrinter(e2eConfig.Verify.BatchOutput)
return verifyCasesSerially(&e2eConfig.Verify, &VerifyInfo)
}
diff --git a/docs/en/setup/Configuration-File.md b/docs/en/setup/Configuration-File.md
index 23f3d1f..0fa1806 100644
--- a/docs/en/setup/Configuration-File.md
+++ b/docs/en/setup/Configuration-File.md
@@ -161,6 +161,7 @@ verify:
interval: 10s # the interval between two attempts, e.g. 10s, 1m.
fail-fast: true # when a case fails, whether to stop verifying other cases. This property defaults to true.
concurrency: false # whether to verify cases concurrently. This property defaults to false.
+ batchOutput: true # whether to output the result of verify cases in batch. This property defaults to true.
cases: # verify test cases
- actual: path/to/actual.yaml # verify by actual file path
expected: path/to/expected.yaml # excepted content file path
diff --git a/internal/config/e2eConfig.go b/internal/config/e2eConfig.go
index 2062150..3a5675a 100644
--- a/internal/config/e2eConfig.go
+++ b/internal/config/e2eConfig.go
@@ -90,6 +90,7 @@ type Verify struct {
Cases []VerifyCase `yaml:"cases"`
FailFast bool `yaml:"fail-fast"`
Concurrency bool `yaml:"concurrency"`
+ BatchOutput bool `yaml:"batchOutput"`
}
func (s *Setup) GetFile() string {
diff --git a/internal/config/globalConfig.go b/internal/config/globalConfig.go
index c01b078..8299479 100644
--- a/internal/config/globalConfig.go
+++ b/internal/config/globalConfig.go
@@ -46,6 +46,7 @@ func init() {
}
GlobalConfig.E2EConfig.Verify.FailFast = true
+ GlobalConfig.E2EConfig.Verify.BatchOutput = true
}
func ReadGlobalConfigFile() {