databricks-sdk-go icon indicating copy to clipboard operation
databricks-sdk-go copied to clipboard

[ISSUE] `workspaceClient.Users.ListAll` hangs if no `StartIndex` & `TotalResults` are returned

Open alexott opened this issue 1 year ago • 1 comments

Observed in 0.26.1 that if I'm using the following fixture in test:

	userListIdUsernameFixture = qa.HTTPFixture{
		Method:   "GET",
		Resource: "/api/2.0/preview/scim/v2/Users?attributes=id%2CuserName&count=100&startIndex=1",
		Response: iam.ListUsersResponse{
			Resources: []iam.User{
				{
					Id:       "id",
					UserName: "[email protected]",
				},
			},
		},
		ReuseRequest: true,
	}

then workspaceClient.Users.ListAll hangs

It was found in the context of https://github.com/databricks/terraform-provider-databricks/pull/2980

alexott avatar Dec 09 '23 14:12 alexott

FYI: in the TF repo, I added https://github.com/databricks/terraform-provider-databricks/blob/master/qa/scim_fixtures.go to help set up fixtures more easily for TF.

Separately, in https://github.com/databricks/databricks-sdk-go/commit/b3cdc973d681e848158d2712a0dd18f3933f2e6c, we added support for higher-level mocking of the WorkspaceClient. Now you can just mock the SDK calls rather than the underlying requests on the network, which should make testing with the WorkspaceClient easier.

mgyucht avatar Jan 08 '24 14:01 mgyucht