Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Corrects ability to disable all blocking from the CLI by not providing any groups #1373

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion api/api_interface_impl.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 103,7 @@ func (i *OpenAPIInterfaceImpl) DisableBlocking(ctx context.Context,
}
}

if request.Params.Groups != nil {
if request.Params.Groups != nil && len(*request.Params.Groups) > 0 {
groups = strings.Split(*request.Params.Groups, ",")
}

Expand Down
17 changes: 17 additions & 0 deletions api/api_interface_impl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 218,23 @@ var _ = Describe("API implementation tests", func() {

Describe("Control blocking status via API", func() {
When("Disable blocking is called", func() {
It("should return a success when receiving no groups", func() {
var emptySlice []string
blockingControlMock.On("DisableBlocking", 3*time.Second, emptySlice).Return(nil)
duration := "3s"
grroups := ""

resp, err := sut.DisableBlocking(ctx, DisableBlockingRequestObject{
Params: DisableBlockingParams{
Duration: &duration,
Groups: &grroups,
},
})
Expect(err).Should(Succeed())
var resp200 DisableBlocking200Response
Expect(resp).Should(BeAssignableToTypeOf(resp200))
})

It("should return 200 on success", func() {
blockingControlMock.On("DisableBlocking", 3*time.Second, []string{"gr1", "gr2"}).Return(nil)
duration := "3s"
Expand Down
Loading