Skip to content

Refreshing cache doesn't work #379

@yc185050

Description

@yc185050

Describe the bug?

According to https://github.com/okta/okta-sdk-golang#refreshing-cache-for-specific-call, client.CloneRequestExecutor().RefreshNext() can be used to force refreshing the cache on next call.
However, based on testing, it doesn't work.
See code snippet below

What is expected to happen?

func main() {
	ctx, client, err := getOktaClient()
	if err != nil {
		return
	}
	// create an app
	basicApplication := okta.NewBasicAuthApplication()
	basicApplication.Settings = &okta.BasicApplicationSettings{
		App: &okta.BasicApplicationSettingsApplication{
			AuthURL: "https://example.com/auth.html",
			Url:     "https://example.com/auth.html",
		},
	}

	myapp, _, err := client.Application.CreateApplication(ctx, basicApplication, nil)
	if err != nil {
		return
	}
	appId := myapp.(*okta.BasicAuthApplication).Id
        // list app
	appList, _, _ := client.Application.ListApplications(ctx, nil)
	fmt.Printf("applist length before delete: %d\n", len(appList))
        // deactivate and delete
	_, err = client.Application.DeactivateApplication(ctx, appId)
	if err != nil {
		return
	}
	_, err = client.Application.DeleteApplication(ctx, appId)
	if err != nil {
		return
	}
	// refresh cache
	client.CloneRequestExecutor().RefreshNext()
        // list app again
	appList, _, _ = client.Application.ListApplications(ctx, nil)
	fmt.Printf("applist length after delete: %d\n", len(appList))
}

expected output:

applist length before delete: 8
applist length after delete: 7

What is the actual behavior?

actual output

applist length before delete: 8
applist length after delete: 8

Reproduction Steps?

see above

Additional Information?

No response

Golang Version

go version go1.18.8 darwin/amd64

SDK Version

github.com/okta/okta-sdk-golang/v2 v2.18.0

OS version

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions