-
Notifications
You must be signed in to change notification settings - Fork 2
feat: make ECR login TUI-first and document the TUI-first product rule #256
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| package app | ||
|
|
||
| import ( | ||
| "strings" | ||
| "testing" | ||
|
|
||
| tea "github.com/charmbracelet/bubbletea" | ||
|
|
||
| "unic/internal/config" | ||
| ) | ||
|
|
||
| func TestECRLoginResolvedMsgOpensHelperScreen(t *testing.T) { | ||
| m := Model{ | ||
| cfg: &config.Config{Region: "ap-northeast-2"}, | ||
| screen: screenLoading, | ||
| } | ||
|
|
||
| msg := ecrLoginResolvedMsg{ | ||
| registryURI: "123456789012.dkr.ecr.ap-northeast-2.amazonaws.com", | ||
| dockerCommand: "aws ecr get-login-password --region ap-northeast-2 | docker login ...", | ||
| podmanCommand: "aws ecr get-login-password --region ap-northeast-2 | podman login ...", | ||
| } | ||
| _, _, handled := m.ecr.HandleMessage(&m, msg) | ||
| if !handled { | ||
| t.Fatal("expected login-resolved message to be handled") | ||
| } | ||
| if m.screen != screenECRLoginHelper { | ||
| t.Fatalf("expected login helper screen, got %v", m.screen) | ||
| } | ||
|
|
||
| view, ok := m.ecr.View(m) | ||
| if !ok { | ||
| t.Fatal("expected login helper view to render") | ||
| } | ||
| for _, want := range []string{"ECR Login Helper", msg.registryURI, "docker login", "podman login"} { | ||
| if !strings.Contains(view, want) { | ||
| t.Fatalf("expected view to contain %q, got:\n%s", want, view) | ||
| } | ||
| } | ||
| } | ||
|
|
||
| func TestECRLoginHelperEscReturnsToFeatureList(t *testing.T) { | ||
| m := Model{ | ||
| cfg: &config.Config{Region: "ap-northeast-2"}, | ||
| screen: screenECRLoginHelper, | ||
| } | ||
| m.ecr.copyMsg = "stale" | ||
|
|
||
| _, _, handled := m.ecr.HandleKey(&m, tea.KeyMsg{Type: tea.KeyEsc}) | ||
| if !handled { | ||
| t.Fatal("expected key to be handled on the login helper screen") | ||
| } | ||
| if m.screen != screenFeatureList { | ||
| t.Fatalf("expected feature list screen, got %v", m.screen) | ||
| } | ||
| if m.ecr.copyMsg != "" { | ||
| t.Fatalf("expected copy message to be cleared, got %q", m.ecr.copyMsg) | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P1] registry URI는
m.cfg의 unic context 자격증명으로 해석하지만, 생성되는 명령은 plainaws ecr get-login-password --region ...라서 실행 시 shell의 ambient AWS profile/credentials를 사용합니다. SSO/assume_role/okta_saml context에서는 다른 계정에 로그인하거나 인증 실패할 수 있어 ‘active context login’ 보장이 깨집니다. 복사 명령이 unic context의 exports를 적용하도록 만들거나, 더 단순하게 unic 자체가 ECR authorization token을 받아 login을 실행하는 흐름이 필요합니다.