dependencies: ginkgo v2.13.0, gomega v1.28.0
Besides simply staying up-to-date, ginkgo v2.13.0 adds a `PreviewSpecs` which will be used for introspection of the E2E test suites.
This commit is contained in:
83
vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
generated
vendored
83
vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md
generated
vendored
@@ -1,3 +1,86 @@
|
||||
## 2.13.0
|
||||
|
||||
### Features
|
||||
|
||||
Add PreviewSpect() to enable programmatic preview access to the suite report (fixes #1225)
|
||||
|
||||
## 2.12.1
|
||||
|
||||
### Fixes
|
||||
- Print logr prefix if it exists (#1275) [90d4846]
|
||||
|
||||
### Maintenance
|
||||
- Bump actions/checkout from 3 to 4 (#1271) [555f543]
|
||||
- Bump golang.org/x/sys from 0.11.0 to 0.12.0 (#1270) [d867b7d]
|
||||
|
||||
## 2.12.0
|
||||
|
||||
### Features
|
||||
|
||||
- feat: allow MustPassRepeatedly decorator to be set at suite level (#1266) [05de518]
|
||||
|
||||
### Fixes
|
||||
|
||||
- fix-errors-in-readme (#1244) [27c2f5d]
|
||||
|
||||
### Maintenance
|
||||
|
||||
Various chores/dependency bumps.
|
||||
|
||||
## 2.11.0
|
||||
|
||||
In prior versions of Ginkgo specs the CLI filter flags (e.g. `--focus`, `--label-filter`) would _override_ any programmatic focus. This behavior has proved surprising and confusing in at least the following ways:
|
||||
|
||||
- users cannot combine programmatic filters and CLI filters to more efficiently select subsets of tests
|
||||
- CLI filters can override programmatic focus on CI systems resulting in an exit code of 0 despite the presence of (incorrectly!) committed focused specs.
|
||||
|
||||
Going forward Ginkgo will AND all programmatic and CLI filters. Moreover, the presence of any programmatic focused tests will always result in a non-zero exit code.
|
||||
|
||||
This change is technically a change in Ginkgo's external contract and may require some users to make changes to successfully adopt. Specifically: it's possible some users were intentionally using CLI filters to override programmatic focus. If this is you please open an issue so we can explore solutions to the underlying problem you are trying to solve.
|
||||
|
||||
### Fixes
|
||||
- Programmatic focus is no longer overwrriten by CLI filters [d6bba86]
|
||||
|
||||
### Maintenance
|
||||
- Bump github.com/onsi/gomega from 1.27.7 to 1.27.8 (#1218) [4a70a38]
|
||||
- Bump golang.org/x/sys from 0.8.0 to 0.9.0 (#1219) [97eda4d]
|
||||
|
||||
## 2.10.0
|
||||
|
||||
### Features
|
||||
- feat(ginkgo/generators): add --tags flag (#1216) [a782a77]
|
||||
adds a new --tags flag to ginkgo generate
|
||||
|
||||
### Fixes
|
||||
- Fix broken link of MIGRATING_TO_V2.md (#1217) [548d78e]
|
||||
|
||||
### Maintenance
|
||||
- Bump golang.org/x/tools from 0.9.1 to 0.9.3 (#1215) [2b76a5e]
|
||||
|
||||
## 2.9.7
|
||||
|
||||
### Fixes
|
||||
- fix race when multiple defercleanups are called in goroutines [07fc3a0]
|
||||
|
||||
## 2.9.6
|
||||
|
||||
### Fixes
|
||||
- fix: create parent directory before report files (#1212) [0ac65de]
|
||||
|
||||
### Maintenance
|
||||
- Bump github.com/onsi/gomega from 1.27.6 to 1.27.7 (#1202) [3e39231]
|
||||
|
||||
## 2.9.5
|
||||
|
||||
### Fixes
|
||||
- ensure the correct deterministic sort order is produced when ordered specs are generated by a helper function [7fa0b6b]
|
||||
|
||||
### Maintenance
|
||||
- fix generators link (#1200) [9f9d8b9]
|
||||
- Bump golang.org/x/tools from 0.8.0 to 0.9.1 (#1196) [150e3f2]
|
||||
- fix spelling err in docs (#1199) [0013b1a]
|
||||
- Bump golang.org/x/sys from 0.7.0 to 0.8.0 (#1193) [9e9e3e5]
|
||||
|
||||
## 2.9.4
|
||||
|
||||
### Fixes
|
||||
|
6
vendor/github.com/onsi/ginkgo/v2/README.md
generated
vendored
6
vendor/github.com/onsi/ginkgo/v2/README.md
generated
vendored
@@ -15,7 +15,7 @@ import (
|
||||
...
|
||||
)
|
||||
|
||||
Describe("Checking books out of the library", Label("library"), func() {
|
||||
var _ = Describe("Checking books out of the library", Label("library"), func() {
|
||||
var library *libraries.Library
|
||||
var book *books.Book
|
||||
var valjean *users.User
|
||||
@@ -50,7 +50,7 @@ Describe("Checking books out of the library", Label("library"), func() {
|
||||
|
||||
It("tells the user", func(ctx SpecContext) {
|
||||
err := valjean.Checkout(ctx, library, "Les Miserables")
|
||||
Expect(error).To(MatchError("Les Miserables is currently checked out"))
|
||||
Expect(err).To(MatchError("Les Miserables is currently checked out"))
|
||||
}, SpecTimeout(time.Second * 5))
|
||||
|
||||
It("lets the user place a hold and get notified later", func(ctx SpecContext) {
|
||||
@@ -74,7 +74,7 @@ Describe("Checking books out of the library", Label("library"), func() {
|
||||
When("the library does not have the book in question", func() {
|
||||
It("tells the reader the book is unavailable", func(ctx SpecContext) {
|
||||
err := valjean.Checkout(ctx, library, "Les Miserables")
|
||||
Expect(error).To(MatchError("Les Miserables is not in the library catalog"))
|
||||
Expect(err).To(MatchError("Les Miserables is not in the library catalog"))
|
||||
}, SpecTimeout(time.Second * 5))
|
||||
})
|
||||
})
|
||||
|
94
vendor/github.com/onsi/ginkgo/v2/core_dsl.go
generated
vendored
94
vendor/github.com/onsi/ginkgo/v2/core_dsl.go
generated
vendored
@@ -248,31 +248,13 @@ func RunSpecs(t GinkgoTestingT, description string, args ...interface{}) bool {
|
||||
exitIfErr(types.GinkgoErrors.RerunningSuite())
|
||||
}
|
||||
suiteDidRun = true
|
||||
|
||||
suiteLabels := Labels{}
|
||||
configErrors := []error{}
|
||||
for _, arg := range args {
|
||||
switch arg := arg.(type) {
|
||||
case types.SuiteConfig:
|
||||
suiteConfig = arg
|
||||
case types.ReporterConfig:
|
||||
reporterConfig = arg
|
||||
case Labels:
|
||||
suiteLabels = append(suiteLabels, arg...)
|
||||
default:
|
||||
configErrors = append(configErrors, types.GinkgoErrors.UnknownTypePassedToRunSpecs(arg))
|
||||
}
|
||||
err := global.PushClone()
|
||||
if err != nil {
|
||||
exitIfErr(err)
|
||||
}
|
||||
exitIfErrors(configErrors)
|
||||
defer global.PopClone()
|
||||
|
||||
configErrors = types.VetConfig(flagSet, suiteConfig, reporterConfig)
|
||||
if len(configErrors) > 0 {
|
||||
fmt.Fprintf(formatter.ColorableStdErr, formatter.F("{{red}}Ginkgo detected configuration issues:{{/}}\n"))
|
||||
for _, err := range configErrors {
|
||||
fmt.Fprintf(formatter.ColorableStdErr, err.Error())
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
suiteLabels := extractSuiteConfiguration(args)
|
||||
|
||||
var reporter reporters.Reporter
|
||||
if suiteConfig.ParallelTotal == 1 {
|
||||
@@ -308,9 +290,8 @@ func RunSpecs(t GinkgoTestingT, description string, args ...interface{}) bool {
|
||||
registerReportAfterSuiteNodeForAutogeneratedReports(reporterConfig)
|
||||
}
|
||||
|
||||
err := global.Suite.BuildTree()
|
||||
err = global.Suite.BuildTree()
|
||||
exitIfErr(err)
|
||||
|
||||
suitePath, err := os.Getwd()
|
||||
exitIfErr(err)
|
||||
suitePath, err = filepath.Abs(suitePath)
|
||||
@@ -335,6 +316,69 @@ func RunSpecs(t GinkgoTestingT, description string, args ...interface{}) bool {
|
||||
return passed
|
||||
}
|
||||
|
||||
func extractSuiteConfiguration(args []interface{}) Labels {
|
||||
suiteLabels := Labels{}
|
||||
configErrors := []error{}
|
||||
for _, arg := range args {
|
||||
switch arg := arg.(type) {
|
||||
case types.SuiteConfig:
|
||||
suiteConfig = arg
|
||||
case types.ReporterConfig:
|
||||
reporterConfig = arg
|
||||
case Labels:
|
||||
suiteLabels = append(suiteLabels, arg...)
|
||||
default:
|
||||
configErrors = append(configErrors, types.GinkgoErrors.UnknownTypePassedToRunSpecs(arg))
|
||||
}
|
||||
}
|
||||
exitIfErrors(configErrors)
|
||||
|
||||
configErrors = types.VetConfig(flagSet, suiteConfig, reporterConfig)
|
||||
if len(configErrors) > 0 {
|
||||
fmt.Fprintf(formatter.ColorableStdErr, formatter.F("{{red}}Ginkgo detected configuration issues:{{/}}\n"))
|
||||
for _, err := range configErrors {
|
||||
fmt.Fprintf(formatter.ColorableStdErr, err.Error())
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
return suiteLabels
|
||||
}
|
||||
|
||||
/*
|
||||
PreviewSpecs walks the testing tree and produces a report without actually invoking the specs.
|
||||
See http://onsi.github.io/ginkgo/#previewing-specs for more information.
|
||||
*/
|
||||
func PreviewSpecs(description string, args ...any) Report {
|
||||
err := global.PushClone()
|
||||
if err != nil {
|
||||
exitIfErr(err)
|
||||
}
|
||||
defer global.PopClone()
|
||||
|
||||
suiteLabels := extractSuiteConfiguration(args)
|
||||
priorDryRun, priorParallelTotal, priorParallelProcess := suiteConfig.DryRun, suiteConfig.ParallelTotal, suiteConfig.ParallelProcess
|
||||
suiteConfig.DryRun, suiteConfig.ParallelTotal, suiteConfig.ParallelProcess = true, 1, 1
|
||||
defer func() {
|
||||
suiteConfig.DryRun, suiteConfig.ParallelTotal, suiteConfig.ParallelProcess = priorDryRun, priorParallelTotal, priorParallelProcess
|
||||
}()
|
||||
reporter := reporters.NoopReporter{}
|
||||
outputInterceptor = internal.NoopOutputInterceptor{}
|
||||
client = nil
|
||||
writer := GinkgoWriter.(*internal.Writer)
|
||||
|
||||
err = global.Suite.BuildTree()
|
||||
exitIfErr(err)
|
||||
suitePath, err := os.Getwd()
|
||||
exitIfErr(err)
|
||||
suitePath, err = filepath.Abs(suitePath)
|
||||
exitIfErr(err)
|
||||
|
||||
global.Suite.Run(description, suiteLabels, suitePath, global.Failer, reporter, writer, outputInterceptor, interrupt_handler.NewInterruptHandler(client), client, internal.RegisterForProgressSignal, suiteConfig)
|
||||
|
||||
return global.Suite.GetPreviewReport()
|
||||
}
|
||||
|
||||
/*
|
||||
Skip instructs Ginkgo to skip the current spec
|
||||
|
||||
|
5
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
generated
vendored
5
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_command.go
generated
vendored
@@ -32,6 +32,9 @@ func BuildGenerateCommand() command.Command {
|
||||
{Name: "template-data", KeyPath: "CustomTemplateData",
|
||||
UsageArgument: "template-data-file",
|
||||
Usage: "If specified, generate will use the contents of the file passed as data to be rendered in the test file template"},
|
||||
{Name: "tags", KeyPath: "Tags",
|
||||
UsageArgument: "build-tags",
|
||||
Usage: "If specified, generate will create a test file that uses the given build tags (i.e. `--tags e2e,!unit` will add `//go:build e2e,!unit`)"},
|
||||
},
|
||||
&conf,
|
||||
types.GinkgoFlagSections{},
|
||||
@@ -59,6 +62,7 @@ You can also pass a <filename> of the form "file.go" and generate will emit "fil
|
||||
}
|
||||
|
||||
type specData struct {
|
||||
BuildTags string
|
||||
Package string
|
||||
Subject string
|
||||
PackageImportPath string
|
||||
@@ -93,6 +97,7 @@ func generateTestFileForSubject(subject string, conf GeneratorsConfig) {
|
||||
}
|
||||
|
||||
data := specData{
|
||||
BuildTags: getBuildTags(conf.Tags),
|
||||
Package: determinePackageName(packageName, conf.Internal),
|
||||
Subject: formattedName,
|
||||
PackageImportPath: getPackageImportPath(),
|
||||
|
6
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_templates.go
generated
vendored
6
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generate_templates.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package generators
|
||||
|
||||
var specText = `package {{.Package}}
|
||||
var specText = `{{.BuildTags}}
|
||||
package {{.Package}}
|
||||
|
||||
import (
|
||||
{{.GinkgoImport}}
|
||||
@@ -14,7 +15,8 @@ var _ = {{.GinkgoPackage}}Describe("{{.Subject}}", func() {
|
||||
})
|
||||
`
|
||||
|
||||
var agoutiSpecText = `package {{.Package}}
|
||||
var agoutiSpecText = `{{.BuildTags}}
|
||||
package {{.Package}}
|
||||
|
||||
import (
|
||||
{{.GinkgoImport}}
|
||||
|
12
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generators_common.go
generated
vendored
12
vendor/github.com/onsi/ginkgo/v2/ginkgo/generators/generators_common.go
generated
vendored
@@ -1,6 +1,7 @@
|
||||
package generators
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"go/build"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -14,6 +15,7 @@ type GeneratorsConfig struct {
|
||||
Agouti, NoDot, Internal bool
|
||||
CustomTemplate string
|
||||
CustomTemplateData string
|
||||
Tags string
|
||||
}
|
||||
|
||||
func getPackageAndFormattedName() (string, string, string) {
|
||||
@@ -62,3 +64,13 @@ func determinePackageName(name string, internal bool) string {
|
||||
|
||||
return name + "_test"
|
||||
}
|
||||
|
||||
// getBuildTags returns the resultant string to be added.
|
||||
// If the input string is not empty, then returns a `//go:build {}` string,
|
||||
// otherwise returns an empty string.
|
||||
func getBuildTags(tags string) string {
|
||||
if tags != "" {
|
||||
return fmt.Sprintf("//go:build %s\n", tags)
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
4
vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/ginkgo.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/v2/ginkgo/outline/ginkgo.go
generated
vendored
@@ -244,9 +244,7 @@ func labelFromCallExpr(ce *ast.CallExpr) []string {
|
||||
}
|
||||
if id.Name == "Label" {
|
||||
ls := extractLabels(expr)
|
||||
for _, label := range ls {
|
||||
labels = append(labels, label)
|
||||
}
|
||||
labels = append(labels, ls...)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
65
vendor/github.com/onsi/ginkgo/v2/internal/focus.go
generated
vendored
65
vendor/github.com/onsi/ginkgo/v2/internal/focus.go
generated
vendored
@@ -8,22 +8,22 @@ import (
|
||||
)
|
||||
|
||||
/*
|
||||
If a container marked as focus has a descendant that is also marked as focus, Ginkgo's policy is to
|
||||
unmark the container's focus. This gives developers a more intuitive experience when debugging specs.
|
||||
It is common to focus a container to just run a subset of specs, then identify the specific specs within the container to focus -
|
||||
this policy allows the developer to simply focus those specific specs and not need to go back and turn the focus off of the container:
|
||||
If a container marked as focus has a descendant that is also marked as focus, Ginkgo's policy is to
|
||||
unmark the container's focus. This gives developers a more intuitive experience when debugging specs.
|
||||
It is common to focus a container to just run a subset of specs, then identify the specific specs within the container to focus -
|
||||
this policy allows the developer to simply focus those specific specs and not need to go back and turn the focus off of the container:
|
||||
|
||||
As a common example, consider:
|
||||
As a common example, consider:
|
||||
|
||||
FDescribe("something to debug", function() {
|
||||
It("works", function() {...})
|
||||
It("works", function() {...})
|
||||
FIt("doesn't work", function() {...})
|
||||
It("works", function() {...})
|
||||
})
|
||||
FDescribe("something to debug", function() {
|
||||
It("works", function() {...})
|
||||
It("works", function() {...})
|
||||
FIt("doesn't work", function() {...})
|
||||
It("works", function() {...})
|
||||
})
|
||||
|
||||
here the developer's intent is to focus in on the `"doesn't work"` spec and not to run the adjacent specs in the focused `"something to debug"` container.
|
||||
The nested policy applied by this function enables this behavior.
|
||||
here the developer's intent is to focus in on the `"doesn't work"` spec and not to run the adjacent specs in the focused `"something to debug"` container.
|
||||
The nested policy applied by this function enables this behavior.
|
||||
*/
|
||||
func ApplyNestedFocusPolicyToTree(tree *TreeNode) {
|
||||
var walkTree func(tree *TreeNode) bool
|
||||
@@ -44,46 +44,43 @@ func ApplyNestedFocusPolicyToTree(tree *TreeNode) {
|
||||
}
|
||||
|
||||
/*
|
||||
Ginkgo supports focussing specs using `FIt`, `FDescribe`, etc. - this is called "programmatic focus"
|
||||
It also supports focussing specs using regular expressions on the command line (`-focus=`, `-skip=`) that match against spec text
|
||||
and file filters (`-focus-files=`, `-skip-files=`) that match against code locations for nodes in specs.
|
||||
Ginkgo supports focussing specs using `FIt`, `FDescribe`, etc. - this is called "programmatic focus"
|
||||
It also supports focussing specs using regular expressions on the command line (`-focus=`, `-skip=`) that match against spec text and file filters (`-focus-files=`, `-skip-files=`) that match against code locations for nodes in specs.
|
||||
|
||||
If any of the CLI flags are provided they take precedence. The file filters run first followed by the regex filters.
|
||||
When both programmatic and file filters are provided their results are ANDed together. If multiple kinds of filters are provided, the file filters run first followed by the regex filters.
|
||||
|
||||
This function sets the `Skip` property on specs by applying Ginkgo's focus policy:
|
||||
- If there are no CLI arguments and no programmatic focus, do nothing.
|
||||
- If there are no CLI arguments but a spec somewhere has programmatic focus, skip any specs that have no programmatic focus.
|
||||
- If there are CLI arguments parse them and skip any specs that either don't match the focus filters or do match the skip filters.
|
||||
This function sets the `Skip` property on specs by applying Ginkgo's focus policy:
|
||||
- If there are no CLI arguments and no programmatic focus, do nothing.
|
||||
- If a spec somewhere has programmatic focus skip any specs that have no programmatic focus.
|
||||
- If there are CLI arguments parse them and skip any specs that either don't match the focus filters or do match the skip filters.
|
||||
|
||||
*Note:* specs with pending nodes are Skipped when created by NewSpec.
|
||||
*Note:* specs with pending nodes are Skipped when created by NewSpec.
|
||||
*/
|
||||
func ApplyFocusToSpecs(specs Specs, description string, suiteLabels Labels, suiteConfig types.SuiteConfig) (Specs, bool) {
|
||||
focusString := strings.Join(suiteConfig.FocusStrings, "|")
|
||||
skipString := strings.Join(suiteConfig.SkipStrings, "|")
|
||||
|
||||
hasFocusCLIFlags := focusString != "" || skipString != "" || len(suiteConfig.SkipFiles) > 0 || len(suiteConfig.FocusFiles) > 0 || suiteConfig.LabelFilter != ""
|
||||
|
||||
type SkipCheck func(spec Spec) bool
|
||||
|
||||
// by default, skip any specs marked pending
|
||||
skipChecks := []SkipCheck{func(spec Spec) bool { return spec.Nodes.HasNodeMarkedPending() }}
|
||||
hasProgrammaticFocus := false
|
||||
|
||||
if !hasFocusCLIFlags {
|
||||
// check for programmatic focus
|
||||
for _, spec := range specs {
|
||||
if spec.Nodes.HasNodeMarkedFocus() && !spec.Nodes.HasNodeMarkedPending() {
|
||||
skipChecks = append(skipChecks, func(spec Spec) bool { return !spec.Nodes.HasNodeMarkedFocus() })
|
||||
hasProgrammaticFocus = true
|
||||
break
|
||||
}
|
||||
for _, spec := range specs {
|
||||
if spec.Nodes.HasNodeMarkedFocus() && !spec.Nodes.HasNodeMarkedPending() {
|
||||
hasProgrammaticFocus = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if hasProgrammaticFocus {
|
||||
skipChecks = append(skipChecks, func(spec Spec) bool { return !spec.Nodes.HasNodeMarkedFocus() })
|
||||
}
|
||||
|
||||
if suiteConfig.LabelFilter != "" {
|
||||
labelFilter, _ := types.ParseLabelFilter(suiteConfig.LabelFilter)
|
||||
skipChecks = append(skipChecks, func(spec Spec) bool {
|
||||
return !labelFilter(UnionOfLabels(suiteLabels, spec.Nodes.UnionOfLabels()))
|
||||
skipChecks = append(skipChecks, func(spec Spec) bool {
|
||||
return !labelFilter(UnionOfLabels(suiteLabels, spec.Nodes.UnionOfLabels()))
|
||||
})
|
||||
}
|
||||
|
||||
|
11
vendor/github.com/onsi/ginkgo/v2/internal/global/init.go
generated
vendored
11
vendor/github.com/onsi/ginkgo/v2/internal/global/init.go
generated
vendored
@@ -6,6 +6,7 @@ import (
|
||||
|
||||
var Suite *internal.Suite
|
||||
var Failer *internal.Failer
|
||||
var backupSuite *internal.Suite
|
||||
|
||||
func init() {
|
||||
InitializeGlobals()
|
||||
@@ -15,3 +16,13 @@ func InitializeGlobals() {
|
||||
Failer = internal.NewFailer()
|
||||
Suite = internal.NewSuite()
|
||||
}
|
||||
|
||||
func PushClone() error {
|
||||
var err error
|
||||
backupSuite, err = Suite.Clone()
|
||||
return err
|
||||
}
|
||||
|
||||
func PopClone() {
|
||||
Suite = backupSuite
|
||||
}
|
||||
|
5
vendor/github.com/onsi/ginkgo/v2/internal/group.go
generated
vendored
5
vendor/github.com/onsi/ginkgo/v2/internal/group.go
generated
vendored
@@ -321,7 +321,10 @@ func (g *group) run(specs Specs) {
|
||||
if !skip {
|
||||
var maxAttempts = 1
|
||||
|
||||
if g.suite.currentSpecReport.MaxMustPassRepeatedly > 0 {
|
||||
if g.suite.config.MustPassRepeatedly > 0 {
|
||||
maxAttempts = g.suite.config.MustPassRepeatedly
|
||||
g.suite.currentSpecReport.MaxMustPassRepeatedly = maxAttempts
|
||||
} else if g.suite.currentSpecReport.MaxMustPassRepeatedly > 0 {
|
||||
maxAttempts = max(1, spec.MustPassRepeatedly())
|
||||
} else if g.suite.config.FlakeAttempts > 0 {
|
||||
maxAttempts = g.suite.config.FlakeAttempts
|
||||
|
19
vendor/github.com/onsi/ginkgo/v2/internal/node.go
generated
vendored
19
vendor/github.com/onsi/ginkgo/v2/internal/node.go
generated
vendored
@@ -597,12 +597,16 @@ func (n Node) IsZero() bool {
|
||||
/* Nodes */
|
||||
type Nodes []Node
|
||||
|
||||
func (n Nodes) Clone() Nodes {
|
||||
nodes := make(Nodes, len(n))
|
||||
copy(nodes, n)
|
||||
return nodes
|
||||
}
|
||||
|
||||
func (n Nodes) CopyAppend(nodes ...Node) Nodes {
|
||||
numN := len(n)
|
||||
out := make(Nodes, numN+len(nodes))
|
||||
for i, node := range n {
|
||||
out[i] = node
|
||||
}
|
||||
copy(out, n)
|
||||
for j, node := range nodes {
|
||||
out[numN+j] = node
|
||||
}
|
||||
@@ -875,6 +879,15 @@ func (n Nodes) FirstNodeMarkedOrdered() Node {
|
||||
return Node{}
|
||||
}
|
||||
|
||||
func (n Nodes) IndexOfFirstNodeMarkedOrdered() int {
|
||||
for i := range n {
|
||||
if n[i].MarkedOrdered {
|
||||
return i
|
||||
}
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
func (n Nodes) GetMaxFlakeAttempts() int {
|
||||
maxFlakeAttempts := 0
|
||||
for i := range n {
|
||||
|
51
vendor/github.com/onsi/ginkgo/v2/internal/ordering.go
generated
vendored
51
vendor/github.com/onsi/ginkgo/v2/internal/ordering.go
generated
vendored
@@ -27,36 +27,43 @@ func (s *SortableSpecs) Swap(i, j int) { s.Indexes[i], s.Indexes[j] = s.Indexes[
|
||||
func (s *SortableSpecs) Less(i, j int) bool {
|
||||
a, b := s.Specs[s.Indexes[i]], s.Specs[s.Indexes[j]]
|
||||
|
||||
firstOrderedA := a.Nodes.FirstNodeMarkedOrdered()
|
||||
firstOrderedB := b.Nodes.FirstNodeMarkedOrdered()
|
||||
if firstOrderedA.ID == firstOrderedB.ID && !firstOrderedA.IsZero() {
|
||||
// strictly preserve order in ordered containers. ID will track this as IDs are generated monotonically
|
||||
return a.FirstNodeWithType(types.NodeTypeIt).ID < b.FirstNodeWithType(types.NodeTypeIt).ID
|
||||
aNodes, bNodes := a.Nodes.WithType(types.NodeTypesForContainerAndIt), b.Nodes.WithType(types.NodeTypesForContainerAndIt)
|
||||
|
||||
firstOrderedAIdx, firstOrderedBIdx := aNodes.IndexOfFirstNodeMarkedOrdered(), bNodes.IndexOfFirstNodeMarkedOrdered()
|
||||
if firstOrderedAIdx > -1 && firstOrderedBIdx > -1 && aNodes[firstOrderedAIdx].ID == bNodes[firstOrderedBIdx].ID {
|
||||
// strictly preserve order within an ordered containers. ID will track this as IDs are generated monotonically
|
||||
return aNodes.FirstNodeWithType(types.NodeTypeIt).ID < bNodes.FirstNodeWithType(types.NodeTypeIt).ID
|
||||
}
|
||||
|
||||
aCLs := a.Nodes.WithType(types.NodeTypesForContainerAndIt).CodeLocations()
|
||||
bCLs := b.Nodes.WithType(types.NodeTypesForContainerAndIt).CodeLocations()
|
||||
for i := 0; i < len(aCLs) && i < len(bCLs); i++ {
|
||||
aCL, bCL := aCLs[i], bCLs[i]
|
||||
if aCL.FileName < bCL.FileName {
|
||||
return true
|
||||
} else if aCL.FileName > bCL.FileName {
|
||||
return false
|
||||
// if either spec is in an ordered container - only use the nodes up to the outermost ordered container
|
||||
if firstOrderedAIdx > -1 {
|
||||
aNodes = aNodes[:firstOrderedAIdx+1]
|
||||
}
|
||||
if firstOrderedBIdx > -1 {
|
||||
bNodes = bNodes[:firstOrderedBIdx+1]
|
||||
}
|
||||
|
||||
for i := 0; i < len(aNodes) && i < len(bNodes); i++ {
|
||||
aCL, bCL := aNodes[i].CodeLocation, bNodes[i].CodeLocation
|
||||
if aCL.FileName != bCL.FileName {
|
||||
return aCL.FileName < bCL.FileName
|
||||
}
|
||||
if aCL.LineNumber < bCL.LineNumber {
|
||||
return true
|
||||
} else if aCL.LineNumber > bCL.LineNumber {
|
||||
return false
|
||||
if aCL.LineNumber != bCL.LineNumber {
|
||||
return aCL.LineNumber < bCL.LineNumber
|
||||
}
|
||||
}
|
||||
// either everything is equal or we have different lengths of CLs
|
||||
if len(aCLs) < len(bCLs) {
|
||||
return true
|
||||
} else if len(aCLs) > len(bCLs) {
|
||||
return false
|
||||
if len(aNodes) != len(bNodes) {
|
||||
return len(aNodes) < len(bNodes)
|
||||
}
|
||||
// ok, now we are sure everything was equal. so we use the spec text to break ties
|
||||
return a.Text() < b.Text()
|
||||
for i := 0; i < len(aNodes); i++ {
|
||||
if aNodes[i].Text != bNodes[i].Text {
|
||||
return aNodes[i].Text < bNodes[i].Text
|
||||
}
|
||||
}
|
||||
// ok, all those texts were equal. we'll use the ID of the most deeply nested node as a last resort
|
||||
return aNodes[len(aNodes)-1].ID < bNodes[len(bNodes)-1].ID
|
||||
}
|
||||
|
||||
type GroupedSpecIndices []SpecIndices
|
||||
|
26
vendor/github.com/onsi/ginkgo/v2/internal/suite.go
generated
vendored
26
vendor/github.com/onsi/ginkgo/v2/internal/suite.go
generated
vendored
@@ -77,6 +77,20 @@ func NewSuite() *Suite {
|
||||
}
|
||||
}
|
||||
|
||||
func (suite *Suite) Clone() (*Suite, error) {
|
||||
if suite.phase != PhaseBuildTopLevel {
|
||||
return nil, fmt.Errorf("cnanot clone suite after tree has been built")
|
||||
}
|
||||
return &Suite{
|
||||
tree: &TreeNode{},
|
||||
phase: PhaseBuildTopLevel,
|
||||
ProgressReporterManager: NewProgressReporterManager(),
|
||||
topLevelContainers: suite.topLevelContainers.Clone(),
|
||||
suiteNodes: suite.suiteNodes.Clone(),
|
||||
selectiveLock: &sync.Mutex{},
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (suite *Suite) BuildTree() error {
|
||||
// During PhaseBuildTopLevel, the top level containers are stored in suite.topLevelCotainers and entered
|
||||
// We now enter PhaseBuildTree where these top level containers are entered and added to the spec tree
|
||||
@@ -245,7 +259,9 @@ func (suite *Suite) pushCleanupNode(node Node) error {
|
||||
|
||||
node.NodeIDWhereCleanupWasGenerated = suite.currentNode.ID
|
||||
node.NestingLevel = suite.currentNode.NestingLevel
|
||||
suite.selectiveLock.Lock()
|
||||
suite.cleanupNodes = append(suite.cleanupNodes, node)
|
||||
suite.selectiveLock.Unlock()
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -326,6 +342,16 @@ func (suite *Suite) CurrentSpecReport() types.SpecReport {
|
||||
return report
|
||||
}
|
||||
|
||||
// Only valid in the preview context. In general suite.report only includes
|
||||
// the specs run by _this_ node - it is only at the end of the suite that
|
||||
// the parallel reports are aggregated. However in the preview context we run
|
||||
// in series and
|
||||
func (suite *Suite) GetPreviewReport() types.Report {
|
||||
suite.selectiveLock.Lock()
|
||||
defer suite.selectiveLock.Unlock()
|
||||
return suite.report
|
||||
}
|
||||
|
||||
func (suite *Suite) AddReportEntry(entry ReportEntry) error {
|
||||
if suite.phase != PhaseRun {
|
||||
return types.GinkgoErrors.AddReportEntryNotDuringRunPhase(entry.Location)
|
||||
|
6
vendor/github.com/onsi/ginkgo/v2/internal/writer.go
generated
vendored
6
vendor/github.com/onsi/ginkgo/v2/internal/writer.go
generated
vendored
@@ -135,6 +135,10 @@ func (w *Writer) Println(a ...interface{}) {
|
||||
|
||||
func GinkgoLogrFunc(writer *Writer) logr.Logger {
|
||||
return funcr.New(func(prefix, args string) {
|
||||
writer.Printf("%s\n", args)
|
||||
if prefix == "" {
|
||||
writer.Printf("%s\n", args)
|
||||
} else {
|
||||
writer.Printf("%s %s\n", prefix, args)
|
||||
}
|
||||
}, funcr.Options{})
|
||||
}
|
||||
|
13
vendor/github.com/onsi/ginkgo/v2/reporters/json_report.go
generated
vendored
13
vendor/github.com/onsi/ginkgo/v2/reporters/json_report.go
generated
vendored
@@ -4,12 +4,16 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
|
||||
"github.com/onsi/ginkgo/v2/types"
|
||||
)
|
||||
|
||||
//GenerateJSONReport produces a JSON-formatted report at the passed in destination
|
||||
// GenerateJSONReport produces a JSON-formatted report at the passed in destination
|
||||
func GenerateJSONReport(report types.Report, destination string) error {
|
||||
if err := os.MkdirAll(path.Dir(destination), 0770); err != nil {
|
||||
return err
|
||||
}
|
||||
f, err := os.Create(destination)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -25,8 +29,8 @@ func GenerateJSONReport(report types.Report, destination string) error {
|
||||
return f.Close()
|
||||
}
|
||||
|
||||
//MergeJSONReports produces a single JSON-formatted report at the passed in destination by merging the JSON-formatted reports provided in sources
|
||||
//It skips over reports that fail to decode but reports on them via the returned messages []string
|
||||
// MergeJSONReports produces a single JSON-formatted report at the passed in destination by merging the JSON-formatted reports provided in sources
|
||||
// It skips over reports that fail to decode but reports on them via the returned messages []string
|
||||
func MergeAndCleanupJSONReports(sources []string, destination string) ([]string, error) {
|
||||
messages := []string{}
|
||||
allReports := []types.Report{}
|
||||
@@ -46,6 +50,9 @@ func MergeAndCleanupJSONReports(sources []string, destination string) ([]string,
|
||||
allReports = append(allReports, reports...)
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(path.Dir(destination), 0770); err != nil {
|
||||
return messages, err
|
||||
}
|
||||
f, err := os.Create(destination)
|
||||
if err != nil {
|
||||
return messages, err
|
||||
|
7
vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go
generated
vendored
7
vendor/github.com/onsi/ginkgo/v2/reporters/junit_report.go
generated
vendored
@@ -14,6 +14,7 @@ import (
|
||||
"encoding/xml"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo/v2/config"
|
||||
@@ -285,6 +286,9 @@ func GenerateJUnitReportWithConfig(report types.Report, dst string, config Junit
|
||||
TestSuites: []JUnitTestSuite{suite},
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(path.Dir(dst), 0770); err != nil {
|
||||
return err
|
||||
}
|
||||
f, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -322,6 +326,9 @@ func MergeAndCleanupJUnitReports(sources []string, dst string) ([]string, error)
|
||||
mergedReport.TestSuites = append(mergedReport.TestSuites, report.TestSuites...)
|
||||
}
|
||||
|
||||
if err := os.MkdirAll(path.Dir(dst), 0770); err != nil {
|
||||
return messages, err
|
||||
}
|
||||
f, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return messages, err
|
||||
|
4
vendor/github.com/onsi/ginkgo/v2/reporters/teamcity_report.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/v2/reporters/teamcity_report.go
generated
vendored
@@ -11,6 +11,7 @@ package reporters
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
"github.com/onsi/ginkgo/v2/types"
|
||||
@@ -27,6 +28,9 @@ func tcEscape(s string) string {
|
||||
}
|
||||
|
||||
func GenerateTeamcityReport(report types.Report, dst string) error {
|
||||
if err := os.MkdirAll(path.Dir(dst), 0770); err != nil {
|
||||
return err
|
||||
}
|
||||
f, err := os.Create(dst)
|
||||
if err != nil {
|
||||
return err
|
||||
|
1
vendor/github.com/onsi/ginkgo/v2/types/config.go
generated
vendored
1
vendor/github.com/onsi/ginkgo/v2/types/config.go
generated
vendored
@@ -27,6 +27,7 @@ type SuiteConfig struct {
|
||||
FailOnPending bool
|
||||
FailFast bool
|
||||
FlakeAttempts int
|
||||
MustPassRepeatedly int
|
||||
DryRun bool
|
||||
PollProgressAfter time.Duration
|
||||
PollProgressInterval time.Duration
|
||||
|
4
vendor/github.com/onsi/ginkgo/v2/types/errors.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/v2/types/errors.go
generated
vendored
@@ -453,8 +453,8 @@ func (g ginkgoErrors) InvalidEntryDescription(cl CodeLocation) error {
|
||||
|
||||
func (g ginkgoErrors) MissingParametersForTableFunction(cl CodeLocation) error {
|
||||
return GinkgoError{
|
||||
Heading: fmt.Sprintf("No parameters have been passed to the Table Function"),
|
||||
Message: fmt.Sprintf("The Table Function expected at least 1 parameter"),
|
||||
Heading: "No parameters have been passed to the Table Function",
|
||||
Message: "The Table Function expected at least 1 parameter",
|
||||
CodeLocation: cl,
|
||||
DocLink: "table-specs",
|
||||
}
|
||||
|
4
vendor/github.com/onsi/ginkgo/v2/types/types.go
generated
vendored
4
vendor/github.com/onsi/ginkgo/v2/types/types.go
generated
vendored
@@ -97,9 +97,7 @@ func (report Report) Add(other Report) Report {
|
||||
report.RunTime = report.EndTime.Sub(report.StartTime)
|
||||
|
||||
reports := make(SpecReports, len(report.SpecReports)+len(other.SpecReports))
|
||||
for i := range report.SpecReports {
|
||||
reports[i] = report.SpecReports[i]
|
||||
}
|
||||
copy(reports, report.SpecReports)
|
||||
offset := len(report.SpecReports)
|
||||
for i := range other.SpecReports {
|
||||
reports[i+offset] = other.SpecReports[i]
|
||||
|
2
vendor/github.com/onsi/ginkgo/v2/types/version.go
generated
vendored
2
vendor/github.com/onsi/ginkgo/v2/types/version.go
generated
vendored
@@ -1,3 +1,3 @@
|
||||
package types
|
||||
|
||||
const VERSION = "2.9.4"
|
||||
const VERSION = "2.13.0"
|
||||
|
2
vendor/github.com/onsi/gomega/.gitignore
generated
vendored
2
vendor/github.com/onsi/gomega/.gitignore
generated
vendored
@@ -3,5 +3,5 @@
|
||||
.
|
||||
.idea
|
||||
gomega.iml
|
||||
TODO.md
|
||||
TODO
|
||||
.vscode
|
58
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
58
vendor/github.com/onsi/gomega/CHANGELOG.md
generated
vendored
@@ -1,3 +1,61 @@
|
||||
## 1.28.0
|
||||
|
||||
### Features
|
||||
- Add VerifyHost handler to ghttp (#698) [0b03b36]
|
||||
|
||||
### Fixes
|
||||
- Read Body for Newer Responses in HaveHTTPBodyMatcher (#686) [18d6673]
|
||||
|
||||
### Maintenance
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0 (#693) [55a33f3]
|
||||
- Typo in matchers.go (#691) [de68e8f]
|
||||
- Bump commonmarker from 0.23.9 to 0.23.10 in /docs (#690) [ab17f5e]
|
||||
- chore: update test matrix for Go 1.21 (#689) [5069017]
|
||||
- Bump golang.org/x/net from 0.12.0 to 0.14.0 (#688) [babe25f]
|
||||
|
||||
## 1.27.10
|
||||
|
||||
### Fixes
|
||||
- fix: go 1.21 adding goroutine ID to creator+location (#685) [bdc7803]
|
||||
|
||||
## 1.27.9
|
||||
|
||||
### Fixes
|
||||
- Prevent nil-dereference in format.Object for boxed nil error (#681) [3b31fc3]
|
||||
|
||||
### Maintenance
|
||||
- Bump golang.org/x/net from 0.11.0 to 0.12.0 (#679) [360849b]
|
||||
- chore: use String() instead of fmt.Sprintf (#678) [86f3659]
|
||||
- Bump golang.org/x/net from 0.10.0 to 0.11.0 (#674) [642ead0]
|
||||
- chore: unnecessary use of fmt.Sprintf (#677) [ceb9ca6]
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.10.0 to 2.11.0 (#675) [a2087d8]
|
||||
- docs: fix ContainSubstring references (#673) [fc9a89f]
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.9.7 to 2.10.0 (#671) [9076019]
|
||||
|
||||
## 1.27.8
|
||||
|
||||
### Fixes
|
||||
- HaveExactElement should not call FailureMessage if a submatcher returned an error [096f392]
|
||||
|
||||
### Maintenance
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.9.5 to 2.9.7 (#669) [8884bee]
|
||||
|
||||
## 1.27.7
|
||||
|
||||
### Fixes
|
||||
- fix: gcustom.MakeMatcher accepts nil as actual value (#666) [57054d5]
|
||||
|
||||
### Maintenance
|
||||
- update gitignore [05c1bc6]
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.9.4 to 2.9.5 (#663) [7cadcf6]
|
||||
- Bump golang.org/x/net from 0.9.0 to 0.10.0 (#662) [b524839]
|
||||
- Bump github.com/onsi/ginkgo/v2 from 2.9.2 to 2.9.4 (#661) [5f44694]
|
||||
- Bump commonmarker from 0.23.8 to 0.23.9 in /docs (#657) [05dc99a]
|
||||
- Bump nokogiri from 1.14.1 to 1.14.3 in /docs (#658) [3a033d1]
|
||||
- Replace deprecated NewGomegaWithT with NewWithT (#659) [a19238f]
|
||||
- Bump golang.org/x/net from 0.8.0 to 0.9.0 (#656) [29ed041]
|
||||
- Bump actions/setup-go from 3 to 4 (#651) [11b2080]
|
||||
|
||||
## 1.27.6
|
||||
|
||||
### Fixes
|
||||
|
4
vendor/github.com/onsi/gomega/format/format.go
generated
vendored
4
vendor/github.com/onsi/gomega/format/format.go
generated
vendored
@@ -259,7 +259,7 @@ func Object(object interface{}, indentation uint) string {
|
||||
indent := strings.Repeat(Indent, int(indentation))
|
||||
value := reflect.ValueOf(object)
|
||||
commonRepresentation := ""
|
||||
if err, ok := object.(error); ok {
|
||||
if err, ok := object.(error); ok && !isNilValue(value) { // isNilValue check needed here to avoid nil deref due to boxed nil
|
||||
commonRepresentation += "\n" + IndentString(err.Error(), indentation) + "\n" + indent
|
||||
}
|
||||
return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation))
|
||||
@@ -302,7 +302,7 @@ func formatType(v reflect.Value) string {
|
||||
case reflect.Map:
|
||||
return fmt.Sprintf("%s | len:%d", v.Type(), v.Len())
|
||||
default:
|
||||
return fmt.Sprintf("%s", v.Type())
|
||||
return v.Type().String()
|
||||
}
|
||||
}
|
||||
|
||||
|
4
vendor/github.com/onsi/gomega/gcustom/make_matcher.go
generated
vendored
4
vendor/github.com/onsi/gomega/gcustom/make_matcher.go
generated
vendored
@@ -97,7 +97,9 @@ func MakeMatcher(matchFunc any, args ...any) CustomGomegaMatcher {
|
||||
finalMatchFunc = reflect.MakeFunc(reflect.TypeOf(finalMatchFunc),
|
||||
func(args []reflect.Value) []reflect.Value {
|
||||
actual := args[0].Interface()
|
||||
if reflect.TypeOf(actual).AssignableTo(t.In(0)) {
|
||||
if actual == nil && reflect.TypeOf(actual) == reflect.TypeOf(nil) {
|
||||
return matchFuncValue.Call([]reflect.Value{reflect.New(t.In(0)).Elem()})
|
||||
} else if reflect.TypeOf(actual).AssignableTo(t.In(0)) {
|
||||
return matchFuncValue.Call([]reflect.Value{reflect.ValueOf(actual)})
|
||||
} else {
|
||||
return []reflect.Value{
|
||||
|
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
2
vendor/github.com/onsi/gomega/gomega_dsl.go
generated
vendored
@@ -22,7 +22,7 @@ import (
|
||||
"github.com/onsi/gomega/types"
|
||||
)
|
||||
|
||||
const GOMEGA_VERSION = "1.27.6"
|
||||
const GOMEGA_VERSION = "1.28.0"
|
||||
|
||||
const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler.
|
||||
If you're using Ginkgo then you probably forgot to put your assertion in an It().
|
||||
|
6
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
6
vendor/github.com/onsi/gomega/matchers.go
generated
vendored
@@ -92,9 +92,9 @@ func Succeed() types.GomegaMatcher {
|
||||
//
|
||||
// These are valid use-cases:
|
||||
//
|
||||
// Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error"
|
||||
// Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual)
|
||||
// Expect(err).Should(MatchError(ContainsSubstring("sprocket not found"))) // asserts that edrr.Error() contains substring "sprocket not found"
|
||||
// Expect(err).Should(MatchError("an error")) //asserts that err.Error() == "an error"
|
||||
// Expect(err).Should(MatchError(SomeError)) //asserts that err == SomeError (via reflect.DeepEqual)
|
||||
// Expect(err).Should(MatchError(ContainSubstring("sprocket not found"))) // asserts that err.Error() contains substring "sprocket not found"
|
||||
//
|
||||
// It is an error for err to be nil or an object that does not implement the
|
||||
// Error interface
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_a_directory.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_a_directory.go
generated
vendored
@@ -52,5 +52,5 @@ func (matcher *BeADirectoryMatcher) FailureMessage(actual interface{}) (message
|
||||
}
|
||||
|
||||
func (matcher *BeADirectoryMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, fmt.Sprintf("not be a directory"))
|
||||
return format.Message(actual, "not be a directory")
|
||||
}
|
||||
|
2
vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go
generated
vendored
2
vendor/github.com/onsi/gomega/matchers/be_a_regular_file.go
generated
vendored
@@ -52,5 +52,5 @@ func (matcher *BeARegularFileMatcher) FailureMessage(actual interface{}) (messag
|
||||
}
|
||||
|
||||
func (matcher *BeARegularFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, fmt.Sprintf("not be a regular file"))
|
||||
return format.Message(actual, "not be a regular file")
|
||||
}
|
||||
|
4
vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go
generated
vendored
4
vendor/github.com/onsi/gomega/matchers/be_an_existing_file.go
generated
vendored
@@ -32,9 +32,9 @@ func (matcher *BeAnExistingFileMatcher) Match(actual interface{}) (success bool,
|
||||
}
|
||||
|
||||
func (matcher *BeAnExistingFileMatcher) FailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, fmt.Sprintf("to exist"))
|
||||
return format.Message(actual, "to exist")
|
||||
}
|
||||
|
||||
func (matcher *BeAnExistingFileMatcher) NegatedFailureMessage(actual interface{}) (message string) {
|
||||
return format.Message(actual, fmt.Sprintf("not to exist"))
|
||||
return format.Message(actual, "not to exist")
|
||||
}
|
||||
|
7
vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
generated
vendored
7
vendor/github.com/onsi/gomega/matchers/have_exact_elements.go
generated
vendored
@@ -44,7 +44,12 @@ func (matcher *HaveExactElementsMatcher) Match(actual interface{}) (success bool
|
||||
|
||||
elemMatcher := matchers[i].(omegaMatcher)
|
||||
match, err := elemMatcher.Match(values[i])
|
||||
if err != nil || !match {
|
||||
if err != nil {
|
||||
matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
|
||||
index: i,
|
||||
failure: err.Error(),
|
||||
})
|
||||
} else if !match {
|
||||
matcher.mismatchFailures = append(matcher.mismatchFailures, mismatchFailure{
|
||||
index: i,
|
||||
failure: elemMatcher.FailureMessage(values[i]),
|
||||
|
9
vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go
generated
vendored
9
vendor/github.com/onsi/gomega/matchers/have_http_body_matcher.go
generated
vendored
@@ -11,8 +11,9 @@ import (
|
||||
)
|
||||
|
||||
type HaveHTTPBodyMatcher struct {
|
||||
Expected interface{}
|
||||
cachedBody []byte
|
||||
Expected interface{}
|
||||
cachedResponse interface{}
|
||||
cachedBody []byte
|
||||
}
|
||||
|
||||
func (matcher *HaveHTTPBodyMatcher) Match(actual interface{}) (bool, error) {
|
||||
@@ -73,7 +74,7 @@ func (matcher *HaveHTTPBodyMatcher) NegatedFailureMessage(actual interface{}) (m
|
||||
// the Reader is closed and it is not readable again in FailureMessage()
|
||||
// or NegatedFailureMessage()
|
||||
func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) {
|
||||
if matcher.cachedBody != nil {
|
||||
if matcher.cachedResponse == actual && matcher.cachedBody != nil {
|
||||
return matcher.cachedBody, nil
|
||||
}
|
||||
|
||||
@@ -91,8 +92,10 @@ func (matcher *HaveHTTPBodyMatcher) body(actual interface{}) ([]byte, error) {
|
||||
|
||||
switch a := actual.(type) {
|
||||
case *http.Response:
|
||||
matcher.cachedResponse = a
|
||||
return body(a)
|
||||
case *httptest.ResponseRecorder:
|
||||
matcher.cachedResponse = a
|
||||
return body(a.Result())
|
||||
default:
|
||||
return nil, fmt.Errorf("HaveHTTPBody matcher expects *http.Response or *httptest.ResponseRecorder. Got:\n%s", format.Object(actual, 1))
|
||||
|
Reference in New Issue
Block a user