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

Show webhook error on UI #800

Merged
merged 3 commits into from
Aug 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions internal/cmd/__snapshots__/netrule_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ SnapShot = 'validation error: --port is required'

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user user1 --workspace ws1 --port 124000 1']
SnapShot = """
Error: failed to upsert network rule: admission webhook \"vworkspace.kb.io\" denied the request: network rules check failed: port validation failed: port=124000: admission webhook \"vworkspace.kb.io\" denied the request: network rules check failed: port validation failed: port=124000
Error: failed to upsert network rule: admission webhook \"vworkspace.kb.io\" denied the request: network rules check failed: port validation failed: port=124000
Usage:
cosmoctl networkrule create NETWORK_RULE_NAME --workspace WORKSPACE_NAME --port PORT_NUMBER [flags]

Expand All @@ -426,7 +426,7 @@ Global Flags:
"""

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user user1 --workspace ws1 --port 124000 2']
SnapShot = 'failed to upsert network rule: admission webhook "vworkspace.kb.io" denied the request: network rules check failed: port validation failed: port=124000: admission webhook "vworkspace.kb.io" denied the request: network rules check failed: port validation failed: port=124000'
SnapShot = 'failed to upsert network rule: admission webhook "vworkspace.kb.io" denied the request: network rules check failed: port validation failed: port=124000'

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user user1 --workspace ws1 --port 4000 --host-prefix main 1']
SnapShot = """
Expand Down Expand Up @@ -534,7 +534,7 @@ SnapShot = """

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user user1 --workspace xxx --port 4000 1']
SnapShot = """
Error: failed to get workspace: workspace is not found
Error: failed to get workspace: failed to get workspace: workspaces.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl networkrule create NETWORK_RULE_NAME --workspace WORKSPACE_NAME --port PORT_NUMBER [flags]

Expand All @@ -559,11 +559,11 @@ Global Flags:
"""

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user user1 --workspace xxx --port 4000 2']
SnapShot = 'failed to get workspace: workspace is not found'
SnapShot = 'failed to get workspace: failed to get workspace: workspaces.cosmo-workspace.github.io "xxx" not found'

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user xxx --workspace ws1 --port 4000 1']
SnapShot = """
Error: failed to get workspace: user is not found
Error: failed to get workspace: failed to get user: users.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl networkrule create NETWORK_RULE_NAME --workspace WORKSPACE_NAME --port PORT_NUMBER [flags]

Expand All @@ -588,7 +588,7 @@ Global Flags:
"""

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create --user xxx --workspace ws1 --port 4000 2']
SnapShot = 'failed to get workspace: user is not found'
SnapShot = 'failed to get workspace: failed to get user: users.cosmo-workspace.github.io "xxx" not found'

['cosmoctl [netrule] [create] ❌ fail with invalid args: netrule create 1']
SnapShot = """
Expand Down Expand Up @@ -804,7 +804,7 @@ SnapShot = 'index out of range'

['cosmoctl [netrule] [delete] ❌ fail with invalid args: netrule delete --user user1 --workspace xxx --index 1 1']
SnapShot = """
Error: workspace is not found: workspaces.cosmo-workspace.github.io \"xxx\" not found
Error: failed to get workspace: workspaces.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl networkrule delete NETWORK_RULE_NAME --workspace WORKSPACE_NAME [flags]

Expand All @@ -826,11 +826,11 @@ Global Flags:
"""

['cosmoctl [netrule] [delete] ❌ fail with invalid args: netrule delete --user user1 --workspace xxx --index 1 2']
SnapShot = 'workspace is not found: workspaces.cosmo-workspace.github.io "xxx" not found'
SnapShot = 'failed to get workspace: workspaces.cosmo-workspace.github.io "xxx" not found'

['cosmoctl [netrule] [delete] ❌ fail with invalid args: netrule delete --user xxx --workspace ws1 --index 1 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"xxx\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl networkrule delete NETWORK_RULE_NAME --workspace WORKSPACE_NAME [flags]

Expand All @@ -852,4 +852,4 @@ Global Flags:
"""

['cosmoctl [netrule] [delete] ❌ fail with invalid args: netrule delete --user xxx --workspace ws1 --index 1 2']
SnapShot = 'user is not found: users.cosmo-workspace.github.io "xxx" not found'
SnapShot = 'failed to get user: users.cosmo-workspace.github.io "xxx" not found'
8 changes: 4 additions & 4 deletions internal/cmd/__snapshots__/user_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ SnapShot = 'validation error: invalid args'

['cosmoctl [user] [delete] ❌ fail with invalid args: user delete XXXXX 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"XXXXX\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"XXXXX\" not found
Usage:
cosmoctl user delete USER_NAME [flags]

Expand All @@ -804,7 +804,7 @@ Global Flags:
"""

['cosmoctl [user] [delete] ❌ fail with invalid args: user delete XXXXX 2']
SnapShot = 'user is not found: users.cosmo-workspace.github.io "XXXXX" not found'
SnapShot = 'failed to get user: users.cosmo-workspace.github.io "XXXXX" not found'

['cosmoctl [user] [get] ✅ success in normal context: user get --filter role=*-admin --filter role=myteam-* 1']
SnapShot = """
Expand Down Expand Up @@ -973,7 +973,7 @@ SnapShot = 'validation error: invalid args'

['cosmoctl [user] [reset-password] ❌ fail with invalid args: user reset-password XXXXXX 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"XXXXXX\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"XXXXXX\" not found
Usage:
cosmoctl user reset-password USER_NAME [flags]

Expand All @@ -989,7 +989,7 @@ Global Flags:
"""

['cosmoctl [user] [reset-password] ❌ fail with invalid args: user reset-password XXXXXX 2']
SnapShot = 'user is not found: users.cosmo-workspace.github.io "XXXXXX" not found'
SnapShot = 'failed to get user: users.cosmo-workspace.github.io "XXXXXX" not found'

['cosmoctl [user] [reset-password] ❌ fail with invalid args: user reset-password user1 --password 1']
SnapShot = """
Expand Down
28 changes: 14 additions & 14 deletions internal/cmd/__snapshots__/workspace_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ Global Flags:

['cosmoctl [workspace] [create] ❌ fail with invalid args: workspace create ws1 --user xxxxx --template template1 --dry-run 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"xxxxx\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"xxxxx\" not found
Usage:
cosmoctl workspace create WORKSPACE_NAME --template TEMPLATE_NAME [flags]

Expand All @@ -330,7 +330,7 @@ Global Flags:

['cosmoctl [workspace] [create] ❌ fail with invalid args: workspace create ws1 --user xxxxx --template template1 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"xxxxx\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"xxxxx\" not found
Usage:
cosmoctl workspace create WORKSPACE_NAME --template TEMPLATE_NAME [flags]

Expand Down Expand Up @@ -538,7 +538,7 @@ unknown shorthand flag: 'A' in -A"""

['cosmoctl [workspace] [delete] ❌ fail with invalid args: workspace delete ws1 --user user1 xxx 1']
SnapShot = """
Error: workspace is not found: workspaces.cosmo-workspace.github.io \"ws1\" not found
Error: failed to get workspace: workspaces.cosmo-workspace.github.io \"ws1\" not found
Usage:
cosmoctl workspace delete WORKSPACE_NAME [flags]

Expand All @@ -559,7 +559,7 @@ Global Flags:
"""

['cosmoctl [workspace] [delete] ❌ fail with invalid args: workspace delete ws1 --user user1 xxx 2']
SnapShot = 'workspace is not found: workspaces.cosmo-workspace.github.io "ws1" not found'
SnapShot = 'failed to get workspace: workspaces.cosmo-workspace.github.io "ws1" not found'

['cosmoctl [workspace] [delete] ❌ fail with invalid args: workspace delete xxxx --user user1 -A 1']
SnapShot = """
Expand Down Expand Up @@ -751,7 +751,7 @@ Global Flags:

['cosmoctl [workspace] [get] ❌ fail with invalid args: workspace get --user user1 xxx 1']
SnapShot = """
Error: workspace is not found: workspaces.cosmo-workspace.github.io \"xxx\" not found
Error: failed to get workspace: workspaces.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl workspace get [WORKSPACE_NAME] [flags]

Expand All @@ -771,7 +771,7 @@ Global Flags:

['cosmoctl [workspace] [get] ❌ fail with invalid args: workspace get --user xxxx 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"xxxx\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"xxxx\" not found
Usage:
cosmoctl workspace get [WORKSPACE_NAME] [flags]

Expand Down Expand Up @@ -972,7 +972,7 @@ unknown shorthand flag: 'A' in -A"""

['cosmoctl [workspace] [run-instance] ❌ fail with invalid args: workspace run-instance ws1 --user xxxxx 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"xxxxx\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"xxxxx\" not found
Usage:
cosmoctl workspace run-instance WORKSPACE_NAME [flags]

Expand All @@ -992,7 +992,7 @@ Global Flags:
"""

['cosmoctl [workspace] [run-instance] ❌ fail with invalid args: workspace run-instance ws1 --user xxxxx 2']
SnapShot = 'user is not found: users.cosmo-workspace.github.io "xxxxx" not found'
SnapShot = 'failed to get user: users.cosmo-workspace.github.io "xxxxx" not found'

['cosmoctl [workspace] [run-instance] ❌ fail with invalid args: workspace run-instance ws2 --user user1 1']
SnapShot = """
Expand Down Expand Up @@ -1020,7 +1020,7 @@ SnapShot = 'no change'

['cosmoctl [workspace] [run-instance] ❌ fail with invalid args: workspace run-instance xxx --user user1 1']
SnapShot = """
Error: workspace is not found: workspaces.cosmo-workspace.github.io \"xxx\" not found
Error: failed to get workspace: workspaces.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl workspace run-instance WORKSPACE_NAME [flags]

Expand All @@ -1040,7 +1040,7 @@ Global Flags:
"""

['cosmoctl [workspace] [run-instance] ❌ fail with invalid args: workspace run-instance xxx --user user1 2']
SnapShot = 'workspace is not found: workspaces.cosmo-workspace.github.io "xxx" not found'
SnapShot = 'failed to get workspace: workspaces.cosmo-workspace.github.io "xxx" not found'

['cosmoctl [workspace] [stop-instance] ✅ success in normal context: workspace stop-instance ws1 --user user1 1']
SnapShot = """
Expand Down Expand Up @@ -1205,7 +1205,7 @@ unknown shorthand flag: 'A' in -A"""

['cosmoctl [workspace] [stop-instance] ❌ fail with invalid args: workspace stop-instance ws1 --user xxxxx 1']
SnapShot = """
Error: user is not found: users.cosmo-workspace.github.io \"xxxxx\" not found
Error: failed to get user: users.cosmo-workspace.github.io \"xxxxx\" not found
Usage:
cosmoctl workspace stop-instance WORKSPACE_NAME [flags]

Expand All @@ -1225,7 +1225,7 @@ Global Flags:
"""

['cosmoctl [workspace] [stop-instance] ❌ fail with invalid args: workspace stop-instance ws1 --user xxxxx 2']
SnapShot = 'user is not found: users.cosmo-workspace.github.io "xxxxx" not found'
SnapShot = 'failed to get user: users.cosmo-workspace.github.io "xxxxx" not found'

['cosmoctl [workspace] [stop-instance] ❌ fail with invalid args: workspace stop-instance ws2 --user user1 1']
SnapShot = """
Expand Down Expand Up @@ -1253,7 +1253,7 @@ SnapShot = 'no change'

['cosmoctl [workspace] [stop-instance] ❌ fail with invalid args: workspace stop-instance xxx --user user1 1']
SnapShot = """
Error: workspace is not found: workspaces.cosmo-workspace.github.io \"xxx\" not found
Error: failed to get workspace: workspaces.cosmo-workspace.github.io \"xxx\" not found
Usage:
cosmoctl workspace stop-instance WORKSPACE_NAME [flags]

Expand All @@ -1273,4 +1273,4 @@ Global Flags:
"""

['cosmoctl [workspace] [stop-instance] ❌ fail with invalid args: workspace stop-instance xxx --user user1 2']
SnapShot = 'workspace is not found: workspaces.cosmo-workspace.github.io "xxx" not found'
SnapShot = 'failed to get workspace: workspaces.cosmo-workspace.github.io "xxx" not found'
14 changes: 7 additions & 7 deletions internal/dashboard/__snapshots__/auth_handler_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ SnapShot = """
"""

['Dashboard server [auth] [Login] ❌ fail with invalid request: Entry: password:"password1" 1']
SnapShot = 'permission_denied: incorrect user or password'
SnapShot = 'permission_denied: forbidden: incorrect user or password'

['Dashboard server [auth] [Login] ❌ fail with invalid request: Entry: user_name:"ldap-user" password:"invalid" 1']
SnapShot = 'permission_denied: incorrect user or password'
SnapShot = 'permission_denied: forbidden: incorrect user or password'

['Dashboard server [auth] [Login] ❌ fail with invalid request: Entry: user_name:"normal-user" 1']
SnapShot = 'permission_denied: incorrect user or password'
SnapShot = 'permission_denied: forbidden: incorrect user or password'

['Dashboard server [auth] [Login] ❌ fail with invalid request: Entry: user_name:"normal-user" password:"invalid" 1']
SnapShot = 'permission_denied: incorrect user or password'
SnapShot = 'permission_denied: forbidden: incorrect user or password'

['Dashboard server [auth] [Login] ❌ fail with invalid request: Entry: user_name:"xxxxxxx" password:"password1" 1']
SnapShot = 'permission_denied: incorrect user or password'
SnapShot = 'permission_denied: forbidden: incorrect user or password'

['Dashboard server [auth] [Logout] ✅ success in normal context: Entry: logined session 1']
SnapShot = """
Expand All @@ -46,7 +46,7 @@ SnapShot = """
SnapShot = 'test-server=; Path=/; Domain=test.domain; Max-Age=0; HttpOnly; SameSite=Lax'

['Dashboard server [auth] [Logout] ❌ fail with invalid request: Entry: logouted session 1']
SnapShot = 'unauthenticated: failed to get session from store'
SnapShot = 'unauthenticated: failed to get session from store: securecookie: the value is not valid'

['Dashboard server [auth] [Logout] ❌ fail with invalid request: Entry: nil session 1']
SnapShot = 'unauthenticated: session is not found'
Expand All @@ -60,7 +60,7 @@ SnapShot = """
"""

['Dashboard server [auth] [Verify] ❌ fail with invalid request: Entry: logouted session 1']
SnapShot = 'unauthenticated: failed to get session from store'
SnapShot = 'unauthenticated: failed to get session from store: securecookie: the value is not valid'

['Dashboard server [auth] [Verify] ❌ fail with invalid request: Entry: nil session 1']
SnapShot = 'unauthenticated: session is not found'
4 changes: 2 additions & 2 deletions internal/dashboard/__snapshots__/template_handler_test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ SnapShot = """
"""

['Dashboard server [Template] [GetUserAddonTemplates] ❌ fail with an unexpected error at list: Entry: admin-user, not empty, 1']
SnapShot = 'internal: failed to list UserAddon Templates'
SnapShot = 'internal: Internal error occurred: failed to list UserAddon Templates: template list error'

['Dashboard server [Template] [GetWorkspaceTemplates] ✅ success in normal context: Entry: admin-user, empty, 1']
SnapShot = """
Expand Down Expand Up @@ -247,4 +247,4 @@ SnapShot = """
"""

['Dashboard server [Template] [GetWorkspaceTemplates] ❌ fail with an unexpected error at list: Entry: admin-user, not empty, 1']
SnapShot = 'internal: failed to list WorkspaceTemplates'
SnapShot = 'internal: Internal error occurred: failed to list WorkspaceTemplates: template list error'
Loading