Questions tagged [ginkgo]

Ginkgo is a BDD-style Golang testing framework built to help you efficiently write expressive and comprehensive tests.

About

Ginkgo is a BDD-style Golang testing framework built to help you efficiently write expressive and comprehensive tests. It is best paired with the Gomega matcher library but is designed to be matcher-agnostic.

Links

67 questions
2
votes
1 answer

How to test for infinite loop/recursion with ginkgo/gomega?

I have a golang function which recursively steps through a json string and replaces custom references with the json document they are referencing. I just noticed that I forgot to handle cyclic references, whose occurrence will lead to endless…
DonGiovanni
  • 891
  • 1
  • 7
  • 15
2
votes
1 answer

Can I Iterate the tests for ginkgo

Is it possible to have a variable number of test cases. Let's say I have a BeforeSuite function which calculates the values in the array. Then based on the length of the array, I want to run one test per array element. var _ = Describe("Outer",…
2
votes
2 answers

Can Gomega's Equal() handle multiple values ?

I am testing a function to send a mock request to a server using gomega and I want to verify that 1. the request has started 2. the request has completed. For this I am returning two booleans. They should both evaluate to true in the example below…
user2969402
  • 1,221
  • 3
  • 16
  • 26
2
votes
2 answers

How to send custom signal to kill running process with Goland?

When I run/debug Ginkgo test from Intellij Idea (with Go plugin installed), it does not shut down gracefully if I press "Stop" button. JustBeforeEach and AfterEach functions do not get executed and process stops immediately. When I run test from…
Kirill
  • 6,762
  • 4
  • 51
  • 81
2
votes
1 answer

How to do unit testing of HTTP requests using Ginkgo?

i have just started learning to write unit tests for the http requests, i went through several blogs but i didn't understood how to write tests for this using Ginkgo. func getVolDetails(volName string, obj interface{}) error { addr :=…
2
votes
2 answers

Ginkgo does not provide coverage in Travis CI

I have a GO project which I build in Travis CI. I have implemented a few tests with Ginkgo, and I am getting code coverage when I run it locally, however I get no coverage when I run it on Travis. My .travis.yml language: go # safelist branches: …
morras
  • 1,102
  • 9
  • 24
2
votes
1 answer

Testing two strings with ginkgo trouble

First of all I want to tell you that I’m very new at go and that I came from Python. Having saying that than I can continue with my problem. I’m having the following…
cacciald
  • 23
  • 4
1
vote
1 answer

How to write a unit test to mock clientset for a http call to return all nodes in a kubernetes cluster

I am currently working on getting familiar with Ginkgo testing framework to write unit tests for api calls and just plain functions. Having trouble wrapping my head around mocking things. Right now I have a GET call that returns a list of the nodes…
Tom
  • 21
  • 3
1
vote
0 answers

How to recover argument sent to mock with Ginkgo

I am working with /onsi/ginkgo/v2 v2.1.4 and /golang/mock v1.6.0 in Golang v1.19.2 And I want to retrieve the argument that was sent to the mock's InsertOneProspecto function. ctrl = gomock.NewController(GinkgoT()) mockDB =…
Kaltresian
  • 961
  • 3
  • 14
  • 32
1
vote
0 answers

Ginkgo binaries not seen in Mac directories

I have installed ginkgo, but I cannot locate it inside the /Users/user-name/gowork/src/github.com/onsi folder. If I delete the gowork folder, I can see the ginkgo folders within it, in Trash. ginkgo version returns: bash:…
fa-tester
  • 11
  • 2
1
vote
0 answers

How to run before all suites in ginkgo?

I'm integrating mock server to out tests. As part of it I need to clear all the request that was caught by mock server. Due to restrictions of the service we use, I can do it only once for all the endpoints. So I need to do it at the very begging…
ogbofjnr
  • 1,688
  • 5
  • 19
  • 41
1
vote
1 answer

golang ginkgo test coverage across packages

I have the following file structure: ❯ tree . ├── go.mod ├── go.sum ├── Makefile ├── p1 │ └── p1.go └── tests └── integration └── integration_suite_test.go 3 directories, 5 files Where, the p1/p1.go has a function: ❯ cat…
Sankar
  • 6,192
  • 12
  • 65
  • 89
1
vote
1 answer

How to pass my Docker credential before/while running e2e tests on Kubernetes

I am trying to run e2e tests on Kubernetes cluster but while running Pods are pulled from docker and the docker is using default username present in the git-hub and the limit is exceeding. I need to pass my docker user credential while running e2e…
1
vote
1 answer

How to run tests in a specific order with ginkgo?

I use ginkgo to write some tests, including: books_suite_test.go install_test.go reading_test.go isbn_test.go uninstall_test.go how to run these tests in a specific order as following: install_test.go -> reading_test.go -> isbn_test.go ->…
LEo
  • 442
  • 5
  • 21
1
vote
0 answers

I have problem witch compilation android linux kernel

I have a problem with a compilation of Android Linux kernel ./include/trace/events/sched.h:269:2: error: #error "Unsupported NR_CPUS for lb tracepoint." 269 | #error "Unsupported NR_CPUS for lb tracepoint." | ^~~~~ make[1]: ***…