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

Error when running Integration tests on client.Group.ListGroupUsers #293

Open
pputman12 opened this issue Apr 20, 2022 · 9 comments
Open
Labels
bug Something isn't working no-stalebot

Comments

@pputman12
Copy link

Describe the bug?

This is hard to describe and its very confusing. I have two integration tests I'm writing for Terraform with Okta. The bug happens with this code:
image
This code is my workaround, to keep retrying to run client.Group.ListGroupUsers if it returns an empty slice. This is part one okta test I have that verifies a group has the necessary users. If I run this test separately, it works fine. I then created a new test in a different go file, that has this code, and if I run go test on the entire directory, I will have a problem with the above method (ListGroupUsers) returning an empty slice, until I keep retrying and it finally returns the Users slice.

In my second test I've narrowed it down to this method:

image

So if I run this second test, with ListAssignedApplicationsForGroup by running go test on the directory, the ListGroupUsers returns null until my work around has it kee retrying (for like 2 minutes it takes) to get it. Kinda weird.

image

Here's my workaround priting the array and length until it isn't empty for testing (and sleeping 10 seconds between)

image

So once again I'm not sure how having another integration test calling a completey different method is somehow breaking the api call in the first integration test. So confused I didn't even really want to write this up as I don't even know how to properly articulate/prove it.

What is expected to happen?

Test should run and pass,

What is the actual behavior?

If one test exists, its fine, however introducing a second test that calls a separate method somehow causes the first test to fail because of an empty slice, unless I implement a workaround that keeps trying

Reproduction Steps?

Maybe see if there's an issue with calling multiple methods listed Group.ListAssignedApplicationsForGroup(ctx, appId, nil) and then Group.ListGroupUsers(ctx, groupId, nil) to see if there's an issue?

Additional Information?

I checked okta's rate limit and didn't see anything in the logs. No errors, just an empty slice returning only in this one condition.

Golang Version

1.18 and 1.18.1

SDK Version

latest

OS version

No response

@pputman12 pputman12 added the bug Something isn't working label Apr 20, 2022
@monde
Copy link
Collaborator

monde commented Apr 20, 2022

@pputman12 try setting up your okta client with query caching disabled and tell me what you find:

  ctx, client, err := okta.NewClient(
    context.TODO(),
    okta.WithCache(false),
    okta.WithOrgUrl("https://{yourOktaDomain}"),
    okta.WithToken("{apiToken}"),
  )

@monde
Copy link
Collaborator

monde commented Apr 20, 2022

fwiw, here is the ListAssignedApplications integration test I added after the #292 discussion #294

@pputman12
Copy link
Author

setting up false with caching worked, thank you so much, I was genuinely confused.

@monde
Copy link
Collaborator

monde commented Apr 21, 2022

setting up false with caching worked, thank you so much, I was genuinely confused.

Same for me. Our Okta Terraform Provider runs okta-sdk-golang w/o query caching so I get used to that and forgot about the query caching fighting that PR I referenced.

@monde monde closed this as completed Apr 21, 2022
@pputman12
Copy link
Author

pputman12 commented Apr 21, 2022 via email

@pputman12
Copy link
Author

pputman12 commented Apr 22, 2022 via email

@pputman12
Copy link
Author

@monde can we reopen this? I'm still seeing the problem, its just intermittent.

@monde
Copy link
Collaborator

monde commented May 6, 2022

"While I thought this was fixed, its because its intermittent. testing several more times with query caching disabled, and still receiving the same issue."

@github-actions
Copy link

This issue has been marked stale because there has been no activity within the last 14 days. To keep this issue active, remove the stale label.

@github-actions github-actions bot added the stale label May 21, 2022
@monde monde added no-stalebot and removed stale labels Jun 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working no-stalebot
Projects
None yet
Development

No branches or pull requests

2 participants