matcher

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2023 License: Apache-2.0 Imports: 3 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 BeAContainerEvent

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

BeAContainerEvent succeeds when the actual value is a 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