Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: allow running fake idp with coderd dev#11555

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 6 commits intomainfromstevenmasley/fake_idp_service
Jan 11, 2024

Conversation

Emyrk
Copy link
Member

@EmyrkEmyrk commentedJan 10, 2024
edited
Loading

This could be made more ergonomic, but this is a good start.

Essentially as I debug this oauth stuff, theoidctest stuff has been excellent for testing, and I think it would be valuable to also be able to manually test the UI with it. For example this:#11554 hangs indefinitely on the UI. I got this accidentally from github, but it would be nice to manually invoke this.

Maybe the e2e tests could use this too? idk.

Screenshot from 2024-01-10 10-49-57

Example

Run this file

$ go run main.go                                                                                                                                   2024-01-10 16:48:01.415 [info]  stdlib: 2024/01/10 10:48:01 IDP Issuer URL http://127.0.0.1:445172024-01-10 16:48:01.415 [info]  stdlib: 2024/01/10 10:48:01 Oauth Flags2024-01-10 16:48:01.415 [info]  stdlib: 2024/01/10 10:48:01 --external-auth-providers='[{"type":"fake","client_id":"f2df566b-a1c9-407a-8b75-480db45c6476","client_secret":"55aca4e3-7b94-44b6-9f45-ecb5e81c560d","auth_url":"http://127.0.0.1:44517/oauth2/authorize","token_url":"http://127.0.0.1:44517/oauth2/token","validate_url":"http://127.0.0.1:44517/oauth2/userinfo","scopes":["openid","email","profile"]}]'2024-01-10 16:48:01.415 [info]  stdlib: 2024/01/10 10:48:01 Press Ctrl+C toexit

Then copy that flag todevelop.sh

develop.sh -- --external-auth-providers='[{"type":"fake","client_id":"f2df566b-a1c9-407a-8b75-480db45c6476","client_secret":"55aca4e3-7b94-44b6-9f45-ecb5e81c560d","auth_url":"http://127.0.0.1:44517/oauth2/authorize","token_url":"http://127.0.0.1:44517/oauth2/token","validate_url":"http://127.0.0.1:44517/oauth2/userinfo","scopes":["openid","email","profile"]}]'

Flag parsing

I fixed that awhile ago here:#11268

Copy link
Member

@mafredrimafredri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Cool!

@@ -0,0 +1,58 @@
package main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This could be moved tocmd/testidp. I think it would be confusing to have packages that can be built sprinkled within the source tree.

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Good call 👍

Name: "Run Fake IDP",
F: RunIDP(),
},
}, nil, nil)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

This feels weird, but I understand you did it to use theoidctest package 😄, it's also possible to build a test package, typically I'd suggest to implement this that way, but it wouldn't be as easily discoverable as this is (esp. if put incmd/).

Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I felt werid sayingrun go test -run="TestRealIDP" or something.

Another idea I had was to just implement thetesting.TB struct myself and just throw log messages on the Fails(). It's not as trivial as I'd hope though, they have this:https://github.com/golang/go/blob/master/src/testing/testing.go#L899-L902

So I'd have to embed an actual testing.T struct? It just also has it's "jankiness", so just went with this for now.

@EmyrkEmyrkenabled auto-merge (squash)January 11, 2024 18:00
@EmyrkEmyrk merged commite3ad958 intomainJan 11, 2024
@EmyrkEmyrk deleted the stevenmasley/fake_idp_service branchJanuary 11, 2024 18:10
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsJan 11, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@mafredrimafredrimafredri approved these changes

Assignees

@EmyrkEmyrk

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@Emyrk@mafredri

[8]ページ先頭

©2009-2025 Movatter.jp