Path: blob/main/vendor/github.com/onsi/gomega/gomega_dsl.go
2875 views
/*1Gomega is the Ginkgo BDD-style testing framework's preferred matcher library.23The godoc documentation describes Gomega's API. More comprehensive documentation (with examples!) is available at http://onsi.github.io/gomega/45Gomega on Github: http://github.com/onsi/gomega67Learn more about Ginkgo online: http://onsi.github.io/ginkgo89Ginkgo on Github: http://github.com/onsi/ginkgo1011Gomega is MIT-Licensed12*/13package gomega1415import (16"errors"17"fmt"18"time"1920"github.com/onsi/gomega/internal"21"github.com/onsi/gomega/types"22)2324const GOMEGA_VERSION = "1.38.2"2526const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler.27If you're using Ginkgo then you probably forgot to put your assertion in an It().28Alternatively, you may have forgotten to register a fail handler with RegisterFailHandler() or RegisterTestingT().29Depending on your vendoring solution you may be inadvertently importing gomega and subpackages (e.g. ghhtp, gexec,...) from different locations.30`3132// Gomega describes the essential Gomega DSL. This interface allows libraries33// to abstract between the standard package-level function implementations34// and alternatives like *WithT.35//36// The types in the top-level DSL have gotten a bit messy due to earlier deprecations that avoid stuttering37// and due to an accidental use of a concrete type (*WithT) in an earlier release.38//39// As of 1.15 both the WithT and Ginkgo variants of Gomega are implemented by the same underlying object40// however one (the Ginkgo variant) is exported as an interface (types.Gomega) whereas the other (the withT variant)41// is shared as a concrete type (*WithT, which is aliased to *internal.Gomega). 1.15 did not clean this mess up to ensure42// that declarations of *WithT in existing code are not broken by the upgrade to 1.15.43type Gomega = types.Gomega4445// DefaultGomega supplies the standard package-level implementation46var Default = Gomega(internal.NewGomega(internal.FetchDefaultDurationBundle()))4748// NewGomega returns an instance of Gomega wired into the passed-in fail handler.49// You generally don't need to use this when using Ginkgo - RegisterFailHandler will wire up the global gomega50// However creating a NewGomega with a custom fail handler can be useful in contexts where you want to use Gomega's51// rich ecosystem of matchers without causing a test to fail. For example, to aggregate a series of potential failures52// or for use in a non-test setting.53func NewGomega(fail types.GomegaFailHandler) Gomega {54return internal.NewGomega(internalGomega(Default).DurationBundle).ConfigureWithFailHandler(fail)55}5657// WithT wraps a *testing.T and provides `Expect`, `Eventually`, and `Consistently` methods. This allows you to leverage58// Gomega's rich ecosystem of matchers in standard `testing` test suites.59//60// Use `NewWithT` to instantiate a `WithT`61//62// As of 1.15 both the WithT and Ginkgo variants of Gomega are implemented by the same underlying object63// however one (the Ginkgo variant) is exported as an interface (types.Gomega) whereas the other (the withT variant)64// is shared as a concrete type (*WithT, which is aliased to *internal.Gomega). 1.15 did not clean this mess up to ensure65// that declarations of *WithT in existing code are not broken by the upgrade to 1.15.66type WithT = internal.Gomega6768// GomegaWithT is deprecated in favor of gomega.WithT, which does not stutter.69type GomegaWithT = WithT7071// inner is an interface that allows users to provide a wrapper around Default. The wrapper72// must implement the inner interface and return either the original Default or the result of73// a call to NewGomega().74type inner interface {75Inner() Gomega76}7778func internalGomega(g Gomega) *internal.Gomega {79if v, ok := g.(inner); ok {80return v.Inner().(*internal.Gomega)81}82return g.(*internal.Gomega)83}8485// NewWithT takes a *testing.T and returns a `gomega.WithT` allowing you to use `Expect`, `Eventually`, and `Consistently` along with86// Gomega's rich ecosystem of matchers in standard `testing` test suits.87//88// func TestFarmHasCow(t *testing.T) {89// g := gomega.NewWithT(t)90//91// f := farm.New([]string{"Cow", "Horse"})92// g.Expect(f.HasCow()).To(BeTrue(), "Farm should have cow")93// }94func NewWithT(t types.GomegaTestingT) *WithT {95return internal.NewGomega(internalGomega(Default).DurationBundle).ConfigureWithT(t)96}9798// NewGomegaWithT is deprecated in favor of gomega.NewWithT, which does not stutter.99var NewGomegaWithT = NewWithT100101// RegisterFailHandler connects Ginkgo to Gomega. When a matcher fails102// the fail handler passed into RegisterFailHandler is called.103func RegisterFailHandler(fail types.GomegaFailHandler) {104internalGomega(Default).ConfigureWithFailHandler(fail)105}106107// RegisterFailHandlerWithT is deprecated and will be removed in a future release.108// users should use RegisterFailHandler, or RegisterTestingT109func RegisterFailHandlerWithT(_ types.GomegaTestingT, fail types.GomegaFailHandler) {110fmt.Println("RegisterFailHandlerWithT is deprecated. Please use RegisterFailHandler or RegisterTestingT instead.")111internalGomega(Default).ConfigureWithFailHandler(fail)112}113114// RegisterTestingT connects Gomega to Golang's XUnit style115// Testing.T tests. It is now deprecated and you should use NewWithT() instead to get a fresh instance of Gomega for each test.116func RegisterTestingT(t types.GomegaTestingT) {117internalGomega(Default).ConfigureWithT(t)118}119120// InterceptGomegaFailures runs a given callback and returns an array of121// failure messages generated by any Gomega assertions within the callback.122// Execution continues after the first failure allowing users to collect all failures123// in the callback.124//125// This is most useful when testing custom matchers, but can also be used to check126// on a value using a Gomega assertion without causing a test failure.127func InterceptGomegaFailures(f func()) []string {128originalHandler := internalGomega(Default).Fail129failures := []string{}130internalGomega(Default).Fail = func(message string, callerSkip ...int) {131failures = append(failures, message)132}133defer func() {134internalGomega(Default).Fail = originalHandler135}()136f()137return failures138}139140// InterceptGomegaFailure runs a given callback and returns the first141// failure message generated by any Gomega assertions within the callback, wrapped in an error.142//143// The callback ceases execution as soon as the first failed assertion occurs, however Gomega144// does not register a failure with the FailHandler registered via RegisterFailHandler - it is up145// to the user to decide what to do with the returned error146func InterceptGomegaFailure(f func()) (err error) {147originalHandler := internalGomega(Default).Fail148internalGomega(Default).Fail = func(message string, callerSkip ...int) {149err = errors.New(message)150panic("stop execution")151}152153defer func() {154internalGomega(Default).Fail = originalHandler155if e := recover(); e != nil {156if err == nil {157panic(e)158}159}160}()161162f()163return err164}165166func ensureDefaultGomegaIsConfigured() {167if !internalGomega(Default).IsConfigured() {168panic(nilGomegaPanic)169}170}171172// Ω wraps an actual value allowing assertions to be made on it:173//174// Ω("foo").Should(Equal("foo"))175//176// If Ω is passed more than one argument it will pass the *first* argument to the matcher.177// All subsequent arguments will be required to be nil/zero.178//179// This is convenient if you want to make an assertion on a method/function that returns180// a value and an error - a common pattern in Go.181//182// For example, given a function with signature:183//184// func MyAmazingThing() (int, error)185//186// Then:187//188// Ω(MyAmazingThing()).Should(Equal(3))189//190// Will succeed only if `MyAmazingThing()` returns `(3, nil)`191//192// Ω and Expect are identical193func Ω(actual any, extra ...any) Assertion {194ensureDefaultGomegaIsConfigured()195return Default.Ω(actual, extra...)196}197198// Expect wraps an actual value allowing assertions to be made on it:199//200// Expect("foo").To(Equal("foo"))201//202// If Expect is passed more than one argument it will pass the *first* argument to the matcher.203// All subsequent arguments will be required to be nil/zero.204//205// This is convenient if you want to make an assertion on a method/function that returns206// a value and an error - a common pattern in Go.207//208// For example, given a function with signature:209//210// func MyAmazingThing() (int, error)211//212// Then:213//214// Expect(MyAmazingThing()).Should(Equal(3))215//216// Will succeed only if `MyAmazingThing()` returns `(3, nil)`217//218// Expect and Ω are identical219func Expect(actual any, extra ...any) Assertion {220ensureDefaultGomegaIsConfigured()221return Default.Expect(actual, extra...)222}223224// ExpectWithOffset wraps an actual value allowing assertions to be made on it:225//226// ExpectWithOffset(1, "foo").To(Equal("foo"))227//228// Unlike `Expect` and `Ω`, `ExpectWithOffset` takes an additional integer argument229// that is used to modify the call-stack offset when computing line numbers. It is230// the same as `Expect(...).WithOffset`.231//232// This is most useful in helper functions that make assertions. If you want Gomega's233// error message to refer to the calling line in the test (as opposed to the line in the helper function)234// set the first argument of `ExpectWithOffset` appropriately.235func ExpectWithOffset(offset int, actual any, extra ...any) Assertion {236ensureDefaultGomegaIsConfigured()237return Default.ExpectWithOffset(offset, actual, extra...)238}239240/*241Eventually enables making assertions on asynchronous behavior.242243Eventually checks that an assertion *eventually* passes. Eventually blocks when called and attempts an assertion periodically until it passes or a timeout occurs. Both the timeout and polling interval are configurable as optional arguments.244The first optional argument is the timeout (which defaults to 1s), the second is the polling interval (which defaults to 10ms). Both intervals can be specified as time.Duration, parsable duration strings or floats/integers (in which case they are interpreted as seconds). In addition an optional context.Context can be passed in - Eventually will keep trying until either the timeout expires or the context is cancelled, whichever comes first.245246Eventually works with any Gomega compatible matcher and supports making assertions against three categories of actual value:247248**Category 1: Making Eventually assertions on values**249250There are several examples of values that can change over time. These can be passed in to Eventually and will be passed to the matcher repeatedly until a match occurs. For example:251252c := make(chan bool)253go DoStuff(c)254Eventually(c, "50ms").Should(BeClosed())255256will poll the channel repeatedly until it is closed. In this example `Eventually` will block until either the specified timeout of 50ms has elapsed or the channel is closed, whichever comes first.257258Several Gomega libraries allow you to use Eventually in this way. For example, the gomega/gexec package allows you to block until a *gexec.Session exits successfully via:259260Eventually(session).Should(gexec.Exit(0))261262And the gomega/gbytes package allows you to monitor a streaming *gbytes.Buffer until a given string is seen:263264Eventually(buffer).Should(gbytes.Say("hello there"))265266In these examples, both `session` and `buffer` are designed to be thread-safe when polled by the `Exit` and `Say` matchers. This is not true in general of most raw values, so while it is tempting to do something like:267268// THIS IS NOT THREAD-SAFE269var s *string270go mutateStringEventually(s)271Eventually(s).Should(Equal("I've changed"))272273this will trigger Go's race detector as the goroutine polling via Eventually will race over the value of s with the goroutine mutating the string. For cases like this you can use channels or introduce your own locking around s by passing Eventually a function.274275**Category 2: Make Eventually assertions on functions**276277Eventually can be passed functions that **return at least one value**. When configured this way, Eventually will poll the function repeatedly and pass the first returned value to the matcher.278279For example:280281Eventually(func() int {282return client.FetchCount()283}).Should(BeNumerically(">=", 17))284285will repeatedly poll client.FetchCount until the BeNumerically matcher is satisfied. (Note that this example could have been written as Eventually(client.FetchCount).Should(BeNumerically(">=", 17)))286287If multiple values are returned by the function, Eventually will pass the first value to the matcher and require that all others are zero-valued. This allows you to pass Eventually a function that returns a value and an error - a common pattern in Go.288289For example, consider a method that returns a value and an error:290291func FetchFromDB() (string, error)292293Then294295Eventually(FetchFromDB).Should(Equal("got it"))296297will pass only if and when the returned error is nil *and* the returned string satisfies the matcher.298299Eventually can also accept functions that take arguments, however you must provide those arguments using .WithArguments(). For example, consider a function that takes a user-id and makes a network request to fetch a full name:300301func FetchFullName(userId int) (string, error)302303You can poll this function like so:304305Eventually(FetchFullName).WithArguments(1138).Should(Equal("Wookie"))306307It is important to note that the function passed into Eventually is invoked *synchronously* when polled. Eventually does not (in fact, it cannot) kill the function if it takes longer to return than Eventually's configured timeout. A common practice here is to use a context. Here's an example that combines Ginkgo's spec timeout support with Eventually:308309It("fetches the correct count", func(ctx SpecContext) {310Eventually(ctx, func() int {311return client.FetchCount(ctx, "/users")312}).Should(BeNumerically(">=", 17))313}, SpecTimeout(time.Second))314315you an also use Eventually().WithContext(ctx) to pass in the context. Passed-in contexts play nicely with passed-in arguments as long as the context appears first. You can rewrite the above example as:316317It("fetches the correct count", func(ctx SpecContext) {318Eventually(client.FetchCount).WithContext(ctx).WithArguments("/users").Should(BeNumerically(">=", 17))319}, SpecTimeout(time.Second))320321Either way the context passed to Eventually is also passed to the underlying function. Now, when Ginkgo cancels the context both the FetchCount client and Gomega will be informed and can exit.322323By default, when a context is passed to Eventually *without* an explicit timeout, Gomega will rely solely on the context's cancellation to determine when to stop polling. If you want to specify a timeout in addition to the context you can do so using the .WithTimeout() method. For example:324325Eventually(client.FetchCount).WithContext(ctx).WithTimeout(10*time.Second).Should(BeNumerically(">=", 17))326327now either the context cancellation or the timeout will cause Eventually to stop polling.328329If, instead, you would like to opt out of this behavior and have Gomega's default timeouts govern Eventuallys that take a context you can call:330331EnforceDefaultTimeoutsWhenUsingContexts()332333in the DSL (or on a Gomega instance). Now all calls to Eventually that take a context will fail if either the context is cancelled or the default timeout elapses.334335**Category 3: Making assertions _in_ the function passed into Eventually**336337When testing complex systems it can be valuable to assert that a _set_ of assertions passes Eventually. Eventually supports this by accepting functions that take a single Gomega argument and return zero or more values.338339Here's an example that makes some assertions and returns a value and error:340341Eventually(func(g Gomega) (Widget, error) {342ids, err := client.FetchIDs()343g.Expect(err).NotTo(HaveOccurred())344g.Expect(ids).To(ContainElement(1138))345return client.FetchWidget(1138)346}).Should(Equal(expectedWidget))347348will pass only if all the assertions in the polled function pass and the return value satisfied the matcher.349350Eventually also supports a special case polling function that takes a single Gomega argument and returns no values. Eventually assumes such a function is making assertions and is designed to work with the Succeed matcher to validate that all assertions have passed.351For example:352353Eventually(func(g Gomega) {354model, err := client.Find(1138)355g.Expect(err).NotTo(HaveOccurred())356g.Expect(model.Reticulate()).To(Succeed())357g.Expect(model.IsReticulated()).To(BeTrue())358g.Expect(model.Save()).To(Succeed())359}).Should(Succeed())360361will rerun the function until all assertions pass.362363You can also pass additional arguments to functions that take a Gomega. The only rule is that the Gomega argument must be first. If you also want to pass the context attached to Eventually you must ensure that is the second argument. For example:364365Eventually(func(g Gomega, ctx context.Context, path string, expected ...string){366tok, err := client.GetToken(ctx)367g.Expect(err).NotTo(HaveOccurred())368369elements, err := client.Fetch(ctx, tok, path)370g.Expect(err).NotTo(HaveOccurred())371g.Expect(elements).To(ConsistOf(expected))372}).WithContext(ctx).WithArguments("/names", "Joe", "Jane", "Sam").Should(Succeed())373374You can ensure that you get a number of consecutive successful tries before succeeding using `MustPassRepeatedly(int)`. For Example:375376int count := 0377Eventually(func() bool {378count++379return count > 2380}).MustPassRepeatedly(2).Should(BeTrue())381// Because we had to wait for 2 calls that returned true382Expect(count).To(Equal(3))383384Finally, in addition to passing timeouts and a context to Eventually you can be more explicit with Eventually's chaining configuration methods:385386Eventually(..., "10s", "2s", ctx).Should(...)387388is equivalent to389390Eventually(...).WithTimeout(10*time.Second).WithPolling(2*time.Second).WithContext(ctx).Should(...)391*/392func Eventually(actualOrCtx any, args ...any) AsyncAssertion {393ensureDefaultGomegaIsConfigured()394return Default.Eventually(actualOrCtx, args...)395}396397// EventuallyWithOffset operates like Eventually but takes an additional398// initial argument to indicate an offset in the call stack. This is useful when building helper399// functions that contain matchers. To learn more, read about `ExpectWithOffset`.400//401// `EventuallyWithOffset` is the same as `Eventually(...).WithOffset`.402//403// `EventuallyWithOffset` specifying a timeout interval (and an optional polling interval) are404// the same as `Eventually(...).WithOffset(...).WithTimeout` or405// `Eventually(...).WithOffset(...).WithTimeout(...).WithPolling`.406func EventuallyWithOffset(offset int, actualOrCtx any, args ...any) AsyncAssertion {407ensureDefaultGomegaIsConfigured()408return Default.EventuallyWithOffset(offset, actualOrCtx, args...)409}410411/*412Consistently, like Eventually, enables making assertions on asynchronous behavior.413414Consistently blocks when called for a specified duration. During that duration Consistently repeatedly polls its matcher and ensures that it is satisfied. If the matcher is consistently satisfied, then Consistently will pass. Otherwise Consistently will fail.415416Both the total waiting duration and the polling interval are configurable as optional arguments. The first optional argument is the duration that Consistently will run for (defaults to 100ms), and the second argument is the polling interval (defaults to 10ms). As with Eventually, these intervals can be passed in as time.Duration, parsable duration strings or an integer or float number of seconds. You can also pass in an optional context.Context - Consistently will exit early (with a failure) if the context is cancelled before the waiting duration expires.417418Consistently accepts the same three categories of actual as Eventually, check the Eventually docs to learn more.419420Consistently is useful in cases where you want to assert that something *does not happen* for a period of time. For example, you may want to assert that a goroutine does *not* send data down a channel. In this case you could write:421422Consistently(channel, "200ms").ShouldNot(Receive())423424This will block for 200 milliseconds and repeatedly check the channel and ensure nothing has been received.425*/426func Consistently(actualOrCtx any, args ...any) AsyncAssertion {427ensureDefaultGomegaIsConfigured()428return Default.Consistently(actualOrCtx, args...)429}430431// ConsistentlyWithOffset operates like Consistently but takes an additional432// initial argument to indicate an offset in the call stack. This is useful when building helper433// functions that contain matchers. To learn more, read about `ExpectWithOffset`.434//435// `ConsistentlyWithOffset` is the same as `Consistently(...).WithOffset` and436// optional `WithTimeout` and `WithPolling`.437func ConsistentlyWithOffset(offset int, actualOrCtx any, args ...any) AsyncAssertion {438ensureDefaultGomegaIsConfigured()439return Default.ConsistentlyWithOffset(offset, actualOrCtx, args...)440}441442/*443StopTrying can be used to signal to Eventually and Consistently that they should abort and stop trying. This always results in a failure of the assertion - and the failure message is the content of the StopTrying signal.444445You can send the StopTrying signal by either returning StopTrying("message") as an error from your passed-in function _or_ by calling StopTrying("message").Now() to trigger a panic and end execution.446447You can also wrap StopTrying around an error with `StopTrying("message").Wrap(err)` and can attach additional objects via `StopTrying("message").Attach("description", object). When rendered, the signal will include the wrapped error and any attached objects rendered using Gomega's default formatting.448449Here are a couple of examples. This is how you might use StopTrying() as an error to signal that Eventually should stop:450451playerIndex, numPlayers := 0, 11452Eventually(func() (string, error) {453if playerIndex == numPlayers {454return "", StopTrying("no more players left")455}456name := client.FetchPlayer(playerIndex)457playerIndex += 1458return name, nil459}).Should(Equal("Patrick Mahomes"))460461And here's an example where `StopTrying().Now()` is called to halt execution immediately:462463Eventually(func() []string {464names, err := client.FetchAllPlayers()465if err == client.IRRECOVERABLE_ERROR {466StopTrying("Irrecoverable error occurred").Wrap(err).Now()467}468return names469}).Should(ContainElement("Patrick Mahomes"))470*/471var StopTrying = internal.StopTrying472473/*474TryAgainAfter(<duration>) allows you to adjust the polling interval for the _next_ iteration of `Eventually` or `Consistently`. Like `StopTrying` you can either return `TryAgainAfter` as an error or trigger it immedieately with `.Now()`475476When `TryAgainAfter(<duration>` is triggered `Eventually` and `Consistently` will wait for that duration. If a timeout occurs before the next poll is triggered both `Eventually` and `Consistently` will always fail with the content of the TryAgainAfter message. As with StopTrying you can `.Wrap()` and error and `.Attach()` additional objects to `TryAgainAfter`.477*/478var TryAgainAfter = internal.TryAgainAfter479480/*481PollingSignalError is the error returned by StopTrying() and TryAgainAfter()482*/483type PollingSignalError = internal.PollingSignalError484485// SetDefaultEventuallyTimeout sets the default timeout duration for Eventually. Eventually will repeatedly poll your condition until it succeeds, or until this timeout elapses.486func SetDefaultEventuallyTimeout(t time.Duration) {487Default.SetDefaultEventuallyTimeout(t)488}489490// SetDefaultEventuallyPollingInterval sets the default polling interval for Eventually.491func SetDefaultEventuallyPollingInterval(t time.Duration) {492Default.SetDefaultEventuallyPollingInterval(t)493}494495// SetDefaultConsistentlyDuration sets the default duration for Consistently. Consistently will verify that your condition is satisfied for this long.496func SetDefaultConsistentlyDuration(t time.Duration) {497Default.SetDefaultConsistentlyDuration(t)498}499500// SetDefaultConsistentlyPollingInterval sets the default polling interval for Consistently.501func SetDefaultConsistentlyPollingInterval(t time.Duration) {502Default.SetDefaultConsistentlyPollingInterval(t)503}504505// EnforceDefaultTimeoutsWhenUsingContexts forces `Eventually` to apply a default timeout even when a context is provided.506func EnforceDefaultTimeoutsWhenUsingContexts() {507Default.EnforceDefaultTimeoutsWhenUsingContexts()508}509510// DisableDefaultTimeoutsWhenUsingContext disables the default timeout when a context is provided to `Eventually`.511func DisableDefaultTimeoutsWhenUsingContext() {512Default.DisableDefaultTimeoutsWhenUsingContext()513}514515// AsyncAssertion is returned by Eventually and Consistently and polls the actual value passed into Eventually against516// the matcher passed to the Should and ShouldNot methods.517//518// Both Should and ShouldNot take a variadic optionalDescription argument.519// This argument allows you to make your failure messages more descriptive.520// If a single argument of type `func() string` is passed, this function will be lazily evaluated if a failure occurs521// and the returned string is used to annotate the failure message.522// Otherwise, this argument is passed on to fmt.Sprintf() and then used to annotate the failure message.523//524// Both Should and ShouldNot return a boolean that is true if the assertion passed and false if it failed.525//526// Example:527//528// Eventually(myChannel).Should(Receive(), "Something should have come down the pipe.")529// Consistently(myChannel).ShouldNot(Receive(), func() string { return "Nothing should have come down the pipe." })530type AsyncAssertion = types.AsyncAssertion531532// GomegaAsyncAssertion is deprecated in favor of AsyncAssertion, which does not stutter.533type GomegaAsyncAssertion = types.AsyncAssertion534535// Assertion is returned by Ω and Expect and compares the actual value to the matcher536// passed to the Should/ShouldNot and To/ToNot/NotTo methods.537//538// Typically Should/ShouldNot are used with Ω and To/ToNot/NotTo are used with Expect539// though this is not enforced.540//541// All methods take a variadic optionalDescription argument.542// This argument allows you to make your failure messages more descriptive.543// If a single argument of type `func() string` is passed, this function will be lazily evaluated if a failure occurs544// and the returned string is used to annotate the failure message.545// Otherwise, this argument is passed on to fmt.Sprintf() and then used to annotate the failure message.546//547// All methods return a bool that is true if the assertion passed and false if it failed.548//549// Example:550//551// Ω(farm.HasCow()).Should(BeTrue(), "Farm %v should have a cow", farm)552type Assertion = types.Assertion553554// GomegaAssertion is deprecated in favor of Assertion, which does not stutter.555type GomegaAssertion = types.Assertion556557// OmegaMatcher is deprecated in favor of the better-named and better-organized types.GomegaMatcher but sticks around to support existing code that uses it558type OmegaMatcher = types.GomegaMatcher559560561