Skip to content

ServiceInvocationsCount() fails when no invocations has been made yet #99

@lbroudoux

Description

@lbroudoux

Describe the bug

When calling microcksContainer.ServiceInvocationsCount(ctx, "API Pastries", "0.0.1") when no prior invocations has been made, this raise an exception:

panic: runtime error: invalid memory address or nil pointer dereference [recovered]
        panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x1043ac474]

goroutine 35 [running]:
testing.tRunner.func1.2({0x1044d0920, 0x1047dccb0})
        /Users/laurent/Development/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.1.darwin-arm64/src/testing/testing.go:1631 +0x1c4
testing.tRunner.func1()
        /Users/laurent/Development/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.1.darwin-arm64/src/testing/testing.go:1634 +0x33c
panic({0x1044d0920?, 0x1047dccb0?})
        /Users/laurent/Development/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.22.1.darwin-arm64/src/runtime/panic.go:770 +0x124
microcks.io/testcontainers-go.(*MicrocksContainer).ServiceInvocationsCountAtDate(0x14000597ea8?, {0x10456fff0, 0x10488ad20}, {0x1043b24de, 0xc}, {0x1043afb81, 0x5}, {0x14000114a50?, 0x1044adcc0?, 0x104823740?})
        /Users/laurent/Development/go/pkg/mod/microcks.io/testcontainers-go@v0.3.0/microcks.go:391 +0x1d4
microcks.io/testcontainers-go.(*MicrocksContainer).ServiceInvocationsCount(0x140004c8750, {0x10456fff0, 0x10488ad20}, {0x1043b24de, 0xc}, {0x1043afb81, 0x5})
        /Users/laurent/Development/go/pkg/mod/microcks.io/testcontainers-go@v0.3.0/microcks.go:366 +0x64
github.com/microcks/microcks-testcontainers-go-demo/internal/client_test.TestListPastries(0x1400012cb60)
        /Users/laurent/Development/github/microcks-testcontainers-go-demo/internal/client/pastry_api_test.go:82 +0xd4

Expected behavior

It should return 0

Actual behavior

See description.

How to Reproduce?

No response

Microcks version or git rev

No response

Install method (docker-compose, helm chart, operator, docker-desktop extension,...)

No response

Additional information

No response

Metadata

Metadata

Assignees

Labels

component/runtimeRuntime behavior of test containerkind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions