matcher

package
v0.11.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package matcher provides Gomega TDD matchers for certain whalewatcher elements, such as for matching container names or IDs.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func All added in v0.9.0

func All(matchers ...types.GomegaMatcher) types.GomegaMatcher

All succeeds only after it has been shown a sequence of actual values that “ticked off” the specified matchers in no particular order. All will return an error in case it encounters an actual value not matching any of the specified matchers. If the same match should occur multiple times it needs to be specified as many times as required.

func BeAContainerEvent

func BeAContainerEvent(matchers ...types.GomegaMatcher) types.GomegaMatcher

BeAContainerEvent succeeds when the actual value is an engineclient.ContainerEvent and additionally all passed matchers also succeed.

func HaveEventType

func HaveEventType(evtype engineclient.ContainerEventType) types.GomegaMatcher

HaveEventType succeeds if the actual value has a "Type" field with the specified ContainerEventType value.

func HaveID

func HaveID(id interface{}) types.GomegaMatcher

HaveID succeeds if the actual value has an "ID" field and matches the specified id.

Example
container := whalewatcher.Container{
	Name: "foolbar",
	ID:   "12deadbeef89",
}
Expect(container).To(HaveID("12deadbeef89"))
Expect(container).NotTo(HaveID("foobar"))
Output:

func HaveName

func HaveName(name interface{}) types.GomegaMatcher

HaveName succeeds if the actual value has a "Name" field and matches the specified name.

Example
container := whalewatcher.Container{
	Name: "foolbar",
	ID:   "12deadbeef89",
}
Expect(container).To(HaveName("foolbar"))
Expect(container).NotTo(HaveName("foobar"))
Output:

Example (NameAndID)
container := whalewatcher.Container{
	Name: "12deadbeed89",
	ID:   "12deadbeef89",
}
Expect(container).To(Or(HaveName("foolbar"), HaveID("12deadbeef89")))
Output:

func HaveProject

func HaveProject(name string) types.GomegaMatcher

HaveProject succeeds if the actual value has a "Project" field and matches the specified project name.

Example
container := whalewatcher.Container{
	Name:    "foolbar",
	ID:      "12deadbeef89",
	Project: "myproj",
}
Expect(container).To(HaveProject("myproj"))
Expect(container).NotTo(HaveProject("fred's-project"))
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL