ceph-csi/vendor/github.com/onsi/ginkgo/v2
dependabot[bot] c1ee11261e rebase: bump sigs.k8s.io/controller-runtime
Bumps the k8s-dependencies group with 1 update in the / directory: [sigs.k8s.io/controller-runtime](https://github.com/kubernetes-sigs/controller-runtime).

Updates `sigs.k8s.io/controller-runtime` from 0.17.3 to 0.18.2
- [Release notes](https://github.com/kubernetes-sigs/controller-runtime/releases)
- [Changelog](https://github.com/kubernetes-sigs/controller-runtime/blob/main/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/controller-runtime/compare/v0.17.3...v0.18.2)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/controller-runtime
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: k8s-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-05-24 09:27:53 +00:00
..
config rebase: update kubernetes to v1.25.0 2022-08-25 16:36:35 +00:00
formatter rebase: update github.com/onsi/ginkgo to v2.9.5 2023-06-06 12:21:43 +00:00
ginkgo rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
internal rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
reporters rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
types rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
.gitignore rebase: update github.com/onsi/ginkgo to v2.9.5 2023-06-06 12:21:43 +00:00
CHANGELOG.md rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
CONTRIBUTING.md rebase: bump github.com/onsi/ginkgo/v2 from 2.1.6 to 2.3.1 2022-10-20 08:45:39 +00:00
core_dsl.go rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
decorator_dsl.go rebase: update github.com/onsi/ginkgo to v2.9.5 2023-06-06 12:21:43 +00:00
deprecated_dsl.go rebase: bump github.com/onsi/ginkgo/v2 from 2.1.6 to 2.3.1 2022-10-20 08:45:39 +00:00
ginkgo_cli_dependencies.go rebase: update github.com/onsi/ginkgo to v2.9.5 2023-06-06 12:21:43 +00:00
ginkgo_t_dsl.go rebase: bump the github-dependencies group with 5 updates 2024-01-31 14:44:04 +00:00
LICENSE rebase: update kubernetes to v1.25.0 2022-08-25 16:36:35 +00:00
README.md rebase: Bump github.com/onsi/ginkgo/v2 from 2.11.0 to 2.12.0 2023-08-29 10:23:54 +00:00
RELEASING.md rebase: bump github.com/onsi/ginkgo/v2 from 2.3.1 to 2.4.0 2022-10-25 12:57:58 +00:00
reporting_dsl.go rebase: bump sigs.k8s.io/controller-runtime 2024-05-24 09:27:53 +00:00
table_dsl.go rebase: bump the github-dependencies group with 2 updates 2024-01-17 10:55:17 +00:00

Ginkgo

test | Ginkgo Docs


Ginkgo

Ginkgo is a mature testing framework for Go designed to help you write expressive specs. Ginkgo builds on top of Go's testing foundation and is complemented by the Gomega matcher library. Together, Ginkgo and Gomega let you express the intent behind your specs clearly:

import (
    . "github.com/onsi/ginkgo/v2"
    . "github.com/onsi/gomega"
    ...
)

var _ = Describe("Checking books out of the library", Label("library"), func() {
    var library *libraries.Library
    var book *books.Book
    var valjean *users.User
    BeforeEach(func() {
        library = libraries.NewClient()
        book = &books.Book{
            Title: "Les Miserables",
            Author: "Victor Hugo",
        }
        valjean = users.NewUser("Jean Valjean")
    })

    When("the library has the book in question", func() {
        BeforeEach(func(ctx SpecContext) {
            Expect(library.Store(ctx, book)).To(Succeed())
        })

        Context("and the book is available", func() {
            It("lends it to the reader", func(ctx SpecContext) {
                Expect(valjean.Checkout(ctx, library, "Les Miserables")).To(Succeed())
                Expect(valjean.Books()).To(ContainElement(book))
                Expect(library.UserWithBook(ctx, book)).To(Equal(valjean))
            }, SpecTimeout(time.Second * 5))
        })

        Context("but the book has already been checked out", func() {
            var javert *users.User
            BeforeEach(func(ctx SpecContext) {
                javert = users.NewUser("Javert")
                Expect(javert.Checkout(ctx, library, "Les Miserables")).To(Succeed())
            })

            It("tells the user", func(ctx SpecContext) {
                err := valjean.Checkout(ctx, library, "Les Miserables")
                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) {
                Expect(valjean.Hold(ctx, library, "Les Miserables")).To(Succeed())
                Expect(valjean.Holds(ctx)).To(ContainElement(book))

                By("when Javert returns the book")
                Expect(javert.Return(ctx, library, book)).To(Succeed())

                By("it eventually informs Valjean")
                notification := "Les Miserables is ready for pick up"
                Eventually(ctx, valjean.Notifications).Should(ContainElement(notification))

                Expect(valjean.Checkout(ctx, library, "Les Miserables")).To(Succeed())
                Expect(valjean.Books(ctx)).To(ContainElement(book))
                Expect(valjean.Holds(ctx)).To(BeEmpty())
            }, SpecTimeout(time.Second * 10))
        })  
    })

    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(err).To(MatchError("Les Miserables is not in the library catalog"))
        }, SpecTimeout(time.Second * 5))
    })
})

Jump to the docs to learn more. It's easy to bootstrap and start writing your first specs.

If you have a question, comment, bug report, feature request, etc. please open a GitHub issue, or visit the Ginkgo Slack channel.

Capabilities

Whether writing basic unit specs, complex integration specs, or even performance specs - Ginkgo gives you an expressive Domain-Specific Language (DSL) that will be familiar to users coming from frameworks such as Quick, RSpec, Jasmine, and Busted. This style of testing is sometimes referred to as "Behavior-Driven Development" (BDD) though Ginkgo's utility extends beyond acceptance-level testing.

With Ginkgo's DSL you can use nestable Describe, Context and When container nodes to help you organize your specs. BeforeEach and AfterEach setup nodes for setup and cleanup. It and Specify subject nodes that hold your assertions. BeforeSuite and AfterSuite nodes to prep for and cleanup after a suite... and much more!.

At runtime, Ginkgo can run your specs in reproducibly random order and has sophisticated support for spec parallelization. In fact, running specs in parallel is as easy as

ginkgo -p

By following established patterns for writing parallel specs you can build even large, complex integration suites that parallelize cleanly and run performantly. And you don't have to worry about your spec suite hanging or leaving a mess behind - Ginkgo provides a per-node context.Context and the capability to interrupt the spec after a set period of time - and then clean up.

As your suites grow Ginkgo helps you keep your specs organized with labels and lets you easily run subsets of specs, either programmatically or on the command line. And Ginkgo's reporting infrastructure generates machine-readable output in a variety of formats and allows you to build your own custom reporting infrastructure.

Ginkgo ships with ginkgo, a command line tool with support for generating, running, filtering, and profiling Ginkgo suites. You can even have Ginkgo automatically run your specs when it detects a change with ginkgo watch, enabling rapid feedback loops during test-driven development.

And that's just Ginkgo! Gomega brings a rich, mature, family of assertions and matchers to your suites. With Gomega you can easily mix synchronous and asynchronous assertions in your specs. You can even build your own set of expressive domain-specific matchers quickly and easily by composing Gomega's existing building blocks.

Happy Testing!

License

Ginkgo is MIT-Licensed

Contributing

See CONTRIBUTING.md