okta / okta-sdk-golang

A Golang SDK for interacting with the Okta management API, enabling server-side code to manage Okta users, groups, applications, and more.
https://github.com/okta/okta-sdk-golang
Other
175 stars 143 forks source link

client.Group.ListAssignedApplicationsForGroup returns an application properly, but gives error for nonexistent index #292

Closed pputman12 closed 2 years ago

pputman12 commented 2 years ago

Describe the bug?

image

When trying to call ListAssignedApplicationsForGroup, I get an error:

image

I'm writing a test that creates an okta group and app, with a rule that should assign them, so I'm testing if it exists, and it does when printing it out:

image

I've isolated the problem down to ListAssignedApplicationsForGroup but not sure why its complaining about index out of range.

What is expected to happen?

its expected to just run the test successfully, since the application exists and is assigned to the group

What is the actual behavior?

It does pull down the application, and I can see it searches for it and finds it, but I get an error saying index out of range

Reproduction Steps?

Try to call this method with these parameters:

ctx, client, err := oktaTest.NewConnection( oktaCon.testOrg, oktaCon.testUrl, oktaCon.testApiToken, ) if err != nil { fmt.Printf("Could not connect to okta %v", err) }

oktaGroupApps, _, err := client.Group.ListAssignedApplicationsForGroup(ctx, groupId, nil)

oktaGroupApps will have the proper application, but it will still error out at the end. It panics and recovers somehow?

Additional Information?

No response

Golang Version

1.18 and 1.18.1

SDK Version

latest

OS version

Darwin Patricks-MacBook-Pro.local 21.4.0 Darwin Kernel Version 21.4.0: Fri Mar 18 00:46:32 PDT 2022; root:xnu-8020.101.4~15/RELEASE_ARM64_T6000 arm64

monde commented 2 years ago

@pputman12 thanks for giving me a head start into debugging this. I will look into it.

monde commented 2 years ago

Just checking @pputman12, did you close this ticket inadvertently? I'm going to write some code to see if I can repo this in my dev env.

pputman12 commented 2 years ago

I didn't close it inadvertently it was intentionally, I was mistaken about the problem.

On Wed, Apr 20, 2022 at 12:22 PM Mike Mondragon @.***> wrote:

Just checking @pputman12 https://github.com/pputman12, did you close this ticket inadvertently? I'm going to write some code to see if I can repo this in my dev env.

— Reply to this email directly, view it on GitHub https://github.com/okta/okta-sdk-golang/issues/292#issuecomment-1104211510, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGNEWVK7YMG4WWQACVPG6DVGA4ONANCNFSM5T2WYGXA . You are receiving this because you were mentioned.Message ID: @.***>

monde commented 2 years ago

ok, no problem! I have new integration test to add to the next release 😄

pputman12 commented 2 years ago

I was mistaken because I made a new integration test for something I'm doing in okta, and it caused this error. But the problem wasn't with this module, somehow when I run this new test, it triggers an error with an empty slice returning from a similar method in a different test. If I run each test separately, I can't reproduce it, but can reproduce it every time if I run each test together, I'll write up something on it, but my initial report was confusing me as it came from a similar method in another test but only happened after I made the new test.

On Wed, Apr 20, 2022 at 12:49 PM Mike Mondragon @.***> wrote:

ok, no problem! I have new integration test to add to the next release 😄

— Reply to this email directly, view it on GitHub https://github.com/okta/okta-sdk-golang/issues/292#issuecomment-1104240737, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGNEWWVYVNEKVPOPVUK4KDVGA7RPANCNFSM5T2WYGXA . You are receiving this because you were mentioned.Message ID: @.***>